Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Python 3 sucks

Name: Anonymous 2009-01-12 14:10

The third version of FIOC ( Python3000 for you cheese lovers ) is kind of lame, even lamer than classic FIOC. Minor changes suck and bigger ones weren't necessary.

Name: Anonymous 2010-04-20 14:06

>>56,57
My point is: that's how Python scopes work. The bytecode compiler statically identifies every name that belongs to a scope. Any expression that uses the scope has access to every variable of the scope, no matter where it is first assigned or used, lexically.

It is not a good thing in the whole scheme of things, I personally prefer explicit declaration with additional safeguards a la C#.

However, it's the best one can have given the "assignment is declaration" rule. Accounting for relative positions of assignment in the scope would produce subtle errors with horrible consequences.

Also, how is the following code supposed to work? Is correct scope determined statically or dynamically?

x = 10
def f(n):
   if n: x = 20
   print x

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List