Am 27.02.2010 10:00, schrieb alex23:
Michael Rudolf 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=1016
Michael Rudolf 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: http://blog.ianbicking.org/more-o
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:
Machine.unmount_raid_first
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 wond
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 adva
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
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
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.
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 "", line 1, in
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:
> So - What would be the most pythonic way to emulate this?
> Is there any better Idom tha
Michael Rudolf 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):
> F
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 "", lin
> 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 "", line 1, in
> a()
> TypeError: a() takes exactly 1 argument (0 given)
>
> So - What would
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 "", line 1, in
a()
TypeError:
14 matches
Mail list logo