By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,907 Members | 1,932 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,907 IT Pros & Developers. It's quick & easy.

subtyping a builtin type in a C extension

P: n/a
I am trying to make a subtype of a string. Initially it will have no
new methods or attributes, the C equivalent of:

class myStr(str):
pass

I have experimented a bit, but am currently making a mess of it. Does
anybody have an example they can point to of inheriting from a builtin,
or a suggestion to point me in the right direction?

Oct 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
shawn wrote:
I am trying to make a subtype of a string. Initially it will have no
new methods or attributes, the C equivalent of:

class myStr(str):
pass

I have experimented a bit, but am currently making a mess of it. Does
anybody have an example they can point to of inheriting from a builtin,
or a suggestion to point me in the right direction?


The Python source distribution contains an example module xxsubtype that
shows how to subclass builtins:

http://cvs.sourceforge.net/viewcvs.p....1&view=markup

-- Gerhard

Oct 17 '05 #2

P: n/a
Thank you. I should have looked for this sort of example. That was
exactly what I needed.

I don't ask for help here very often, but when I have, I have ALWAYS
gotten faster results than with any commercial support option I have
used. We have a good developer community :-)

Oct 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.