[Python-ideas] Argparse argument deprecation

2017-08-09 Thread Tarek Ziadé
Hey, I don't think there's any helper to deprecate an argument in argparse Let's say you have a --foo option in your CLI and want to deprecate it in the next release before you completely remove it later. My first though on how to do this by adding a new "deprecated" option to https://docs.pytho

Re: [Python-ideas] Generator syntax hooks?

2017-08-09 Thread Stephen J. Turnbull
Nick Coghlan writes: > Right now, getting the "terminate when false" behaviour requires the > use of takewhile: > > {itertools.takewhile(lambda x: x < 100, itertools.count(1000)} My objection to this interpretation is different from Guido's (I think): if you're really thinking in ter

Re: [Python-ideas] Pseudo methods

2017-08-09 Thread Stephen J. Turnbull
Nick Coghlan writes: > To analyse and investigate this code, we need to "just know" that: You can of course hope that help(input().has_vowels) will tell you where to find it. If it doesn't, well, shame on you for depending on source-unavailable software that you don't understand. ;-) I'm with

Re: [Python-ideas] Argparse argument deprecation

2017-08-09 Thread Michel Desmoulin
+1, but I would make "deprecated" either a warning, an exception or a callable. This way to create a simple deprecation, you just provide DeprecationWarning('This will be gone in the next release'), or ValueError('This has been removed in 2.X, use "stuff instead"') if you decide it's gone for good

Re: [Python-ideas] Argparse argument deprecation

2017-08-09 Thread Ned Batchelder
On 8/9/17 3:56 AM, Tarek Ziadé wrote: > Hey, > > I don't think there's any helper to deprecate an argument in argparse > > Let's say you have a --foo option in your CLI and want to deprecate it > in the next release before you completely remove it later. > > My first though on how to do this by add

Re: [Python-ideas] Argparse argument deprecation

2017-08-09 Thread Michel Desmoulin
Argparse is not just about parsing, it's about providing convenient tooling associated with parsing. Otherwise you would not have automatically generated a "usage" message or a "--help" command. Following your definition, those are not parsing. But there are here, because we all end up coding the

Re: [Python-ideas] Argparse argument deprecation

2017-08-09 Thread Ned Batchelder
OK, then on a more pragmatic note: why is it easier to write a callback than to write a simple if statement after the parsing? Generating help is complex, and a common task that is closely tied to the syntax of the options, so it makes sense for argparse to do it. Deprecation is neither complex,

Re: [Python-ideas] Argparse argument deprecation

2017-08-09 Thread Michel Desmoulin
Le 09/08/2017 à 12:59, Ned Batchelder a écrit : > OK, then on a more pragmatic note: why is it easier to write a callback > than to write a simple if statement after the parsing? Generating help > is complex, and a common task that is closely tied to the syntax of the > options, so it makes sens

Re: [Python-ideas] Argparse argument deprecation

2017-08-09 Thread Tarek Ziadé
> Another note about the proposal: calling it "deprecated" seems odd, > since the proposal is really just a general-purpose callback. argparse > isn't generating the warning, your callback function would be doing it. > Why name it "deprecated"? How is this different than the "action" > keyword

Re: [Python-ideas] Generator syntax hooks?

2017-08-09 Thread Nick Coghlan
On 9 August 2017 at 15:38, Guido van Rossum wrote: > On Tue, Aug 8, 2017 at 10:06 PM, Nick Coghlan wrote: >> The OP's proposal doesn't fit into that category though: rather it's >> asking about the case where we have an infinite iterator (e.g. >> itertools.count(0)), and want to drop items until

Re: [Python-ideas] Generator syntax hooks?

2017-08-09 Thread Soni L.
On 2017-08-09 11:54 AM, Nick Coghlan wrote: On 9 August 2017 at 15:38, Guido van Rossum wrote: On Tue, Aug 8, 2017 at 10:06 PM, Nick Coghlan wrote: The OP's proposal doesn't fit into that category though: rather it's asking about the case where we have an infinite iterator (e.g. itertools.c

[Python-ideas] Mimetypes Include application/json

2017-08-09 Thread Nate.
Hi, A friend and I have hit a funny situation with the `mimetypes.py` library guessing the type for a '.json' file. Is there a reason why '.json' hasn't been added to the mapping? Without `mailcap` installed: [root@de169da8cc46 /]# python3 -m mimetypes build.json I don't know anything about type

Re: [Python-ideas] Mimetypes Include application/json

2017-08-09 Thread Brett Cannon
On Wed, 9 Aug 2017 at 10:43 Nate. wrote: > Hi, > > A friend and I have hit a funny situation with the `mimetypes.py` library > guessing the type for a '.json' file. Is there a reason why '.json' hasn't > been > added to the mapping? > Probably no one thought about it since the module was added i

Re: [Python-ideas] Mimetypes Include application/json

2017-08-09 Thread Serhiy Storchaka
09.08.17 21:17, Brett Cannon пише: On Wed, 9 Aug 2017 at 10:43 Nate. > wrote: A friend and I have hit a funny situation with the `mimetypes.py` library guessing the type for a '.json' file. Is there a reason why '.json' hasn't been added to the mapp

Re: [Python-ideas] Mimetypes Include application/json

2017-08-09 Thread Oleg Broytman
On Wed, Aug 09, 2017 at 05:42:18PM +, "Nate." wrote: > A friend and I have hit a funny situation with the `mimetypes.py` library > guessing the type for a '.json' file. Is there a reason why '.json' hasn't > been > added to the mapping? My guess is that nobody uses mimetypes without mailca

Re: [Python-ideas] Mimetypes Include application/json

2017-08-09 Thread Nate.
O, fun! Thank you for the guidance. I managed to find a Bug already created, http://bugs.python.org/issue30824. I'll create a Pull Request using that Bug. On Wed, Aug 9, 2017 at 1:18 PM Brett Cannon wrote: > On Wed, 9 Aug 2017 at 10:43 Nate. wrote: > >> Hi, >> >> A friend and I have hit a funny

Re: [Python-ideas] Generator syntax hooks?

2017-08-09 Thread Chris Barker
On Tue, Aug 8, 2017 at 10:06 PM, Nick Coghlan wrote: > On 8 August 2017 at 09:06, Chris Barker wrote: > > It would be nice to have an easier access to an "slice iterator" though > -- > > one of these days I may write up a proposal for that. > > An idea I've occasionally toyed with [1] is some ki

Re: [Python-ideas] Generator syntax hooks?

2017-08-09 Thread Terry Reedy
On 8/9/2017 10:54 AM, Nick Coghlan wrote: On 9 August 2017 at 15:38, Guido van Rossum wrote: On Tue, Aug 8, 2017 at 10:06 PM, Nick Coghlan wrote: The OP's proposal doesn't fit into that category though: rather it's asking about the case where we have an infinite iterator (e.g. itertools.count

Re: [Python-ideas] Pseudo methods

2017-08-09 Thread Nick Coghlan
On 9 August 2017 at 18:19, Stephen J. Turnbull wrote: > Nick Coghlan writes: > > > To analyse and investigate this code, we need to "just know" that: > > You can of course hope that help(input().has_vowels) will tell you > where to find it. If it doesn't, well, shame on you for depending on > so

Re: [Python-ideas] Mimetypes Include application/json

2017-08-09 Thread Nick Coghlan
On 10 August 2017 at 04:24, Serhiy Storchaka wrote: > 09.08.17 21:17, Brett Cannon пише: >> >> On Wed, 9 Aug 2017 at 10:43 Nate. > > wrote: >> A friend and I have hit a funny situation with the `mimetypes.py` >> library >> guessing the type for a '.json' file

Re: [Python-ideas] Generator syntax hooks?

2017-08-09 Thread Nick Coghlan
On 10 August 2017 at 00:54, Nick Coghlan wrote: > Yeah, if we ever did add something like this, I suspect a translation > using takewhile would potentially be easier for at least some users to > understand than the one to a break condition: > > {x for x in itertools.count(0) if 1000 <= x while

[Python-ideas] PyPI JSON Metadata Standardization for Mirrors

2017-08-09 Thread Cooper Ry Lees
Hi all, First time emailer, so please be kind. Also, if this is not the right mailing list for PyPA talk, I apologize. Please point me in the right direction if so. The main reason I have emailed here is I believe it may be PEP time to standardize the JSON metadata that PyPI makes available, like

Re: [Python-ideas] Generator syntax hooks?

2017-08-09 Thread Nick Coghlan
On 10 August 2017 at 01:49, Soni L. wrote: > On 2017-08-09 11:54 AM, Nick Coghlan wrote: >> Right, I was separating the original request to make "{x for x in >> integers if 1000 <= x < 100}" work into the concrete proposal to >> make exactly *that* syntax work (which I don't think is feasible)