[Tutor] Declaring methods in modules.

Patrick Sabin patrick.just4fun at gmail.com
Sun Apr 11 14:43:02 CEST 2010


>    ipAddress = "123.123.123.123"
>    emails = ipAddress.GetEmailAddresses()

Not exactly sure, what you want, but maybe something like this?

class mystr(str):
     def GetEmailAddresses(self):
         return [str(self)]

ipAddress = mystr("123.123.123.123")
emails = ipAddress.GetEmailAddresses()

- Patrick


More information about the Tutor mailing list