Cristian wrote: > On Sep 21, 3:44 pm, Ron Adam <[EMAIL PROTECTED]> wrote: > > >> I think key may be to discuss names and name binding with your friend. How >> a name is not the object it self, like a variable is in other languages. >> For example show him how an object can have more than one name. And discus >> how names can be bound to nearly anything, including classes and functions. >> > > I could discuss name binding but it would be great if Python said this > itself. After all, you can even bind a module with the foo = bar > syntax by using __import__ function. If function definitions followed > the same pattern, I think a beginner would subconsciously (maybe even > consciously) realize that function names are just like everything > else. Actually, this would be helpful for many people. If you come > from a language like Java you're used to thinking of attributes and > methods as living in different namespaces. I think a new syntax will > encourage seasoned programmers think in a more Pythonic way. >
However, you still have to solve the problem of using a single-line construct (x = y) with a multi-line definition. That is the essential difference that def is designed to solve. The __import__ trick works because import is also a single line construct. The only proposal given in this thread is using consistent indentation within the parentheses, but parentheses are already explicitly designed to let you ignore the whitespace rules. To suddenly create a situation in which you have significant whitespace on the right side of an assignment statement, and *within parentheses* will break too much code, and make the solution unnecessarily ugly. Multi-line lambdas have been rejected because of this very problem, so unless you have a clean solution, I think your proposal falls into the category of "would be nice, but not in Python." Cheers, Cliff -- http://mail.python.org/mailman/listinfo/python-list