Re: Inline Calculation of Dictionary Values

2010-04-21 Thread ++imanshu
On Apr 21, 6:10 pm, Chris Rebert wrote: > On Wed, Apr 21, 2010 at 5:51 AM, ++imanshu wrote: > >     Is it possible to something along these lines in python :- > > > map = { > > 'key1': f(), > > 'key2': modify_state(); val = f(); restore_state()

Re: Inline Calculation of Dictionary Values

2010-04-21 Thread ++imanshu
On Apr 21, 7:31 pm, Dave Angel wrote: > ++imanshu wrote: > > Hi, > > >      Is it possible to something along these lines in python :- > > > map = { > > 'key1': f(), > > 'key2': modify_state(); val = f(); restore_state(); val, > &

Inline Calculation of Dictionary Values

2010-04-21 Thread ++imanshu
Hi, Is it possible to something along these lines in python :- map = { 'key1': f(), 'key2': modify_state(); val = f(); restore_state(); val, 'key3': f(), } For 'key2' I want to store the value returned by f() but after modifying the state. Do we have something like a "bare block". I a

Re: How to Detect Use of Unassigned(Undefined) Variable(Function)

2009-11-27 Thread ++imanshu
7;t remember... > > pyflakes. I use that one Thanks for the replies. Was looking for just these. Thank You, ++imanshu -- http://mail.python.org/mailman/listinfo/python-list

How to Detect Use of Unassigned(Undefined) Variable(Function)

2009-11-27 Thread ++imanshu
Is there a script/module to detect the use of unassigned (undefined) variables(functions) in python. e.g. can I detect the problem on line 3 automatically :- i = 1 if i == 3: print o print i Thank You, ++imanshu -- http://mail.python.org/mailman/listinfo/python-list

Re: _msi.Record object has no attribute 'GetString'

2009-07-27 Thread ++imanshu
On Jul 27, 4:38 pm, "++imanshu" wrote: > The documentation (http://docs.python.org/library/msilib.html#record- > objects) for msilib mentions the GetString() method on Record objects. > However, the following snippet :- > > db = msilib.OpenDatabas

_msi.Record object has no attribute 'GetString'

2009-07-27 Thread ++imanshu
The documentation (http://docs.python.org/library/msilib.html#record- objects) for msilib mentions the GetString() method on Record objects. However, the following snippet :- db = msilib.OpenDatabase(os.path.join(root, file), msilib.MSIDBOPEN_READONLY) view = db.OpenView('SELECT * FROM Property')

Re: why in returns values for array and keys for dictionary

2008-08-26 Thread ++imanshu
On Aug 26, 11:52 am, Erik Max Francis <[EMAIL PROTECTED]> wrote: > ++imanshu wrote: > >     Wouldn't it be nicer to have 'in' return values (or keys) for both > > arrays and dictionaries. Arrays and Dictionaries looked so similar in > > Python until I

why in returns values for array and keys for dictionary

2008-08-25 Thread ++imanshu
Hi, Wouldn't it be nicer to have 'in' return values (or keys) for both arrays and dictionaries. Arrays and Dictionaries looked so similar in Python until I learned this difference. Thanks, ++imanshu -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorted Returns List and Reversed Returns Iterator

2008-08-22 Thread ++imanshu
On Aug 22, 12:36 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > Peter Otten wrote: > > ++imanshu wrote: > >> I agree. Iterator is more flexible. > > I disagree.  Neither is more flexible.  You can iter the list returned > by sorted and list the iter returned by reve

Re: Sorted Returns List and Reversed Returns Iterator

2008-08-21 Thread ++imanshu
On Aug 22, 8:40 am, John Machin <[EMAIL PROTECTED]> wrote: > On Aug 22, 1:35 pm, John Machin <[EMAIL PROTECTED]> wrote: > > > > > On Aug 22, 12:12 pm, "++imanshu" <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > >      Is ther

Sorted Returns List and Reversed Returns Iterator

2008-08-21 Thread ++imanshu
Hi, Is there a reason why two similarly named functions Sorted and Reversed return different types of data or is it an accident. Thanks, ++imanshu -- http://mail.python.org/mailman/listinfo/python-list