Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #21596
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news.astraweb.com!border5.newsrouter.astraweb.com!not-for-mail |
|---|---|
| From | Ben Finney <ben+python@benfinney.id.au> |
| Newsgroups | comp.lang.python |
| Subject | Re: Enchancement suggestion for argparse: intuit type from default |
| References | <jjocvo$5i2$1@panix2.panix.com> <87zkbkgp67.fsf@benfinney.id.au> <4f6094c5$0$29972$c3e8da3$5496439d@news.astraweb.com> |
| X-Public-Key-ID | 0xAC128405 |
| X-Public-Key-Fingerprint | 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 |
| X-Public-Key-URL | http://www.benfinney.id.au/contact/bfinney-pubkey.asc |
| X-Post-From | Ben Finney <bignose+hates-spam@benfinney.id.au> |
| Date | Thu, 15 Mar 2012 00:19:15 +1100 |
| Message-ID | <87399bgw18.fsf@benfinney.id.au> (permalink) |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
| Cancel-Lock | sha1:Iqiund0pPo3K1EHeiiB69aoaYjg= |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| Lines | 40 |
| Organization | Unlimited download news at news.astraweb.com |
| NNTP-Posting-Host | 502c7a15.news.astraweb.com |
| X-Trace | DXC=6OT7_RZ:IW3o^d=IeQT`3>L?0kYOcDh@:N7:H2`MmAU3S2kSQZD<P_;]G;2>V^?kW3bEW9A[5UK?5NZ[SL`C\Kg3A0QPj3IAX;4 |
| Xref | csiph.com comp.lang.python:21596 |
Show key headers only | View raw
Steven D'Aprano <steve+comp.lang.python@pearwood.info> writes: > On Wed, 14 Mar 2012 08:35:12 +1100, Ben Finney wrote: > > That feels too magical to me. I don't see a need to special-case > > that usage. There's not much burden in being explicit for the > > argument type. > > And yet you are programming in Python instead of Java, Pascal or Ada > :) That's a good point :-) > It's not magic at all, it's science! Or to be precise, it's a very simple > form of type inference Right. I dislike proposals for run-time type inference in Python, since they are too magical. Especially since we're talking about user input (arguments from the command line to the program); that requires more explicit declarations and checking, not less. > What if you want an argument --foo that will accept arbitrary types? Then > you would need some way to tell argparse not to infer the type from the > default. So we would then need to special-case the special-case? Even more reason to dislike this proposal. > Explicit declarations should be used only for the uncommon cases where > type inference cannot cope. That's our point of disagreement, then: I think explicit declarations should be required regarding user input. -- \ “Ridicule is the only weapon which can be used against | `\ unintelligible propositions.” —Thomas Jefferson, 1816-07-30 | _o__) | Ben Finney
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Enchancement suggestion for argparse: intuit type from default roy@panix.com (Roy Smith) - 2012-03-13 17:08 -0400
Re: Enchancement suggestion for argparse: intuit type from default Ben Finney <ben+python@benfinney.id.au> - 2012-03-14 08:35 +1100
Re: Enchancement suggestion for argparse: intuit type from default Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-03-14 12:53 +0000
Re: Enchancement suggestion for argparse: intuit type from default Ben Finney <ben+python@benfinney.id.au> - 2012-03-15 00:19 +1100
Re: Enchancement suggestion for argparse: intuit type from default Roy Smith <roy@panix.com> - 2012-03-14 09:30 -0400
Re: Enchancement suggestion for argparse: intuit type from default MRAB <python@mrabarnett.plus.com> - 2012-03-14 17:26 +0000
Re: Enchancement suggestion for argparse: intuit type from default Ian Kelly <ian.g.kelly@gmail.com> - 2012-03-14 13:03 -0600
Re: Enchancement suggestion for argparse: intuit type from default rusi <rustompmody@gmail.com> - 2012-03-14 03:22 -0700
Re: Enchancement suggestion for argparse: intuit type from default Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-03-14 13:26 +0100
Re: Enchancement suggestion for argparse: intuit type from default John Nagle <nagle@animats.com> - 2012-03-14 16:32 -0700
Re: Enchancement suggestion for argparse: intuit type from default Roy Smith <roy@panix.com> - 2012-03-14 20:52 -0400
Re: Enchancement suggestion for argparse: intuit type from default Ben Finney <ben+python@benfinney.id.au> - 2012-03-15 12:22 +1100
Re: Enchancement suggestion for argparse: intuit type from default Cameron Simpson <cs@zip.com.au> - 2012-03-15 16:59 +1100
Re: Enchancement suggestion for argparse: intuit type from default Robert Kern <robert.kern@gmail.com> - 2012-03-15 10:06 +0000
Re: Enchancement suggestion for argparse: intuit type from default Roy Smith <roy@panix.com> - 2012-03-15 09:28 -0400
Re: Enchancement suggestion for argparse: intuit type from default Cameron Simpson <cs@zip.com.au> - 2012-03-16 08:18 +1100
Re: Enchancement suggestion for argparse: intuit type from default MRAB <python@mrabarnett.plus.com> - 2012-03-15 02:10 +0000
csiph-web