Re: [Python-ideas] pathlib.Path should handle Pythonpath or package root

2017-07-18 Thread Nick Coghlan
On 19 July 2017 at 06:40, George Fischhof wrote: > I think yes ;-) > I would like to use (or I think it would be good to use) something like > pathlib.Path(package_root) > so I could use > > importlib.import_module(pathlib.Path(package_root) / plugins / plugin_name) No, as

[Python-ideas] between block and function [was: Custom Code Folding: Standardized Rules and Syntax?]

2017-07-18 Thread Jim J. Jewett
There have been times when I wanted to group portions of a module, class, or function. Giving names to each of those groupings would be useful, and would be appropriate for python-level changes. That said, it would probably need more proof in the wild first, so the first step would be getting

Re: [Python-ideas] Alternative Unicode implementations (NSString/NSMutableString)

2017-07-18 Thread Victor Stinner
Supporting a new kind of string storage would require a lot of efforts. There are a lot of C code specialized for each Unicode kind Victor Le 19 juil. 2017 12:43 AM, "Jim J. Jewett" a écrit : > Ronald Oussoren came up with a concrete use case for wanting the > interpreter

Re: [Python-ideas] a new namedtuple

2017-07-18 Thread Guido van Rossum
On Tue, Jul 18, 2017 at 3:18 PM, Greg Ewing wrote: > Ethan Furman wrote: > >> I certainly don't expect the signature to change, but why is using a >> metaclass out? The use (or not) of a metaclass /is/ an implementation >> detail. >> > > For me, the main benefit of

Re: [Python-ideas] namedtuple with ordereddict

2017-07-18 Thread Greg Ewing
Jim J. Jewett wrote: is there any reason not to simply define it as a view on a dict, or at least as a limited proxy to one? Some valuable characteristics of namedtuples as they are now: * Instances are very lightweight * Access by index is fast * Can be used as a dict key All of those would

Re: [Python-ideas] Enabling Event.set to notify all waiters with an exception

2017-07-18 Thread Nathaniel Smith
On Tue, Jul 18, 2017 at 2:33 PM, Pau Freixes wrote: > Morning guys, (Not everyone here is a guy.) > I came across with that idea trying to resolve a typical dogpile > pattern [1], having many DNS calls to the same domain because of a > miss in a DNS cache. > > The usage of

Re: [Python-ideas] a new namedtuple

2017-07-18 Thread Ethan Furman
On 07/18/2017 09:09 AM, Guido van Rossum wrote: On Tue, Jul 18, 2017 at 8:56 AM, Ethan Furman wrote: I certainly don't expect the signature to change, but why is using a metaclass out? The use (or not) of a metaclass /is/ an implementation detail. It is until you try to subclass with

[Python-ideas] Enabling Event.set to notify all waiters with an exception

2017-07-18 Thread Pau Freixes
Morning guys, I came across with that idea trying to resolve a typical dogpile pattern [1], having many DNS calls to the same domain because of a miss in a DNS cache. The usage of the the set either to notify that the waiters could be awake and get the result from the cache or use it to notify

Re: [Python-ideas] a new namedtuple

2017-07-18 Thread Joao S. O. Bueno
In the other thread, I had mentioned my "extradict" implementation - it does have quite a few differences as it did not try to match namedtuple API, but it works nicely for all common use cases - these are the timeit timings: (env) [gwidion@caylus ]$ python3 -m timeit --setup "from collections

Re: [Python-ideas] a new namedtuple

2017-07-18 Thread Guido van Rossum
On Tue, Jul 18, 2017 at 8:56 AM, Ethan Furman wrote: > I certainly don't expect the signature to change, but why is using a > metaclass out? The use (or not) of a metaclass /is/ an implementation > detail. > It is until you try to subclass with another metaclass -- then you

Re: [Python-ideas] a new namedtuple

2017-07-18 Thread Ethan Furman
On 07/17/2017 06:25 PM, Eric Snow wrote: On Mon, Jul 17, 2017 at 6:01 PM, Ethan Furman wrote: Guido has decreed that namedtuple shall be reimplemented with speed in mind. FWIW, I'm sure that any changes to namedtuple will be kept as minimal as possible. Changes would be limited to the

Re: [Python-ideas] pathlib.Path should handle Pythonpath or package root

2017-07-18 Thread Nick Coghlan
On 18 July 2017 at 22:08, George Fischhof wrote: > Hi there, > > I created a program which uses plugins (import them). I started to test it, > and found that I need two types of paths: one for file system and another > one which is package relative. > > So I thing this is a

Re: [Python-ideas] a new namedtuple

2017-07-18 Thread Nick Coghlan
On 18 July 2017 at 14:31, Guido van Rossum wrote: > On Mon, Jul 17, 2017 at 6:25 PM, Eric Snow > wrote: >> >> On Mon, Jul 17, 2017 at 6:01 PM, Ethan Furman wrote: >> > Guido has decreed that namedtuple shall be reimplemented

Re: [Python-ideas] tempfile.TemporaryDirectory() should be able to create temporary directory at a given arbitrary place

2017-07-18 Thread Steven D'Aprano
On Tue, Jul 18, 2017 at 01:55:15PM +0200, George Fischhof wrote: > Hi there, > > I used tempfile.TemporaryDirectory(). On first usage it was good, but on > second one there was a need to create tempopray directory and files in it a > given place. (It needed for a test). > > And I found that

Re: [Python-ideas] tempfile.TemporaryDirectory() should be able to create temporary directory at a given arbitrary place

2017-07-18 Thread George Fischhof
2017-07-18 14:06 GMT+02:00 Serhiy Storchaka : > 18.07.17 14:55, George Fischhof пише: > >> I used tempfile.TemporaryDirectory(). On first usage it was good, but on >> second one there was a need to create tempopray directory and files in it a >> given place. (It needed for a

[Python-ideas] pathlib.Path should handle Pythonpath or package root

2017-07-18 Thread George Fischhof
Hi there, I created a program which uses plugins (import them). I started to test it, and found that I need two types of paths: one for file system and another one which is package relative. So I thing this is a good idea, to enhance pathlib to handle package roots. (I know about sys.path,

Re: [Python-ideas] tempfile.TemporaryDirectory() should be able to create temporary directory at a given arbitrary place

2017-07-18 Thread Serhiy Storchaka
18.07.17 14:55, George Fischhof пише: I used tempfile.TemporaryDirectory(). On first usage it was good, but on second one there was a need to create tempopray directory and files in it a given place. (It needed for a test). And I found that TemporaryDirectory() is not able to do this. So my

[Python-ideas] tempfile.TemporaryDirectory() should be able to create temporary directory at a given arbitrary place

2017-07-18 Thread George Fischhof
Hi there, I used tempfile.TemporaryDirectory(). On first usage it was good, but on second one there was a need to create tempopray directory and files in it a given place. (It needed for a test). And I found that TemporaryDirectory() is not able to do this. So my idea is to implement this