D
Daniel Gee
A while ago I wrote a class in Java for all kinds of dice rolling
methods, as many sides as you want, as many dice as you want, only
count values above or below some number in the total, things like
that. Now I'm writing a project in Python that needs to be able to
make use of that kind of a class.
The Java version has static methods for common roll styles (XdY and XdY
+Z) for classes that just want a result but don't want to bother
keeping an object around for later.
So the question is, assuming that I wanted to keep the static method
behavior (which I'm not really sure I do), how does one format the
method header on a 'static' method in Python? Is it just something
like:
class Foo:
def statAdd(self,a):
return a+5
or do you drop the 'self' bit and just use a 1 variable parameter list?
methods, as many sides as you want, as many dice as you want, only
count values above or below some number in the total, things like
that. Now I'm writing a project in Python that needs to be able to
make use of that kind of a class.
The Java version has static methods for common roll styles (XdY and XdY
+Z) for classes that just want a result but don't want to bother
keeping an object around for later.
So the question is, assuming that I wanted to keep the static method
behavior (which I'm not really sure I do), how does one format the
method header on a 'static' method in Python? Is it just something
like:
class Foo:
def statAdd(self,a):
return a+5
or do you drop the 'self' bit and just use a 1 variable parameter list?