Thank you quite easy, was trying to work around it in the generator, the print
needs to be outside the generator to avoid the collection of "None".
Wasn't really liking comprehensions though python 3 dict comprehensions are a
really nice utility.
Sayth
--
https://mail.python.org/mailman/listi
On Tue, Oct 18, 2016 at 11:57 PM, Jon Ribbens wrote:
> I must admit I find the idea of enumerate(range(n)) quite pleasing.
> gotta keep track of which numbers those numbers are!
Heh! I'm assuming that's a placeholder for
enumerate(some_other_iterable), where the actual iterable in question
isn't
On 2016-10-18, Steve D'Aprano wrote:
> On Tue, 18 Oct 2016 10:43 pm, Sayth Renshaw wrote:
>> I was solving a problem to create a generator comprehension with 'Got '
>> and a number for each in range 10.
>>
>> This I did however I also get a list of None. I don't understand where
>> none comes fro
On Tue, 18 Oct 2016 10:43 pm, Sayth Renshaw wrote:
> I was solving a problem to create a generator comprehension with 'Got '
> and a number for each in range 10.
>
> This I did however I also get a list of None. I don't understand where
> none comes from. Can you please clarify?
You get None bec
Sayth Renshaw writes:
> This I did however I also get a list of None. I don't understand where
> none comes from. Can you please clarify?
Every function in Python, if it returns, returns a value.
In an expression that consists of only a function call, the expression
resolves to the return value
On Oct 18, 2016 7:45 AM, "Sayth Renshaw" wrote:
>
> I was solving a problem to create a generator comprehension with 'Got '
and a number for each in range 10.
>
> This I did however I also get a list of None. I don't understand where
none comes from. Can you please clarify?
>
> a = (print("Got {0}
On Tue, Oct 18, 2016 at 10:43 PM, Sayth Renshaw wrote:
> I was solving a problem to create a generator comprehension with 'Got ' and a
> number for each in range 10.
>
> This I did however I also get a list of None. I don't understand where none
> comes from. Can you please clarify?
>
> a = (pri
I was solving a problem to create a generator comprehension with 'Got ' and a
number for each in range 10.
This I did however I also get a list of None. I don't understand where none
comes from. Can you please clarify?
a = (print("Got {0}".format(num[0])) for num in enumerate(range(10)))
# for