Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #21650
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <cameron@cskk.homeip.net> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'received:edu.au': 0.07; 'indicates': 0.09; 'am,': 0.12; 'argparse': 0.16; 'finney': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'intuition': 0.16; 'kern': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'received:202.125.174': 0.16; 'received:202.125.174.133': 0.16; 'received:boardofstudies.nsw.edu.au': 0.16; 'received:cskk.homeip.net': 0.16; 'received:harvey.boardofstudies.nsw.edu.au': 0.16; 'received:homeip.net': 0.16; 'received:nsw.edu.au': 0.16; 'roy': 0.16; 'subject:argparse': 0.16; 'to:addr:robert.kern': 0.16; 'to:name:robert kern': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.18; 'that?': 0.18; 'seems': 0.20; 'cc:no real name:2**0': 0.21; 'so.': 0.22; "doesn't": 0.22; 'header:In-Reply- To:1': 0.22; 'string': 0.24; 'writes:': 0.25; 'cc:2**0': 0.26; 'function': 0.27; 'value.': 0.28; "i'm": 0.28; 'cc:addr:python.org': 0.29; 'admit': 0.30; 'none,': 0.30; 'object.': 0.30; 'yes.': 0.30; 'that,': 0.32; 'header:User- Agent:1': 0.33; 'too': 0.33; 'object': 0.33; 'match': 0.34; 'then.': 0.34; 'problem.': 0.35; 'probably': 0.35; 'received:au': 0.36; 'but': 0.37; "i'll": 0.38; 'cases,': 0.38; 'could': 0.38; 'doing': 0.38; 'useful': 0.38; 'should': 0.38; 'subject:from': 0.39; 'called': 0.40; 'change': 0.40; 'type': 0.61; 'simple': 0.61; 'your': 0.61; 'attorney': 0.64; 'received:202': 0.66; 'special': 0.66; 'money.': 0.67; 'designed': 0.69; 'inform': 0.70; 'cameron': 0.77; 'attorney,': 0.84; 'hunter': 0.84 |
| Date | Thu, 15 Mar 2012 21:35:03 +1100 |
| From | Cameron Simpson <cs@zip.com.au> |
| To | Robert Kern <robert.kern@gmail.com> |
| Subject | Re: Enchancement suggestion for argparse: intuit type from default |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Disposition | inline |
| Content-Transfer-Encoding | 8bit |
| In-Reply-To | <jjsevn$nsn$1@dough.gmane.org> |
| User-Agent | Mutt/1.5.21 (2010-09-15) |
| References | <jjsevn$nsn$1@dough.gmane.org> |
| Cc | python-list@python.org |
| 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.666.1331807597.3037.python-list@python.org> (permalink) |
| Lines | 31 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1331807597 news.xs4all.nl 6912 [2001:888:2000:d::a6]:49167 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:21650 |
Show key headers only | View raw
On 15Mar2012 10:06, Robert Kern <robert.kern@gmail.com> wrote:
| On 3/15/12 5:59 AM, Cameron Simpson wrote:
| > On 15Mar2012 12:22, Ben Finney<ben+python@benfinney.id.au> wrote:
| > | Roy Smith<roy@panix.com> writes:
| > |> I'll admit I hadn't considered that, but I don't see it as a major
| > |> problem. The type intuition could be designed to only work for types
| > |> other than NoneType.
| > |
| > | −1, then. It's growing too many special cases, and is no longer simple
| > | to describe, so that indicates it's probably a bad idea.
| >
| > If `type` is not supplied and `default` is present and not None, `type`
| > shall be the type of `default`.
| >
| > That seems straightforward to me. [... sentinels aside...] the `type`
| > should always match type(default). Or am I wrong about that?
|
| Yes. Not all type(default) types can be called with a string to produce a valid
| value. Note that "type=" is really a misnomer. argparse doesn't really want a
| type object there; it wants a converter function that takes a string to an object.
Aha. Still, you could change the docs to say you only need type= if
type(default) _isn't_ useful as the string->value converter.
--
Cameron Simpson <cs@zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/
As your attorney, it is my duty to inform you that it is not important that
you understand what I'm doing or why you're paying me so much money. What's
important is that you continue to do so.
- Hunter S. Thompson's Samoan Attorney
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Enchancement suggestion for argparse: intuit type from default Cameron Simpson <cs@zip.com.au> - 2012-03-15 21:35 +1100
csiph-web