En Fri, 02 Sep 2011 13:53:37 -0300, Travis Parks
escribió:
On Sep 2, 12:36 pm, "Gabriel Genellina"
wrote:
En Wed, 31 Aug 2011 22:28:09 -0300, Travis Parks
escribi :
> On Aug 31, 7:37 pm, Gregory Ewing wrote:
>> Ian Kelly wrote:
>> > if sys.version_info < (3,):
>> > getDictValues =
On 9/2/2011 12:53 PM, Travis Parks wrote:
On Sep 2, 12:36 pm, "Gabriel Genellina"
Those if/else are at global scope. An 'if' statement does not introduce a
new scope; so getDictValues, despite being "indented", is defined at
global scope, and may be used anywhere in the module.
Does that me
On Sep 2, 12:36 pm, "Gabriel Genellina"
wrote:
> En Wed, 31 Aug 2011 22:28:09 -0300, Travis Parks
> escribi :
>
> > On Aug 31, 7:37 pm, Gregory Ewing wrote:
> >> Ian Kelly wrote:
> >> > if sys.version_info < (3,):
> >> > getDictValues = dict.itervalues
> >> > else:
> >> > getDictValues
En Wed, 31 Aug 2011 22:28:09 -0300, Travis Parks
escribió:
On Aug 31, 7:37 pm, Gregory Ewing wrote:
Ian Kelly wrote:
> if sys.version_info < (3,):
> getDictValues = dict.itervalues
> else:
> getDictValues = dict.values
> (which is basically what the OP was doing in the first place)
On Aug 31, 7:37 pm, Gregory Ewing wrote:
> Ian Kelly wrote:
> > if sys.version_info < (3,):
> > getDictValues = dict.itervalues
> > else:
> > getDictValues = dict.values
>
> > (which is basically what the OP was doing in the first place).
>
> And which he seemed to think didn't work for so
Ian Kelly wrote:
if sys.version_info < (3,):
getDictValues = dict.itervalues
else:
getDictValues = dict.values
(which is basically what the OP was doing in the first place).
And which he seemed to think didn't work for some
reason, but it seems fine as far as I can tell:
Python 2.7 (
On Wed, Aug 31, 2011 at 3:55 AM, Martin v. Loewis wrote:
> if sys.version_info < (3,):
> def getDictValues(dict):
> return dict.itervalues()
> else:
> def getDictValues(dict):
> return dict.values()
The extra level of function call indirection is unnecessary here.
Better to write it a
Am 31.08.2011 03:43, schrieb Travis Parks:
> I am writing a simple algorithms library that I want to work for both
> Python 2.7 and 3.x. I am writing some functions like distinct, which
> work with dictionaries under the hood. The problem I ran into is that
> I am calling itervalues or values depen
On 8/30/2011 9:43 PM, Travis Parks wrote:
I am writing a simple algorithms library that I want to work for both
Python 2.7 and 3.x. I am writing some functions like distinct, which
work with dictionaries under the hood. The problem I ran into is that
I am calling itervalues or values depending on