a=0100; print a ; 64 how to reverse this?

2007-07-17 Thread mosi
Problem: how to get binary from integer and vice versa? The simplest way I know is: a = 0100 a 64 but: a = 100 (I want binary number) does not work that way. a.__hex__ exists a.__oct__ exists but where is a.__bin__ ??? What`s the simplest way to do this? Thank you very much. -- http://mail

Re: a=0100; print a ; 64 how to reverse this?

2007-07-17 Thread mosi
Thank you, this is great, I thought that this should be standard in python 2.4 or 2.5 or in some standard library (math ???) Didn`t find anything. On Jul 17, 2:05 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Jul 17, 9:09 pm, mosi <[EMAIL PROTECTED]> wrote: > > > >

Any way to program custom syntax to python prompt? >> I want to edit matrices.

2007-12-10 Thread mosi
how could this be done? The ";" sign is reserved, the "[ ]" is used for lists. Also, how to program custom operations for this new "class?" matrix ??? For example: >>> matrix + 2 [ 3, 4; 5, 6; 7, 8;] Possibly with operator overloading? I appreciate all yo