a strange question in it.comp.lang...
6e6op at excite.it
Wed Jan 8 19:19:58 CET 2003
this is (more or less) the translation
From: "Matteo Bertini" <m.bertini at tin.it>
Sent: Sunday, January 05, 2003 11:26 PM
Subject: [PYTHON] estendere tipi di base
> I can build a class in this way:
> class mystring(str):
> def is_email(self):
> return self.find("@")
> use it in:
> mystring("pippo at pippo.it").is_email()
> the answer is, can i define mystring to be the default string class?
> can i ''validate'' "pippo".is_email() ?
> maybe is not goot, but is only curiosity.
ok, then one answer jump in my brain:
there's a "place" where the interpreter load the __builtins__ package?
obviously __builtins__.str cannot be substitute with a customized one after
the __builtins__ load ,
but before load?
if the interpreter load __builtins__ in some place i can translate
with a __builtins__.mystr before that interpreter load __builtins__
is it possible?
Thanks a lot!
More information about the Python-list