[ python-Feature Requests-950644 ] Allow any lvalue for function
definitions
SourceForge.net
noreply at sourceforge.net
Sat May 8 21:52:59 EDT 2004
Feature Requests item #950644, was opened at 2004-05-09 01:52
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=950644&group_id=5470
Category: Parser/Compiler
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: David Albert Torpey (dtorp)
Assigned to: Nobody/Anonymous (nobody)
Summary: Allow any lvalue for function definitions
Initial Comment:
A definition like:
def M(x): return 2*x
is the same as:
M = lambda x: 2*x
With the latter form, I can use any lvalue:
A[0] = lambda x: 2*x
B.f = lambda x: 2*x
But with the first form, you're locked into just using a
plain variable name. If this were fixed, it wouldn't
break anything else but would be useful for making
method definitons outside of a class definition:
This came up when I was experimenting with David
MacQuigg's ideas for prototype OO. I want to write
something like:
Account = Object.clone()
Account.balance = 0
def Account.deposit(self, v):
self.balance += v
Unfortunately, the latter has to be written:
def Account.deposit(self, v):
self.balance += v
Account.deposit = deposit
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=950644&group_id=5470
More information about the Python-bugs-list
mailing list