[Python-Dev] A cute new way to get an infinite loop (original) (raw)
Raymond Hettinger python at rcn.com
Thu Sep 23 17:33:00 CEST 2004
- Previous message: [Python-Dev] A cute new way to get an infinite loop
- Next message: [Python-Dev] Re: A cute new way to get an infinite loop
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>>> x = [1] >>> x.extend(-y for y in x)
In comparison, the classic form doesn't seem as magical:
x = [1]
for y in x:
x.append(-y)Raymond
- Previous message: [Python-Dev] A cute new way to get an infinite loop
- Next message: [Python-Dev] Re: A cute new way to get an infinite loop
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]