Re: De-tupleizing a list

2011-04-25 Thread John Connor
itertools can help you do this too: import itertools tl = [('0A',), ('1B',), ('2C',), ('3D',)] itertools.chain.from_iterable(tl) list(itertools.chain.from_iterable(tl)) ['0A', '1B', '2C', '3D'] Checkout http://docs.python.org/library/itertools.html#itertools.chain for more info. On Mon, Apr

Re: Pythonic infinite for loop?

2011-04-14 Thread John Connor
If I understand your question correctly, what you want is probably something like: i = 0 lst=[] while True: try: lst.append(parse_kwdlist(dct["Keyword%d"%i])) i += 1 except KeyError: break --jac On Thu, Apr 14, 2011 at 9:10 PM, Chris Angelico wrote: > Apologies for interrupting the

Re: Retrieving Python Keywords

2011-04-09 Thread John Connor
Actually this is all it takes: import keywords print keywords.kwlist --jac On Sat, Apr 9, 2011 at 8:57 PM, Chris Angelico wrote: > On Sun, Apr 10, 2011 at 11:28 AM, candide wrote: >> Python is very good at introspection, so I was wondering if Python (2.7) >> provides any feature to retrieve the

Copy-on-write when forking a python process

2011-04-08 Thread John Connor
Hi all, Long time reader, first time poster. I am wondering if anything can be done about the COW (copy-on-write) problem when forking a python process. I have found several discussions of this problem, but I have seen no proposed solutions or workarounds. My understanding of the problem is that