class problem

Discussion in 'Python' started by fegge, Aug 28, 2006.

  1. fegge

    fegge Guest

    when i declare a class, is there difference between the below:
    class myClass():
    class myClass(threading.Thread)
    fegge, Aug 28, 2006
    #1
    1. Advertising

  2. fegge

    Duncan Booth Guest

    fegge wrote:

    > 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.
    Duncan Booth, Aug 28, 2006
    #2
    1. Advertising

  3. fegge

    fegge Guest

    sorry ,look at this :
    class myClass:
    class myClass(threading.Thread):
    fegge, Aug 28, 2006
    #3
  4. fegge wrote:

    > 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>
    Fredrik Lundh, Aug 28, 2006
    #4
  5. Duncan Booth wrote:

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


    however,

    $ python
    Python 2.5c1 /.../
    >>> class foo():

    .... pass
    ....
    >>> foo

    <class __main__.foo at 0x00A3D840>
    >>>


    </F>
    Fredrik Lundh, Aug 28, 2006
    #5
  6. 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.
    Bruno Desthuilliers, Aug 28, 2006
    #6
  7. fegge

    Jorge Vargas Guest

    On 8/28/06, Fredrik Lundh <> wrote:
    > Duncan Booth wrote:
    >
    > > Yes, the first one is a syntax error because you aren't allowed empty
    > > parentheses in a class statement

    >
    > however,
    >
    > $ python
    > Python 2.5c1 /.../
    > >>> class foo():

    > ... pass
    > ...
    > >>> foo

    > <class __main__.foo at 0x00A3D840>
    > >>>

    >
    > </F>
    >
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >

    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.
    >>> class foo():

    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?
    Jorge Vargas, Aug 28, 2006
    #7
  8. Jorge Vargas wrote:

    > 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>
    Fredrik Lundh, Aug 28, 2006
    #8
  9. fegge

    Jorge Vargas Guest

    On 8/28/06, Fredrik Lundh <> wrote:
    > Jorge Vargas wrote:
    >
    > > seems like a feature/bug of 2.5, why your learning a language with a
    > > beta version?

    >
    > learning?

    I'm sorry I though you where the original poster.
    >
    > (btw, the "c" in 2.5c1 means *release candidate*, not "beta").


    I was referring to "beta" as oposite to stable/released
    >
    > </F>
    >
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >
    Jorge Vargas, Aug 28, 2006
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. cyril
    Replies:
    2
    Views:
    3,832
    cyril
    Aug 25, 2004
  2. Purush
    Replies:
    4
    Views:
    1,605
    Purush Rudrakshala
    Apr 13, 2005
  3. E11
    Replies:
    1
    Views:
    4,708
    Thomas Weidenfeller
    Oct 12, 2005
  4. christopher diggins
    Replies:
    16
    Views:
    730
    Pete Becker
    May 4, 2005
  5. Joseph Turian
    Replies:
    5
    Views:
    573
Loading...

Share This Page