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 deont...@gmail.com wrote: 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

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' %

Python Learning Environment

2010-04-17 Thread Vijay Shanker Dubey
for python command - python - python2 - python2.5 - python2.6 - python3 - python3.1 what does this mean? I am able to run run my first program with all these command. should i remove all these and have the latest one? I am confused about these finding. Is this okay to have these all? Regards, Vijay

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 vijay.s...@gmail.com wrote: Yes you are right about symlink thing. So what should I do