Some language proposals.

Paul Prescod paul at prescod.net
Wed Feb 25 10:19:05 CET 2004


Jacek Generowicz wrote:

> 
> Could somebody point me to an explanation of why closures are broken
> in this way in the first place, please ?

a = 5
def b():
	a = 6
	print a
b()
print a

What will this print?

5
6

Okay, then.

a = 5
def b():
	a = 6
	def c():
		a = 7
		print a
	print a
	c()

print b()()
print a

What does this print?

7
6
5

Python uses a single syntax for declarating a variable and assigning to 
it. This causes a problem for Lisp purists but is otherwise helpful.

  Paul Prescod






More information about the Python-list mailing list