[Python-bugs-list] [ python-Feature Requests-622230 ] def object.new_method(self):

noreply@sourceforge.net noreply@sourceforge.net
Mon, 04 Nov 2002 02:29:56 -0800


Feature Requests item #622230, was opened at 2002-10-12 08:04
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=622230&group_id=5470

Category: Parser/Compiler
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Dan Parisien (mathematician)
Assigned to: Nobody/Anonymous (nobody)
Summary: def object.new_method(self):

Initial Comment:
I want to be able to create functions inside objects 
instead of having to do:<code> 
class x: 
    pass 
def new_method(self): 
    pass 
x.new_method = new_method 
del new_method 
</code> 
I want to do: <code> 
class x: 
    pass 
def x.new_method(self): 
    pass 
</code> 
Why isn't this possible? Wouldn't it be cool? 
 

----------------------------------------------------------------------

>Comment By: Martin v. L÷wis (loewis)
Date: 2002-11-04 11:29

Message:
Logged In: YES 
user_id=21627

It's simply not possible because nobody has though of that.

I personally would not consider it cool: Python expresses
nesting of definition with indentation, not with full-stop
separators. Unless you implement it yourself, I'd expect
that it is unlilkely that anybody will act on this request
in the coming years.

----------------------------------------------------------------------

Comment By: Dan Parisien (mathematician)
Date: 2002-10-12 08:08

Message:
Logged In: YES 
user_id=118203

Repost with attempted better formatting: 
 
I don't want to do: 
class x: 
&nbsp;&nbsp;&nbsp;&nbsp;pass 
def new_method(self): 
&nbsp;&nbsp;&nbsp;&nbsp;pass 
x.new_method = new_method 
del new_method 
 
I want to do: 
class x: 
&nbsp;&nbsp;&nbsp;&nbsp;pass 
def x.new_method(self): 
&nbsp;&nbsp;&nbsp;&nbsp;pass 

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=622230&group_id=5470