inherit from data type

Chris Rebert clp2 at rebertia.com
Tue May 11 05:30:39 EDT 2010


On Tue, May 11, 2010 at 2:18 AM, Richard Lamboj
<richard.lamboj at bilcom.at> wrote:
<snip>
> What i also want to know:
>>>> variable1 = 10.50
>>>> type(variable1)
> <type 'float'>
>
> Is there a way to tell python that it use antoher class than float for float,
> like myfloat? Its just a "tell-me-what-is-possible".
>
> Sample:
>>>> variable1 = 10.50
>>>> type(variable1)
> <type 'myfloat'>

No, it's not possible to have the float literal syntax produce
instances of your custom subclass.

Cheers,
Chris
--
http://blog.rebertia.com



More information about the Python-list mailing list