Hello,

I don't remember exactly how to do that. As an example:

class Source (str):
    __slots__ = ['i', 'n']
    def __init__ (self, string):
        self.i = 0                  # current matching index in source
        self.n = len(string)        # number of ucodes (Unicode code points)
        #~ str.__init__(self, string)

I thought I needed to call str's __init__, as in the line comented out, but (1) python refuses with a TypeError (2) all seems to work fine (meaning, the string is well stored, *implicitely*). Am I missing some point, or is this the way to do? How does it work? I particular, how does python know which param to take as source string? (There could be other params to __init__.)

Thank you,
Denis
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to