Limits on number of classes?

Discussion in 'Python' started by John Hunter, Jun 13, 2004.

  1. John Hunter

    John Hunter Guest

    >>>>> "Kamilche" == Kamilche <> writes:

    Kamilche> My design reqires hundreds of classes, maybe over a
    Kamilche> thousand. Can Python handle that? Will there be a speed
    Kamilche> hit? Just wondering if anyone had hit the limits of

    Never heard of such a problem. Here's a little script that creates
    10000 classes; doesn't seem to strain python


    for i in range(10000):
    exec('class C%d: pass'%i)

    c = C1234()
    c.x = 1
    print c.x
    John Hunter, Jun 13, 2004
    #1
    1. Advertising

  2. John Hunter

    Kamilche Guest

    My design reqires hundreds of classes, maybe over a thousand. Can
    Python handle that? Will there be a speed hit? Just wondering if
    anyone had hit the limits of Python.
    Kamilche, Jun 13, 2004
    #2
    1. Advertising

  3. John Hunter

    John Roth Guest

    "Kamilche" <> wrote in message
    news:...
    > My design reqires hundreds of classes, maybe over a thousand. Can
    > Python handle that? Will there be a speed hit? Just wondering if
    > anyone had hit the limits of Python.


    Classes are first class objects like everything else. The only
    limit on number of classes is the amount of memory - just
    like everything else. That said, class objects are quite large
    as such things go.

    As far as performance goes, very deep inheritance structures
    might take a bit of a performance hit since it has to check the
    MRO on accesses.

    John Roth
    John Roth, Jun 13, 2004
    #3
    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. jack
    Replies:
    0
    Views:
    6,065
  2. Meh-Lit Kim
    Replies:
    1
    Views:
    767
    Chris Uppal
    Oct 8, 2003
  3. Nathan Sokalski
    Replies:
    9
    Views:
    487
    Nathan Sokalski
    Jan 8, 2007
  4. Nathan Sokalski
    Replies:
    9
    Views:
    164
    Nathan Sokalski
    Jan 8, 2007
  5. ildar

    .NET limits a number of HTTP connections

    ildar, Apr 1, 2005, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    221
    ildar
    Apr 1, 2005
Loading...

Share This Page