Re: [Tutor] Where to direct non-language questions?

2011-08-12 Thread Alan Gauld
On 12/08/11 21:54, Michael Scharf wrote: where would I go to ask a question like In general start with the most specific source you can find. So if the tool/library has a mailing list or web forum ask there first - or possibly email the author. If there is no such forum try the main Pyth

Re: [Tutor] Where to direct non-language questions?

2011-08-12 Thread Prasad, Ramit
-Original Message- From: tutor-bounces+ramit.prasad=jpmorgan@python.org [mailto:tutor-bounces+ramit.prasad=jpmorgan@python.org] On Behalf Of Michael Scharf Sent: Friday, August 12, 2011 3:54 PM To: tutor@python.org Subject: [Tutor] Where to direct non-language questions? Hi List,

Re: [Tutor] Where to direct non-language questions?

2011-08-12 Thread Michael Scharf
Sent: Friday, August 12, 2011 3:54 PM Hi List, I'm am not quite at the point of needing this, but where would I go to ask a question like "Why is the OpenCalais Python API not returning all fields when I do x or y"  or "Has anyone built their own Python API for OpenCalais"?  Stack Overflow? Or is

[Tutor] Where to direct non-language questions?

2011-08-12 Thread Michael Scharf
Hi List, I'm am not quite at the point of needing this, but where would I go to ask a question like "Why is the OpenCalais Python API not returning all fields when I do x or y" or "Has anyone built their own Python API for OpenCalais"? Stack Overflow? Or is there something Python-specific? Than

Re: [Tutor] Using type

2011-08-12 Thread Emeka
Chris, I was just fooling around and I wanted to do something for myself before going to bed the other night. func myflatten will turn say [ 34 [90] [12] 1] into [34 90 12 1]. Just like its name sounds. Emeka On Fri, Aug 12, 2011 at 7:03 PM, Christopher King wrote: > try: >> it

Re: [Tutor] Using type

2011-08-12 Thread Christopher King
> > try: > iter(item) # test for iterability > if len(item) == 1 and item == item[0]: > gut.append(item) > else: > gut = gut + flatten(item) > > except TypeError: > gut.append(item) > I wouldn't put the what you want to do i

Re: [Tutor] Using type

2011-08-12 Thread Dave Angel
On 08/12/2011 05:31 AM, ALAN GAULD wrote: It'll work on lists and tuples, for simple examples. But beware that when you iterate through strings, the individual characters are also strings, and this function will fail with an error like: RuntimeError: maximum recursion depth exceeded Oh,

Re: [Tutor] Using type

2011-08-12 Thread ALAN GAULD
> It'll work on lists and tuples, for simple examples. But beware that > when you iterate through strings, the individual characters are also > strings, and this function will fail with an error like: >RuntimeError: maximum recursion depth exceeded Oh, good catch Dave. So you'd want to a

Re: [Tutor] Using type

2011-08-12 Thread Dave Angel
On 08/12/2011 03:47 AM, Alan Gauld wrote: On 12/08/11 07:04, Emeka wrote: Hello All, I need help here, type(item) == [].__class__:. What is the idiomatic way of doing it? if type(item) == type([])... or in this case if type(item) == list... But probably preferrable to using type is to use

Re: [Tutor] Using type

2011-08-12 Thread Alan Gauld
On 12/08/11 07:04, Emeka wrote: Hello All, I need help here, type(item) == [].__class__:. What is the idiomatic way of doing it? if type(item) == type([])... or in this case if type(item) == list... But probably preferrable to using type is to use isinstance: if isinstance(item, list)...