Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-24 Thread Marco Mariani
Scott David Daniels wrote: I am afraid it will make it too easy to define functions in other modules remotely, a tempting sharp stick to poke your eye out with. It's not very hard at the moment, and I don't see lots of eyes flying by. I don't know about Ruby where monkeypatching seems to be

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-24 Thread Steven D'Aprano
On Thu, 23 Apr 2009 10:48:57 -0700, Scott David Daniels wrote: I am afraid it will make it too easy to define functions in other modules remotely, a tempting sharp stick to poke your eye out with. It's not terribly difficult to do so already: def spam(): ... return spam spam spam ...

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-24 Thread Scott David Daniels
Marco Mariani wrote: Scott David Daniels wrote: I am afraid it will make it too easy to define functions in other modules remotely, a tempting sharp stick to poke your eye out with. Imagine debugging a pile of code that includes a module with: import random def random.random():

Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-23 Thread Jeremy Banks
Hi. I'm sure there've been debates about this before, but I can't seem to figure out what to search for to pull them up, so I'm asking here. It seems to me that a lot of things could be made much easier if you could use primaries other than basic identifiers for the target of function

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-23 Thread Gary Herron
Jeremy Banks wrote: Hi. I'm sure there've been debates about this before, but I can't seem to figure out what to search for to pull them up, so I'm asking here. It seems to me that a lot of things could be made much easier if you could use primaries other than basic identifiers for the target

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-23 Thread Jeremy Banks
Thanks for your comments. On Thu, Apr 23, 2009 at 11:52, Gary Herron gher...@islandtraining.com wrote: [...] There's no need for a specific addition to the syntax to do this. Try this:   def foo_bar():       return(...)   foo.bar = foo_bar [...] and this:   def foo_bar():      

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-23 Thread Alan Franzoni
Jeremy Banks was kind enough to say: Hi. I'm sure there've been debates about this before, but I can't seem to figure out what to search for to pull them up, so I'm asking here. I'm not exactly sure what you mean... if you want to add functions to another fuction, just do it this way: def

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-23 Thread Gary Herron
Jeremy Banks wrote: Thanks for your comments. On Thu, Apr 23, 2009 at 11:52, Gary Herron gher...@islandtraining.com wrote: [...] There's no need for a specific addition to the syntax to do this. Try this: def foo_bar(): return(...) foo.bar = foo_bar [...]

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-23 Thread Jeremy Banks
Things like your suggestion are called syntactic-sugar  -- syntax that adds a convenience, but *no* new functionality.  Python has plenty of syntactic-sugars, and more will be added in the future.  To make an argument for such an addition, one would have to describe some compelling (and

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-23 Thread Jeremy Banks
On Thu, Apr 23, 2009 at 13:03, John Krukoff jkruk...@ltgc.com wrote: You probably want to be searching for multi-line lambda to find the past decade or so of this argument, as that's where most people who argued for this came from. But, if you'd just like a bit of discouragement, here's GvR

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-23 Thread John Krukoff
On Thu, 2009-04-23 at 12:26 -0300, Jeremy Banks wrote: Things like your suggestion are called syntactic-sugar -- syntax that adds a convenience, but *no* new functionality. Python has plenty of syntactic-sugars, and more will be added in the future. To make an argument for such an

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-23 Thread Marco Mariani
Jeremy Banks wrote: I've read those discussion before, but somehow never made the connection between those and this. I'll give that article a read, it probably details exactly the perspective I'm looking for. Thank you! You could also read this:

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-23 Thread Scott David Daniels
Jeremy Banks wrote: (proposing def lhs(args): ... On Thu, Apr 23, 2009 at 11:52, Gary Herron gher...@islandtraining.com wrote: Try this: def foo_bar(): return(...) foo.bar = foo_bar and this: def foo_bar(): return(...) foo[bar] = foo_bar I understand that this is possible

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-23 Thread Terry Reedy
Jeremy Banks wrote: Hi. I'm sure there've been debates about this before, but I can't seem to figure out what to search for to pull them up, so I'm asking here. It seems to me that a lot of things could be made much easier if you could use primaries other than basic identifiers for the target

Re: Why can function definitions only use identifiers, and not attribute references or any other primaries?

2009-04-23 Thread Jeremy Banks
On Apr 23, 5:23 pm, Terry Reedy tjre...@udel.edu wrote: Jeremy Banks wrote: Hi. I'm sure there've been debates about this before, but I can't seem to figure out what to search for to pull them up, so I'm asking here. It seems to me that a lot of things could be made much easier if you