Thank you Kracekumar.
http://docs.python-guide.org/en/latest/writing/gotchas/#what-you-wrote"Python’s
default arguments are evaluated once when the function is defined,not each time
the function is called." Thank you,
Bhargav.
On Friday, October 3, 2014 9:18 PM, kracekumar ramaraju
wro
On Fri, Oct 3, 2014 at 9:04 PM, Bhargav Kowshik <
bhargav.kows...@yahoo.com.dmarc.invalid> wrote:
> Nice! Thank you very much Anand.But, I still don't know what is
> happening.Please point me to a resource to understand what is happening.
>
>
A common beginner mistake. More of such gotcha can be f
Nice! Thank you very much Anand.But, I still don't know what is
happening.Please point me to a resource to understand what is happening.
** Program **
def flat_it(values, result=list()):
for v in values:
if isinstance(v, list):
flat_it(v, result)
else:
On Fri, Oct 3, 2014 at 8:26 PM, Bhargav Kowshik <
bhargav.kows...@yahoo.com.dmarc.invalid> wrote:
> We could use what Anand talked about at Pycon India about handling the
> headers in first row of a CSV.In this scenario, instead of default for
> result being None and checking if None everytime, we
We could use what Anand talked about at Pycon India about handling the headers
in first row of a CSV.In this scenario, instead of default for result being
None and checking if None everytime, we could have the default value an empty
list.
def flat_it(values, result=list()):
for v in values:
On Thu, Oct 2, 2014 at 6:34 PM, Abhishek L wrote:
> On Thu, Oct 2, 2014 at 5:15 PM, kracekumar ramaraju
> wrote:
> > Hi
> >
> > `yield from ` is introduced in Python 3.3 as part of pep 380.
> >
> > # python 3.3
> >
> > from collections import Iterable
> >
> > def flatten(items):
> > for item
On Thu, Oct 2, 2014 at 5:15 PM, kracekumar ramaraju
wrote:
> Hi
>
> `yield from ` is introduced in Python 3.3 as part of pep 380.
>
> # python 3.3
>
> from collections import Iterable
>
> def flatten(items):
> for item in items:
> if isinstance(item, Iterable):
> yield from
Hi
`yield from ` is introduced in Python 3.3 as part of pep 380.
# python 3.3
from collections import Iterable
def flatten(items):
for item in items:
if isinstance(item, Iterable):
yield from flatten(item)
else:
yield item
list(flatten([[1, 2, [3]],
On Thu, Oct 2, 2014 at 3:51 PM, Rajiv Subramanian M
wrote:
> Hello Group,
>
> I'm Rajiv working as web developer in bangalore.
>
> Objective:
> We need to convert the list containing integers and nested list of integer
> in it
> e.g.) x = [[1, 2, [3]], 4]
> into a flat list format
> e.g.) result