adding standard types to new type

Discussion in 'Python' started by kman3048, Aug 11, 2005.

  1. kman3048

    kman3048 Guest

    I've created a new type using the API and want to add not only
    methods (which is easy with PyMethodDef structure) but also insert
    several Python standard type variables.
    Is there some equivalent to PyModule_AddObject - just working on the
    new type instead Module? Or do I have to add a dictionary to the new
    type and insert the new variables to the dictionary?
    What is the correct way?

    Using the new type should be:

    import NewTypeModule
    newtypevar=NewTypeModule.create()
    dir(newtypevar)
    <'method1', 'method2', 'variable1', ...>
    type(newtypevar.variable1)
    <'tuple'>

    Thanks a Lot!
    Matt
     
    kman3048, Aug 11, 2005
    #1
    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. Peter Ashenden
    Replies:
    5
    Views:
    600
    Peter Ashenden
    Dec 17, 2004
  2. Replies:
    3
    Views:
    818
  3. Replies:
    163
    Views:
    3,258
  4. David Hutz

    Adding a custom type to the list of Field Types

    David Hutz, Jun 6, 2006, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    102
    David Hutz
    Jun 6, 2006
  5. ittium
    Replies:
    4
    Views:
    300
    Goran
    Dec 9, 2011
Loading...

Share This Page