keyerror '__repr__'

2012-08-04 Thread vijay shanker
hi i have this class book class book: def __init__(self,name,price): self.name = name self.price = price def __getattr__(self,attr): if attr == '__str__': print 'intercepting in-built method call ' return '%s:%s' % (object.__getattribute__(s

Coercing one object to type of another

2013-02-09 Thread Vijay Shanker
Hi Inside a function i get a two arguments, say arg1 and arg2, how can i convert arg2 to same type as arg1 ? I dont know type of arg1 or arg2 for that matter, I just want to convert arg2 to type of arg1 if possible and handle the exception if raised. Also: >>> int('2') 2 >>> float('2.0') 2.0 >>>

Re: Coercing one object to type of another

2013-02-09 Thread Vijay Shanker
On Saturday, February 9, 2013 4:13:28 PM UTC+5:30, Chris Angelico wrote: > On Sat, Feb 9, 2013 at 9:29 PM, Vijay Shanker wrote: > > > Hi > > > Inside a function i get a two arguments, say arg1 and arg2, how can i > > convert arg2 to same type as arg1 ? > > &

Python Learning Environment

2010-04-17 Thread Vijay Shanker Dubey
Regards, Vijay Shanker Dubey -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Learning Environment

2010-04-17 Thread Vijay Shanker Dubey
Thanks friend, Got the point. Regards, Vijay Shanker Dubey On Sat, Apr 17, 2010 at 11:31 PM, Krister Svanlund < krister.svanl...@gmail.com> wrote: > On Sat, Apr 17, 2010 at 7:06 PM, Vijay Shanker Dubey > wrote: > > Yes you are right about symlink thing. > > So what