News for hackers. Stuff that matters.
Re:Grumpy: Go running Python by TillE on Wednesday January 04, 2017 @01:06PM (#13320539)
> Nobody uses that stuff in production code

Nobody uses the features of Python which make it a dynamic language? Google must write some really weird Python if their compiler is that strict.

Re:Grumpy: Go running Python by Animats on Wednesday January 04, 2017 @01:50PM (#13320970)
In Python, you can get at a variable, or even code, in another thread with "getattr()". You can monkey-patch another thread while it is running. This is not very useful, but it's easy to implement in a naive interpreter such as CPython. Part of the price for this is the Global Interpreter Lock, so you don't really have two threads running at once. PyPy has a huge amount of machinery so that stuff will work.

Grumpy doesn't even seem to try to implement that. That's a good thing. If you restrict Python a little, it's much easier to compile.

Re:Grumpy: Go running Python by mdaniel on Wednesday January 04, 2017 @05:24PM (#13322671)
> That's a good thing. If you restrict Python a little, it's much easier to compile.

Isn't that more or less what RPython does? https://rpython.readthedocs.io/en/latest/architecture.html I mean, I know that starting with a full-fledged(?) Py27 codebase rules out _actually_ using RPython for the stated goals of Grumpy, but I think the two projects agree in principle and differ about the definition of "restricted" :-)

Re:Grumpy: Go running Python by masklinn on Thursday January 05, 2017 @06:15AM (#13326263)
RPython is a restricted (hence R) language specifically for VM development, it is not a general-purpose language.
Re:Grumpy: Go running Python by coldtea on Wednesday January 04, 2017 @01:49PM (#13320964)
>Nobody uses the features of Python which make it a dynamic language?

Python has TONS of dynamicity besides those (eval and co), who are seldom used by anyone anyway....

If you think eval is what makes Python dynamic you're doing it wrong...

Re:Grumpy: Go running Python by weberc2 on Wednesday January 04, 2017 @02:16PM (#13321175)
I'm not sure what is meant by "dynamic language" in that sentence, but examining the compiler output, it supports the features of Python which I think of when I think of "dynamic language" (e.g., a class `Foo` gets compiled into a runtime `*Object` with collections of properties and methods, not into a `type Foo struct` with fixed fields and methods).
Re:Grumpy: Go running Python by bjt on Wednesday January 04, 2017 @04:00PM (#13321998)
Anybody running Django uses this. It uses the pattern of specifying plugins as class paths in strings in the config, which are then looped over and instantiated at runtime.

Frameworks do lots of such dynamic tricks in order to provide nice DSLs for building apps.

Re:Grumpy: Go running Python by orf on Wednesday January 04, 2017 @07:23PM (#13323539)
'exec' and 'eval'? No it's not, the importlib machinery is used (which doesn't just eval(read('import.py')))
Re:Grumpy: Go running Python by earthboundkid on Wednesday January 04, 2017 @11:14PM (#13324684)
I have never used exec or eval in production Python, and I doubt I could get them past code review because of the possible security impact.
Re:Grumpy: Go running Python by azinman2 on Wednesday January 04, 2017 @01:37PM (#13320844)
Their python is weird if it doesn't use eval?
Re:Grumpy: Go running Python by bjt on Wednesday January 04, 2017 @04:07PM (#13322050)
or getattr/setattr, or dynamically building classes with type(), or probably more features I can't remember now.
Re:Grumpy: Go running Python by Sean1708 on Thursday January 05, 2017 @10:04AM (#13327583)

  > getattr/setattr, or dynamically building classes with type()
I think Grumpy handles both those things fine.