[Python-ideas] Statements vs Expressions... why?

Mathias Panzenböck grosser.meister.morti at gmx.net
Fri Sep 12 03:15:23 CEST 2008


The only thing I'd like would be anonymous classes (like in java) and anonymous
functions:

class A(object):
	def some_method(self):
		pass

def function_that_wants_a_A(a):
	...

function_that_wants_a_A(A():
	def some_method(self):
		# I really like this feature of java
		# granted, it makes a lot more sense in the
		# context of a language like java.
		# there it's very handy
		print "this is my derived anonymous class"
)


def function_that_wants_a_callback(callback):
	...

function_that_wants_a_callback(def(a,b,c):
	# do a lot of stuff that does not fit into a lambda
	# this reminds a bit of rubies closures ;)
)

I don't think anything else concerning statement as expression is in any way
necessary or handy.




More information about the Python-ideas mailing list