Programmer's Corner Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Programmer's Corner - Forums


Creating your own data types

 
Post new topic   Reply to topic    Programmer's Corner Forum Index -> Python
Author Message
Cerulean
Gokenin


Joined: 22 Oct 2004
Posts: 742
Location: London, England

PostPosted: Sat Oct 30, 2004 8:23 pm    Post subject: Creating your own data types Reply with quote

Out of complete curiosity:
Is it possible? Not as in the sense reimplement __mul__, __add__, etc, but as in:
somevariable = 3kl

Just like doing i = 4 is the same as i = int(4)?
Back to top
Algorithms
Dragon


Joined: 21 Oct 2004
Posts: 343
Location: Florida

PostPosted: Mon Nov 01, 2004 2:32 pm    Post subject: Reply with quote

Huh?
Back to top
Cerulean
Gokenin


Joined: 22 Oct 2004
Posts: 742
Location: London, England

PostPosted: Mon Nov 01, 2004 3:35 pm    Post subject: Reply with quote

Lol, its a pointless question, but I was just wondering. You know, like anything inside quotation marks is a string, anything from 0-9 without quotation marks is an integer, etc.
Like..

type(134) -> int
type("hello") -> str

Can you make your own, i.e
type(7A) -> hex

Without touching the Python source, of course Rolling Eyes

Why, you ask? Because I always wondered.
Back to top
Algorithms
Dragon


Joined: 21 Oct 2004
Posts: 343
Location: Florida

PostPosted: Mon Nov 01, 2004 8:51 pm    Post subject: Reply with quote

Your own built-in type, no. Not without changing the source of Python and recompiling. You can make your own user defined instance which could as like a built-in type you such desired.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Programmer's Corner Forum Index -> Python All times are GMT - 5 Hours
Page 1 of 1

 


Powered by phpBB © 2001, 2002 phpBB Group