Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #10821
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <missive@hotmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'defaults': 0.07; 'none:': 0.09; 'subject:parameters': 0.09; 'subject:parsing': 0.09; 'subject:function': 0.16; '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0': 0.16; 'def': 0.16; 'to:addr:python-list': 0.34; '\xa0\xa0\xa0': 0.34; 'none': 0.35; 'subject:: ': 0.38; 'to:addr:python.org': 0.39 |
| X-Originating-IP | [70.101.97.52] |
| From | Lee Harr <missive@hotmail.com> |
| To | <python-list@python.org> |
| Subject | RE: parsing function parameters |
| Date | Wed, 3 Aug 2011 23:03:21 +0430 |
| Importance | Normal |
| Content-Type | text/plain; charset="windows-1256" |
| Content-Transfer-Encoding | 8bit |
| MIME-Version | 1.0 |
| X-OriginalArrivalTime | 03 Aug 2011 18:33:22.0151 (UTC) FILETIME=[D2CA8F70:01CC520B] |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| 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.1859.1312396471.1164.python-list@python.org> (permalink) |
| Lines | 21 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1312396471 news.xs4all.nl 23845 [2001:888:2000:d::a6]:32771 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:10821 |
Show key headers only | View raw
Needed to make one change... for functions with no default args:
def pdict(f):
parameter_defaults = {}
defaults = f.func_defaults
if defaults is not None:
defaultcount = len(defaults)
else:
defaultcount = 0
argcount = f.func_code.co_argcount
for i in xrange(f.func_code.co_argcount):
name = f.func_code.co_varnames[i]
value = None
if i >= argcount - defaultcount:
value = defaults[i - (argcount - defaultcount)]
parameter_defaults[name] = value
return parameter_defaults
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
RE: parsing function parameters Lee Harr <missive@hotmail.com> - 2011-08-03 23:03 +0430
csiph-web