alias method definitions / syntactic sugar suggestion
Chris Rebert
clp2 at rebertia.com
Thu Mar 5 23:39:17 EST 2009
On Thu, Mar 5, 2009 at 6:17 PM, Tennessee Leeuwenburg
<tleeuwenburg at gmail.com> wrote:
> I'm not sure if this problem I face affects many other people, but I'll just
> describe it and see what kind of feedback I get.
>
> I have a suggestion for a new piece of Python syntax when defining methods.
> I have seen the following done, and have done it myself
>
>
> class FanstasticClass:
>
> def __init__(self):
> self.someFantasticMethod("Hello")
>
> def someFantasticMethod(self, argument = True):
> print argument
>
> justAsFantastic = someFantasticMethod
This sounds like a code smell to me. You shouldn't have 2 methods with
different names that do the same thing, it seems like bad design IMHO.
Also, I don't think this is done anywhere near frequently enough to
warrant new syntax. I'm -1 on the idea personally.
Cheers,
Chris
--
I have a blog:
http://blog.rebertia.com
More information about the Python-list
mailing list