[Python-Dev] Improvements for Pathlib

2014-11-08 Thread Ionel Cristian Mărieș
Hello, In the current incarnation Pathlib is missing some key features I need in my usecases. I want to contribute them but i'd like a bit of feedback on the new api before jumping to implementation. The four things I need are: #1. A context manager for temporary files and dirs (that cleans ever

Re: [Python-Dev] Improvements for Pathlib

2014-11-10 Thread Ionel Cristian Mărieș
On Saturday, November 8, 2014, Xavier Morel wrote: > > > Why would pathlib need to provide this when tempfile already does? > > with tempfile.NamedTemporaryFile(prefix='') as f: > tmp = pathlib.Path(f.name) > > with tempfile.TemporaryDirectoryDirectory(prefix='') as d: > tmp = pat

[Python-Dev] pathlib difference to the backport

2014-11-10 Thread Ionel Cristian Mărieș
Hey, It appears there's a peculiar difference between the pathlib in the 3.4 branch and the one on bitbucket: cpython's pathlib.Path implements a no-op context manager interface. What's the purpose of that? It's also inconsistent, stat and all the methods that depend on stat do not implement the "

Re: [Python-Dev] Improvements for Pathlib

2014-11-10 Thread Ionel Cristian Mărieș
> On 2014-11-08, at 20:02 , Ionel Cristian Mărieș > wrote: > > On Saturday, November 8, 2014, Xavier Morel > wrote: > > > > Why would pathlib need to provide this when tempfile already does? > > > > with tempfile.NamedTemporaryFile(prefix='&

Re: [Python-Dev] pathlib difference to the backport

2014-11-10 Thread Ionel Cristian Mărieș
Speaking of that, shouldn't pathlib have support for dir_fd? Thanks, -- Ionel M. On Mon, Nov 10, 2014 at 6:53 PM, Antoine Pitrou wrote: > On Mon, 10 Nov 2014 13:45:57 +0200 > Ionel Cristian Mărieș wrote: > > Hey, > > > > It appears there's a peculiar differe

Re: [Python-Dev] advice needed: best approach to enabling "metamodules"?

2014-11-29 Thread Ionel Cristian Mărieș
What if we'd have metaclass semantics on module creation? Eg, suppose the default: __metaclass__ = ModuleType What if Python would support __prepare__ for modules? Thanks, -- Ionel M. On Sat, Nov 29, 2014 at 11:36 PM, Greg Ewing wrote: > Guido van Rossum wrote: > >> Are these really all o

Re: [Python-Dev] Overriding stdlib http package

2015-01-14 Thread Ionel Cristian Mărieș
You could do the sys.modules patch as Antoine suggested in a .pth file, so that it's triggered at startup. Eg, very similar: https://github.com/xando/subprocess.run/blob/ab02d165802b2ad57dd0d16c1169ab05ed312ef1/subprocess.run.pth Thanks, -- Ionel Cristian Mărieș, blog.ionelmc.ro On Wed, J

Re: [Python-Dev] subclassing builtin data structures

2015-02-13 Thread Ionel Cristian Mărieș
__(self, value): ... return int.__new__(FancyInt, value) ... ... def __repr__(self): ... return "FancyInt(%s)" % super().__repr__() ... >>> x = FancyInt(1) >>> >>> x FancyInt(1) >>> x += 1 >>> x # it should be FancyInt(2) 2 Thanks, -- Io

Re: [Python-Dev] BDFL ruling request: should we block forever waiting for high-quality random bits?

2016-06-16 Thread Ionel Cristian Mărieș via Python-Dev
THONWEAKURANDOM=y or PYTHONFASTURANDOM=y. That ways there's no need to change api of os.urandom() and users have a clear and easy path to get old behavior. Thanks, -- Ionel Cristian Mărieș, http://blog.ionelmc.ro ___ Python-Dev mailing list Py