> Erm. Shouldn't that be the following?
>
> class Msg:
> def __init__(self,s):
> self.s = s
> def say(self):
> if *not *self.s: print "No message"
> else: print self.s
Yep, its my week for making mistakes.
Although this one was just a typo...
My only excuse is that I'm really
Alan Gauld wrote:
> > How do I create the equivalent of a Java class in Python? I've been
> looking
> > at the reference, and it's been confusing to me at least.
>
> Adapted from my book:
>
> Java code:
>
> class Msg{
>private String txt;
>public Msg(String s){
> this.txt = s;
> How do I create the equivalent of a
Java class in Python? I've been looking> at the reference, and it's been
confusing to me at least.
Adapted from my book:
Java code:
class Msg{
private String
txt;
public Msg(String
s){
this.txt =
s;
}
public void
say(){
if
> How do I create the equivalent of a Java class in Python? I've been
> looking at the reference, and it's been confusing to me at least.
You may want to look at a tutorial on classes, like:
http://www.freenetpages.co.uk/hp/alan.gauld/tutclass.htm
Does this help?
Best of wishes!
> How do I create the equivalent of a Java class in Python? I've been looking
> at the reference, and it's been confusing to me at least.
can you clarify what you are looking for? do you want to create a
class using Python, create the equivalent of a Java class using Python
via Jython, accessing
Hey
all,
How do I create the
equivalent of a Java class in Python? I've been looking at the reference, and
it's been confusing to me at least.
Thanks,
Nathan Pinno
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo