Python Newbie

Steven D'Aprano steve+comp.lang.python at pearwood.info
Mon Feb 25 02:11:44 CET 2013


On Sun, 24 Feb 2013 17:40:54 -0500, Mitya Sirenef wrote:

> But if block doesn't have to be inside a function, right? It needs to be
> inside a module, but then again everything is inside a module, but it
> wouldn't be very object-oriented if the module was the only object in
> Python :-).

Python doesn't have code blocks as distinct values. I suppose you could 
fake it using compile() and eval() by hand, but it wouldn't work very 
well.

Ruby-style code blocks have been requested for many years. GvR has given 
his support to this *in principle*, but it depends on somebody thinking 
up decent, unambiguous syntax that works with the rest of Python.


-- 
Steven



More information about the Python-list mailing list