Re: [Python-ideas] Make fnmatch.filter accept a tuple of patterns

2018-11-03 Thread Steven D'Aprano
On Sat, Nov 03, 2018 at 02:49:00AM +0900, Stephen J. Turnbull wrote: > If you're going to improve the glob module, why not use bash or zsh > extended globbing ('**', '{a,b}') as the model? This is more > powerful, and already familiar to many users. I thought it did support extended globbing?

Re: [Python-ideas] Are we supposed to be able to have our own class dictionary in python 3?

2018-11-03 Thread Amit Green
Thanks Daniel, I found my answer here (using your link): https://docs.python.org/3/reference/datamodel.html#preparing-the-class-namespace """ When a new class is created by type.__new__, the object provided as the namespace parameter is copied to a new ordered mapping and the original object is

Re: [Python-ideas] Are we supposed to be able to have our own class dictionary in python 3?

2018-11-03 Thread Daniel Moisset
Sorry, should have replied to the list too On Sat, 3 Nov 2018, 23:55 Daniel Moisset If I understood correctly what you want, it's possible with a metaclass. > Check the __prepare__ method at > https://docs.python.org/3/reference/datamodel.html#preparing-the-class-namespace > and Pep 3115 > > On

Re: [Python-ideas] Serialization of CSV vs. JSON

2018-11-03 Thread Greg Ewing
David Shawley wrote: I'm +1 on adding support for serializing datetime.date and datetime.datetime *but* I'm -1 on automatically deserializing anything that looks like a ISO-8601 in json.load*. The asymmetry is the only thing that kept me from bringing this up previously. This asymmetry

[Python-ideas] Are we supposed to be able to have our own class dictionary in python 3?

2018-11-03 Thread Joy Diamond
Team, Are we supposed to be able to have our own class dictionary in python 3? If we currently cannot -- do we want to be able to? That we can have out own class dictionary in python 3 is strongly implied in the following at https://www.python.org/dev/peps/pep-3115/ where it says: """ #

Re: [Python-ideas] Make fnmatch.filter accept a tuple of patterns

2018-11-03 Thread David Mertz
On Sat, Nov 3, 2018 at 3:03 PM MRAB wrote: > > Yes, that is a horrible spelling for: > > > > {fnmatch.filter(names, p) for p in patterns} > > But it has the advantage that it works. :-) > Indeed! Excellent point :-). I definitely should not post untested code from my tablet. This is

Re: [Python-ideas] Serialization of CSV vs. JSON

2018-11-03 Thread Chris Angelico
On Sun, Nov 4, 2018 at 1:00 AM David Shawley wrote: > Very good point. The JSON document type only supports object literals, > numbers, strings, and Boolean literals. My suggestion was specifically to > provide an extensible mechanism for encoding arbitrary objects into the > supported

Re: [Python-ideas] Make fnmatch.filter accept a tuple of patterns

2018-11-03 Thread Chris Angelico
On Sun, Nov 4, 2018 at 4:29 AM Stephen J. Turnbull wrote: > > Chris Angelico writes: > > On Sat, Nov 3, 2018 at 4:49 AM Stephen J. Turnbull > > wrote: > > > Andre Delfino writes: > > > > > Frequently, while globbing, one needs to work with multiple > > > > extensions. I’d like to propose

Re: [Python-ideas] Make fnmatch.filter accept a tuple of patterns

2018-11-03 Thread MRAB
On 2018-11-03 17:45, David Mertz wrote: On Sat, Nov 3, 2018, 1:30 PM Stephen J. Turnbull wrote: P.S.   I can't resist.  This is horrible, but: def multifilter(names, *patterns):     return list(set().union(*[fnmatch.filter(names, p)

Re: [Python-ideas] Make fnmatch.filter accept a tuple of patterns

2018-11-03 Thread David Mertz
On Sat, Nov 3, 2018, 1:30 PM Stephen J. Turnbull < turnbull.stephen...@u.tsukuba.ac.jp wrote: > P.S. I can't resist. This is horrible, but: > > def multifilter(names, *patterns): > return list(set().union(*[fnmatch.filter(names, p) for p in patterns])) > Yes, that is a horrible spelling

Re: [Python-ideas] Make fnmatch.filter accept a tuple of patterns

2018-11-03 Thread Stephen J. Turnbull
Chris Angelico writes: > On Sat, Nov 3, 2018 at 4:49 AM Stephen J. Turnbull > wrote: > > Andre Delfino writes: > > > Frequently, while globbing, one needs to work with multiple > > > extensions. I’d like to propose for fnmatch.filter to handle a > > > tuple of patterns (while preserving

Re: [Python-ideas] Serialization of CSV vs. JSON

2018-11-03 Thread Wes Turner
jsondate, for example, supports both .load[s]() and .dump[s](); but only for UTC datetimes https://github.com/rconradharris/jsondate/blob/master/jsondate/__init__.py UTC is only sometimes a fair assumption; otherwise it's dangerous to assume that timezone-naieve [ISO8601] strings represent UTC-0

Re: [Python-ideas] Serialization of CSV vs. JSON

2018-11-03 Thread David Shawley
On Nov 3, 2018, at 9:29 AM, Chris Angelico wrote: > > I think we need to clarify an important distinction here. JSON, as a > format, does *not* support date/time objects in any way. But > JavaScript's JSON.stringify() function is happy to accept them, and > will represent them as strings. >

Re: [Python-ideas] Serialization of CSV vs. JSON

2018-11-03 Thread Serhiy Storchaka
02.11.18 19:26, Chris Barker via Python-ideas пише: On Fri, Nov 2, 2018 at 9:31 AM, M.-A. Lemburg > wrote: Serialization of those data types is not defined in the JSON standard: https://www.json.org/ That being said, ISO 8601 is a standard for datetime

Re: [Python-ideas] Serialization of CSV vs. JSON

2018-11-03 Thread Chris Angelico
On Sun, Nov 4, 2018 at 12:02 AM David Shawley wrote: > > On Nov 2, 2018, at 12:28 PM, Calvin Spealman wrote: > > > Second, JSON is a specific serialization format that explicitly rejects > > datetime objects in *all* the languages with JSON libraries. You can only > > use date objects in JSON if

Re: [Python-ideas] Serialization of CSV vs. JSON

2018-11-03 Thread David Shawley
On Nov 2, 2018, at 12:28 PM, Calvin Spealman wrote: > Second, JSON is a specific serialization format that explicitly rejects > datetime objects in *all* the languages with JSON libraries. You can only > use date objects in JSON if you control or understand both serialization > and