Python rocks
Josiah Carlson
josiah.carlson at sbcglobal.net
Sat Jun 2 22:32:04 EDT 2007
Mark Carter wrote:
> Josiah Carlson wrote:
>> What kind of scoping did you desire?
>
> Well, I had in mind so that if you defined a function, but wanted to
> access a global var, that you didn't have to use the global keyword. Not
> much of a biggie, I guess.
You already get read access to globals without using the global keyword.
To replace what the global name points to you need to use the global
keyword, but if it is mutable (list, dictionary, etc.), you can append
to it, delete items from it, etc., all without keywords.
> I guess that about wraps it up, then. Python pretty much has it all.
> Except for macros - which is not necessarily a dealbreaker, anyway.
Yeah, the lack of macros sometimes bothers me, then I remember that if I
*really* need them, there's always Logix and bytecodehacks.inline:
http://bytecodehacks.sourceforge.net/bch-docs/bch/module-bytecodehacks.inline.html
I don't know how much work it would take to get the bytecodehacks
working in a modern Python, but it may be an interesting exercise.
- Josiah
More information about the Python-list
mailing list