Whats so good about Python?
Russell E. Owen
owen at nospam.invalid
Thu May 9 15:54:56 EDT 2002
In article <Xns92087B795E5E7RASXnewsDFE1 at 130.133.1.4>,
Philip Swartzleonard <starx at pacbell.net> wrote:
>Russell E. Owen || Wed 08 May 2002 11:38:02a:
>
>> Nothing is perfect. Things I don't like about Python include
>> (everybody will have their own list, of course):
>> [various]
>> - Lack of explicit variable declarations. This makes use of local
>> variables vs variables you can see because you are in another
>> function's scope a minefield.
>
>Hm. Would it be helpful to have some kind of flag or something that
>prevents a name from attempting to access a variable outside of the
>local scope? That is, something like:
>
>def foo:
> lactose = 666
> [45 lines of code]
> if $lactose < 12:
> kill_things_and_drink_alot(dwarves, $lactose)
>
>Were $ is a flag saying 'do not attempt to access the variable from
>outside of the local scope'. Yeah, i know it's ugly and peraly, but I
>can't think of a better way on short notice.
Actually, I think "local" would be the ticket -- analogous to the
existing "global" -- but it was suggested and rejected when the variable
scoping rules were changed.
I've tried to use the new scoping several times and basically given up
-- I've found the behavior surprising and non-obvious, and I don't want
my code to be clear only to a Python guru.
-- Russell
More information about the Python-list
mailing list