class problem

F

fegge

when i declare a class, is there difference between the below:
class myClass():
class myClass(threading.Thread)
 
D

Duncan Booth

fegge said:
when i declare a class, is there difference between the below:
class myClass():
class myClass(threading.Thread)
Yes, the first one is a syntax error because you aren't allowed empty
parentheses in a class statement but the second one is a syntax error
because you don't have a colon.
 
F

Fredrik Lundh

fegge said:
when i declare a class, is there difference between the below:
class myClass():
class myClass(threading.Thread)

the former is a base class, the latter inherits behaviour from the
threading.Thread class.

*please* read the tutorial before proceeding.

</F>
 
F

Fredrik Lundh

Duncan said:
Yes, the first one is a syntax error because you aren't allowed empty
parentheses in a class statement

however,

$ python
Python 2.5c1 /.../.... pass
....
</F>
 
B

Bruno Desthuilliers

fegge a écrit :
when i declare a class, is there difference between the below:
class myClass():
class myClass(threading.Thread)
If you don't know the answer to this, then it's time to read the fine
manual. Please come back when done.
 
J

Jorge Vargas

however,

$ python
Python 2.5c1 /.../
... pass
...

</F>
D:\python>python
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information. File "<stdin>", line 1
class foo():
^
SyntaxError: invalid syntax

seems like a feature/bug of 2.5, why your learning a language with a
beta version?
 
F

Fredrik Lundh

Jorge said:
seems like a feature/bug of 2.5, why your learning a language with a
beta version?

learning?

(btw, the "c" in 2.5c1 means *release candidate*, not "beta").

</F>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top