Other notes

Doug Holton a at b.c
Tue Dec 28 22:17:49 EST 2004


bearophileHUGS at lycos.com wrote:

> for i in 1..12: pass
> for c in "a".."z": pass
....
 > @infix
 > def interval(x, y): return range(x, y+1) # 2 parameters needed
 > assert 5 interval 9 == interval(5,9)
....
 > 10) There can be something in the middle between the def statement and
 > the lambda.

These will likely not appear in CPython standard, but Livelogix runs on 
top of the CPython VM and supports ".." sequences and custom infix 
operators: http://logix.livelogix.com/tutorial/5-Standard-Logix.html

> 11) This is just a wild idea for an alternative syntax to specify a
> global variable inside a function. From:
> 
> def foo(x):
> global y
> y = y + 2
> (the last two lines are indented)
> 
> To:
> 
> def foo(x): global.y = global.y + 2
> 
> Beside the global.y, maybe it can exist a syntax like upper.y or
> caller.y that means the name y in the upper context. upper.upper.y etc.

This will also likely never appear in Python.  I like your idea though. 
  I implemented the same exact thing a couple months ago.  One 
difference though, you only need to type out the full "global.y" if you 
want to differentiate it from a local variable with the same name.


> 15) NetLogo is a kind of logo derived from StarLogo, implemented in
> Java.
> Show that this language is only partially a toy, and it can be useful
> to understand and learn nonlinear dynamics of many systems.

If you want to do something like Netlogo but using Python instead of 
Logo, see:  http://repast.sourceforge.net/
You can script repast in jython or you can script repast.net.

Also, you might request the NetLogo and StarLogo developers to support 
Jython (in addition to Logo) scripting in their next version (which is 
already in development and supports 3D).



More information about the Python-list mailing list