Michael Rudolf spamfres...@ch3ka.de wrote:
In Java, Method Overloading is my best friend
Guido wrote a nice article[1] on multimethods using decorators,
which Ian Bicking followed up on[2] with a non-global approach.
1: http://www.artima.com/weblogs/viewpost.jsp?thread=101605
2:
Am 27.02.2010 10:00, schrieb alex23:
Michael Rudolfspamfres...@ch3ka.de wrote:
In Java, Method Overloading is my best friend
Guido wrote a nice article[1] on multimethods using decorators,
which Ian Bicking followed up on[2] with a non-global approach.
1:
Michael Rudolf wrote:
First: Thanks for all the replies so far, they really helped me.
Am 24.02.2010 11:28, schrieb Jean-Michel Pichavant:
def a(x=None):
if x is None:
pass
else:
pass
This is the way to do it python, and it has its advantages: 1 docstring,
1 way do
Jean-Michel Pichavant wrote:
Michael Rudolf wrote:
First: Thanks for all the replies so far, they really helped me.
Am 24.02.2010 11:28, schrieb Jean-Michel Pichavant:
def a(x=None):
if x is None:
pass
else:
pass
This is the way to do it python, and it has its
Am 25.02.2010 11:58, schrieb Jean-Michel Pichavant:
You said it yourself: simply make two or three functions and name
them appropiately :-)
When 2 methods of a class were to have the same name for doing
completely different things like you said, there's a design flaw to my
opinion.
JM
I
Michael Rudolf a écrit :
(snip)
(pseudocode - this is *not* python ;)
class Machines (Object):
@classmethod
def shutdown(cls, Machine, emergency=False):
try:
if Machine is instanceof(Fileservers):
if not emergency:
Michael Rudolf wrote:
Just a quick question about what would be the most pythonic approach
in this.
In Java, Method Overloading is my best friend, but this won't work in
Python:
def a():
pass
def a(x):
pass
a()
Traceback (most recent call last):
File pyshell#12, line 1, in
First: Thanks for all the replies so far, they really helped me.
Am 24.02.2010 11:28, schrieb Jean-Michel Pichavant:
def a(x=None):
if x is None:
pass
else:
pass
This is the way to do it python, and it has its advantages: 1 docstring,
1 way do do it, 1 interface.
Am 24.02.10 12:42, schrieb Michael Rudolf:
First: Thanks for all the replies so far, they really helped me.
Am 24.02.2010 11:28, schrieb Jean-Michel Pichavant:
def a(x=None):
if x is None:
pass
else:
pass
This is the way to do it python, and it has its advantages: 1 docstring,
1 way do do
Just a quick question about what would be the most pythonic approach in
this.
In Java, Method Overloading is my best friend, but this won't work in
Python:
def a():
pass
def a(x):
pass
a()
Traceback (most recent call last):
File pyshell#12, line 1, in module
a()
In Java, Method Overloading is my best friend, but this won't work in
Python:
def a():
pass
def a(x):
pass
a()
Traceback (most recent call last):
File pyshell#12, line 1, in module
a()
TypeError: a() takes exactly 1 argument (0 given)
So - What would be the
On 2/23/2010 1:25 PM, Michael Rudolf wrote:
Just a quick question about what would be the most pythonic approach in
this.
In Java, Method Overloading is my best friend, but this won't work in
Python:
def a():
pass
def a(x):
pass
a()
Traceback (most recent call last):
File pyshell#12,
Michael Rudolf spamfres...@ch3ka.de writes:
Just a quick question about what would be the most pythonic approach
in this.
In Java, Method Overloading is my best friend, but this won't work in
Python:
def a():
pass
def a(x):
pass
a()
Traceback (most recent call last):
On 02/24/10 05:25, Michael Rudolf wrote:
Just a quick question about what would be the most pythonic approach in
this.
In Java, Method Overloading is my best friend, but this won't work in
Python:
snip
So - What would be the most pythonic way to emulate this?
Is there any better Idom than:
14 matches
Mail list logo