Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #30393
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.015 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:howto': 0.09; 'nesting': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'xrange': 0.16; 'drawing': 0.17; 'fairly': 0.21; 'header:User- Agent:1': 0.26; 'looks': 0.26; 'candidate': 0.26; '(e.g.,': 0.27; 'header:X-Complaints-To:1': 0.28; "i'm": 0.29; 'maybe': 0.29; 'basic': 0.30; 'code': 0.31; 'like:': 0.33; 'to:addr:python-list': 0.33; 'add': 0.36; 'received:org': 0.36; 'but': 0.36; 'should': 0.36; 'level': 0.37; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'range': 0.60; 'sounds': 0.71; 'received:139': 0.84; 'subject:handle': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Neal Becker <ndbecker2@gmail.com> |
| Subject | howto handle nested for |
| Date | Fri, 28 Sep 2012 10:39:32 -0400 |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="ISO-8859-1" |
| Content-Transfer-Encoding | 7Bit |
| X-Gmane-NNTP-Posting-Host | 139.85.237.139 |
| User-Agent | KNode/4.9.1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1555.1348843184.27098.python-list@python.org> (permalink) |
| Lines | 17 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1348843184 news.xs4all.nl 6895 [2001:888:2000:d::a6]:33621 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:30393 |
Show key headers only | View raw
I know this should be a fairly basic question, but I'm drawing a blank.
I have code that looks like:
for s0 in xrange (n_syms):
for s1 in xrange (n_syms):
for s2 in xrange (n_syms):
for s3 in xrange (n_syms):
for s4 in range (n_syms):
for s5 in range (n_syms):
Now I need the level of nesting to vary dynamically. (e.g., maybe I need to add
for s6 in range (n_syms))
Smells like a candidate for recursion. Also sounds like a use for yield. Any
suggestions?
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
howto handle nested for Neal Becker <ndbecker2@gmail.com> - 2012-09-28 10:39 -0400
Re: howto handle nested for Alister <alister.ware@ntlworld.com> - 2012-09-28 14:42 +0000
Re: howto handle nested for Wojtek <decyk@nospam.poczta.fm> - 2012-09-28 16:51 +0200
csiph-web