From victor.stinner at gmail.com Sun Sep 1 00:24:30 2013 From: victor.stinner at gmail.com (Victor Stinner) Date: Sun, 1 Sep 2013 00:24:30 +0200 Subject: [Python-Dev] Add a new tracemalloc module to trace memory allocations In-Reply-To: References: Message-ID: Le 31 ao?t 2013 19:09, "Gregory P. Smith" a ?crit : > First, I really like this. +1 Current votes: +3 (i also want tracemalloc!). No opposition against such addition. > We should be consistent with faulthandler's options. Why do you not want to support both the env var and enable()/disable() functions? The reason was technical but I have issues with enabling tracemalloc before Python is fully initialized. Enabling tracemalloc when Python is almost initialized and disabling it before Python exit is more reliable. In the last implementation, enable() and disable() are back. PYTHONTRACEMALLOC is still available. I will also add -X tracemalloc command line. > Users are likely to want snapshots captured by enable()/disable() around particular pieces of code just as much as whole program information. enable()/disable() are useful for tests of the tracemalloc module! > Taking that further: file and line information is great, but what if you extend the concept: could you allow for C API or even Python hooks to gather additional information at the time of each allocation or free? for example: Gathering the actual C and Python stack traces for correlation to figure out what call patterns lead allocations is powerful. There is no portable function to retrieve the C traceback. For the Python traceback: it may be possible to get it but you have to remember that the hook is on PyMem_Malloc(), a low level memory allocator. The GIL is hold. It is possible to call Python code in some cases, but they are corner cases where it would lead to a loop, deadlock or worse. I prefer to only read available Python data without calling any Python code and try to write a reliable debug tool. I still have some issues like issues with reentrant calls to the hook, but I'm working on them. A nice improvement compared to the implementation on PyPI would be to hook PyMem_RawMalloc(), to trace also the memory used by gzip, bz2, lzma and other C modules. Locking the GIL in PyMem_RawMalloc() to get the filename and locking internals tracemalloc structures causes also new issues (like a funny deadlock related to subinterpreter). > (Yes, this gets messy fast as hooks should not trigger calls back into themselves when they allocate or free, similar to the "fun" involved in writing coverage tools) tracemalloc uses a "reentrant" variable to do nothing on a reentrant call to the hook. > let me know if you think i'm crazy. :) You are not crazy. It is just hard to implement it. I'm not sure that it is possible. Victor -------------- next part -------------- An HTML attachment was scrubbed... URL: From ncoghlan at gmail.com Sun Sep 1 03:28:36 2013 From: ncoghlan at gmail.com (Nick Coghlan) Date: Sun, 1 Sep 2013 11:28:36 +1000 Subject: [Python-Dev] Pre-PEP: Redesigning extension modules In-Reply-To: References: <20130823111822.49cba700@pitrou.net> Message-ID: On 1 Sep 2013 05:18, "Stefan Behnel" wrote: > > Nick Coghlan, 31.08.2013 18:49: > > On 25 Aug 2013 21:56, "Stefan Behnel" wrote: > >>>>> One key point to note is that it *doesn't* call > >>>>> _PyImport_FixupExtensionObject, which is the API that handles all the > >>>>> PEP 3121 per-module state stuff. Instead, the idea will be for modules > >>>>> that don't need additional C level state to just implement > >>>>> PyImportExec_NAME, while those that *do* need C level state implement > >>>>> PyImportCreate_NAME and return a custom object (which may or may not > >>>>> be a module subtype). > >>>> > >>>> Is it really a common case for an extension module not to need any C > >>>> level > >>>> state at all? I mean, this might work for very simple accelerator > >>>> modules > >>>> with only a few stand-alone functions. But anything non-trivial will > >>>> almost > >>>> certainly have some kind of global state, cache, external library, > >>>> etc., > >>>> and that state is best stored at the C level for safety reasons. > > > > In my experience, most extension authors aren't writing high performance C > > accelerators, they're exposing an existing C API to Python. It's the cffi > > use case rather than the Cython use case. > > Interesting. I can't really remember a case where I could afford the > runtime overhead of implementing a wrapper in Python and going through > something like ctypes or cffi. I mean, testing C libraries with Python > tools would be one, but then, you wouldn't want to write an extension > module for that and instead want to call it directly from the test code as > directly as possible. > > I'm certainly aware that that use case exists, though, and also the case of > just wanting to get things done as quickly and easily as possible. Keep in mind I first came to Python as a tool for test automation of custom C++ hardware APIs that could be written to be SWIG friendly. I now work for an OS vendor where the 3 common languages for system utilities are C, C++ and Python. For those use cases, dropping a bunch of standard Python objects in a module dict is often going to be a quick and easy solution that avoids a lot of nasty pointer lifecycle issues at the C level. This style of extension code would suffer similar runtime checking overhead as Python, including for function calls, but, like CPython itself, would still often be "fast enough". However, as soon as you want to manually optimise for *speed* at all, you're going to want to remove those module internal indirections through the Python API. There are at least three ways to do this (internally, CPython uses all of them in various places): * type checks followed by direct function calls on the optimised path and falling back to the abstract object APIs on the compatibility path * type checks followed by an exception for unknown types * hidden state that isn't exposed directly at the Python level and hence can be trusted to only be changed through the module APIs. The third approach can be implemented in three ways, with various consequences: * C static variables. For mutable state, including pointers to Python types, this breaks subinterpreters, reloading in place and loading a fresh copy of the module * PEP 3121 per-interpreter shared state. Handles subinterpreters, *may* handle reloading (but may segfault if references are held to old types and functions from before the reload), doesn't handle loading a fresh copy at all. * PEP 3121 with a size of "0". As above, but avoids the module state APIs in order to support reloading. All module state (including type cross-references) is stored in hidden state (e.g. an instance of a custom type not exposed to Python, with a reference stored on each custom type object defined in the module, and any module level "functions" actually being methods of a hidden object). Still doesn't support loading a *fresh* copy due to the hidden PEP 3121 module cache. The proposed new approach is to bypass the PEP 3121 cache entirely, and instead recommend providing an instance of a custom type to be placed in sys.modules. Extension modules will be given the ability to explicitly disallow in-place reloading *or* to make it work reliably, rather than the status quo where the import system assumes it will work, and instead may fail in unusual ways. > > Mutable module global state is always a recipe for obscure bugs, and not > > something I will ever let through code review without a really good > > rationale. Hidden process global state is never good, just sometimes a > > necessary evil. > > I'm not necessarily talking about mutable state. Rather about things like > pre-initialised data or imported functionality. For example, I often have a > bound method of a compiled regex lying around somewhere in my Python > modules as a utility function. And the same kind of stuff exists in C code, > some may be local to a class, but other things can well be module global. > And given that we are talking about module internals here I'd always keep > them at the C level rather than exposing them through the module dict. The > module dict involves a much higher access overhead, in addition to the > reduced safety due to user accessibility. > > Exported C-APIs are also a use case. You'd import the C-API of another > module at init time and from that point on only go through function > pointers etc. Those are (sub-)interpreter specific, i.e. they are module > global state that is specific to the currently loaded module instances. Due to refcounting, all instances of Python objects qualify as mutable state. Hopefully my elaboration above helps make it clear why I think it's worthwhile to clearly separate out the "no custom C level state needed" case. > > However, keep in mind my patch is currently just the part I can implement > > without PEP 451 module spec objects. > > Understood. > > > >> Note that even global functions usually hold state, be it in the form of > >> globally imported modules, global caches, constants, ... > > > > If they can be shared safely across multiple instances of the module (e.g. > > immutable constants), then these can be shared at the C level. Otherwise, a > > custom Python type will be needed to make them instance specific. > > I assume you meant a custom module (extension) type here. Not sure yet. For PEP 451, we still need to support arbitrary objects in sys.modules, so it's still possible that freedom will be made available to extension modules. > > Just to be clear, the "module state at the C-level" is meant to be stored > in the object struct fields of the extension type that implements the > module, at least for modules that want to support reloading and > sub-interpreters. Obviously, nothing should be stored in static (global) > variables etc. Right. > >>> We also need the create/exec split to properly support reloading. Reload > >>> *must* reinitialize the object already in sys.modules instead of > >>> inserting > >>> a different object or it completely misses the point of reloading > >>> modules > >>> over deleting and reimporting them (i.e. implicitly affecting the > >>> references from other modules that imported the original object). > >> > >> Interesting. I never thought of it that way. > >> > >> I'm not sure this can be done in general. What if the module has threads > >> running that access the global state? In that case, reinitialising the > >> module object itself would almost certainly lead to a crash. That's why I want a way for loaders in general (and extension modules in particular) to clearly say "in-place reloading not supported", rather than Python blundering ahead with it and risking a crash. > > My current proposal on import-sig is to make the first hook > > "prepare_module", and pass in the existing object in the reload case. For > > the extension loader, this would be reflected in the signature of the C > > level hook as well, so the module could decide for itself if it supported > > reloading. > > I really don't like the idea of reloading by replacing module state. It > would be much simpler if the module itself would be replaced, then the > original module could stay alive and could still be used by those who hold > a reference to it or parts of its contents. Especially the from-import case > would benefit from this. Obviously, you could still run into obscure bugs > where a function you call rejects the input because it expects an older > version of a type, for example. But I can't see that being worse (or even > just different) from the reload-by-refilling-dict case. Sure, this is what we do in the test suite in "test.support.import_fresh_module". It was actually Eli trying to use that in the etree tests that triggered our recent investigation of the limits of PEP 3121 (it breaks for stateful extension modules due to the per-interpreter caching). It's a different operation from imp.reload, though. Assuming we can get this stable and reliable in the new API, I expect we'll be able to add "imp.reload_fresh" as a supported API in 3.5. > You seemed to be ok with my idea of making the loader return a wrapped > extension module instead of the module itself. We should actually try that. Sure, that's just a variant of the "hidden state object" idea I described above. It should actually work today with the PEP 3121 custom storage size set to zero. > > This is actually my primary motivation for trying to improve the > > "can this be reloaded or not?" aspects of the loader API in PEP 451. > > I assume you mean that the extension module would be able to clearly signal > that it can't be reloaded, right? I agree that that's helpful. If you're > wrapping a C library, then the way that library is implemented might simply > force you to prevent any attempts at reloading the wrapper module. But if > reloading is possible at all, it would be even more helpful if we could > make it really easy to properly support it. Yep, that's my goal (and why it's really good to be having this discussion while PEP 451 is still in development). > > > > (keep in mind existing extension modules using the existing API will still > > never be reloaded) > > Sure, that's the cool thing. We can really design this totally from scratch > without looking back. Well, not *quite*. We need to ensure a module can implement both APIs can coexist in the same module for source compatibility without nasty ifdef hacks, and that there is a reasonable migration path for existing handwritten extension modules. > >>> Take a look at the current example - everything gets stored in the > >>> module dict for the simple case with no C level global state. > >> > >> Well, you're storing types there. And those types are your module API. I > >> understand that it's just an example, but I don't think it matches a > >> common > >> case. As far as I can see, the types are not even interacting with each > >> other, let alone doing any C-level access of each other. We should try to > >> focus on the normal case that needs C-level state and C-level field access > >> of extension types. Once that's solved, we can still think about how to > >> make the really simple cases simpler, if it turns out that they are not > >> simple enough. > > > > Our experience is very different - my perspective is that the normal case > > either eschews C level global state in the extension module, because it > > causes so many problems, or else just completely ignores subinterpreter > > support and proper module cleanup. > > As soon as you have more than one extension type in your module, and they > interact with each other, they will almost certainly have to do type checks > against each other to make sure users haven't passed them rubbish before > they access any C struct fields of the object. Doing a type check means > that at least one type has a pointer to the other, meaning that it holds > global module state. Sure, but you can use the CPython API rather than writing normal C code. We do this fairly often in CPython when we're dealing with things stored in modules that can be manipulated from Python. It incurs CPython's dynamic dispatch overhead, but sometimes that's worth it to avoid needing to deal with C level lifecycle issues. > I really think that having some kind of global module state is the > exceedingly common case for an extension module. I wouldn't be willing to make the call about which of stateless vs stateful is more common without a lot more research :) They're both common enough that I think they should both be well supported, and making the "no custom C level state" case as simple as possible. > >> I didn't know about PyType_FromSpec(), BTW. It looks like a nice addition > >> for manually written code (although useless for Cython). > > > > This is the only way to create custom types when using the stable ABI. Can > > I take your observation to mean that Cython doesn't currently offer the > > option of limiting itself to the stable ABI? > > Correct. I've taken a bird's view at it back then, and keep stumbling over > "wow - I couldn't even use that?" kind of declarations in the header files. > I don't think it makes sense for Cython. Existing CPython versions are easy > to support because they don't change anymore, and new major releases most > likely need adaptations anyway, if only to adapt to new features and > performance changes. Cython actually knows quite a lot about the inner > workings of CPython and its various releases. Going only through the stable > ABI parts of the C-API would make the code horribly slow in comparison, so > there are huge drawbacks for the benefit it might give. > > The Cython way of doing it is more like: you want your code to run on a new > CPython version, then use a recent Cython release to compile it. It may > still work with older ones, but what you actually want is the newest > anyway, and you also want to compile the C code for the specific CPython > version at hand to get the most out of it. It's the C code that adapts, not > the runtime code (or Cython itself). > > We run continuous integration tests with all of CPython's development > branches since 2.4, so we usually support new CPython releases long before > they are out. And new releases of CPython rarely affect Cython user code. The main advantage of the stable ABI is being able to publish cross-version binary extension modules. I guess if Cython already supports generating binaries for each new version of CPython before we release it, that capability is indeed less useful than it is for those that are maintaining extension modules by hand. Cheers, Nick. > > Stefan > > > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: http://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From ncoghlan at gmail.com Sun Sep 1 03:36:51 2013 From: ncoghlan at gmail.com (Nick Coghlan) Date: Sun, 1 Sep 2013 11:36:51 +1000 Subject: [Python-Dev] Add a new tracemalloc module to trace memory allocations In-Reply-To: References: Message-ID: +1 from me for both tracemalloc and failmalloc in the same vein as faulthandler (and using similar API concepts to faulthandler). While I like the flat top level naming structure, we should clearly document these as implementation dependent runtime services. Other implementations may not provide them at all, and even if they do, many details will likely be different. The gc module may even fall into the same category. Cheers, Nick. -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan_ml at behnel.de Sun Sep 1 10:11:36 2013 From: stefan_ml at behnel.de (Stefan Behnel) Date: Sun, 01 Sep 2013 10:11:36 +0200 Subject: [Python-Dev] Pre-PEP: Redesigning extension modules In-Reply-To: References: <20130823111822.49cba700@pitrou.net> Message-ID: Nick Coghlan, 01.09.2013 03:28: > On 1 Sep 2013 05:18, "Stefan Behnel" wrote: >> I can't really remember a case where I could afford the >> runtime overhead of implementing a wrapper in Python and going through >> something like ctypes or cffi. I mean, testing C libraries with Python >> tools would be one, but then, you wouldn't want to write an extension >> module for that and instead want to call it directly from the test code as >> directly as possible. >> >> I'm certainly aware that that use case exists, though, and also the case >> of just wanting to get things done as quickly and easily as possible. > > Keep in mind I first came to Python as a tool for test automation of custom > C++ hardware APIs that could be written to be SWIG friendly. Interesting again. Would you still do it that way? I recently had a discussion with Holger Krekel of py.test fame about testing C code with Cython, and we quickly agreed that wrapping the code in an extension module was both too cumbersome and too inflexible for testing purposes. Specifically, neither of Cython's top selling points fits here, not speed, not clarity, not API design. It's most likely different for SWIG, which involves less (not no, just less) manual work and gives you API-wise more of less exactly what you put in. However, cffi is almost certainly the better way to do it, because it gives you all sorts of flexibility for your test code without having to think about the wrapper design all the time. The situation is also different for C++ where you have less options for wrapping it. I can imagine SWIG still being the tool of choice on that front when it comes to bare and direct testing of large code bases. > I now work for an OS vendor where the 3 common languages for system > utilities are C, C++ and Python. > > For those use cases, dropping a bunch of standard Python objects in a > module dict is often going to be a quick and easy solution that avoids a > lot of nasty pointer lifecycle issues at the C level. That's yet another use case, BTW. When you control the whole application, then safety doesn't really matter at these points and keeping a bunch of stuff in a dict will usually work just fine. I'm mainly used to writing libraries for (sometimes tons of) other people, in which case the requirements are so diverse on user side that safety is a top thing to care about. Anything you can keep inside of C code should stay there. (Especially when dealing with libxml2&friends in lxml which continuously present their 'interesting' usability characteristics.) > * PEP 3121 with a size of "0". As above, but avoids the module state APIs > in order to support reloading. All module state (including type > cross-references) is stored in hidden state (e.g. an instance of a custom > type not exposed to Python, with a reference stored on each custom type > object defined in the module, and any module level "functions" actually > being methods of a hidden object). Thanks for elaborating. I had completely failed to make the mental link that you could simply stick bound methods as functions into the module dict, i.e. that they don't even have to be methods of the module itself. That's something that Cython could already use in older CPythons, even as a preparation for any future import protocol changes. The object that they are methods of would then eventually become the module instance. You'd still suffer a slight performance hit from going from a static global C variable to a pointer indirection - for everything: string constants, cached Python objects, all user defined global C variables would have to go there as Cython cannot know if they are module instance specific state or not (they usually will be, I guess). But that has to be done anyway if the goal is to get rid of static state to enable sub-interpreters. I can't wait seeing lxml run threaded in mod_wsgi... ;-) >> You seemed to be ok with my idea of making the loader return a wrapped >> extension module instead of the module itself. We should actually try >> that. > > Sure, that's just a variant of the "hidden state object" idea I described > above. It should actually work today with the PEP 3121 custom storage size > set to zero. True. The only difference is whether you leave it to the extension type itself or make it a part of the loader architecture. Anyway, I promise I'll give it a try in Cython. Will be some work, though, to rewrite Cython's use of global variables, create a module state type, migrate everything to heap types, ... I had wanted to do that for a couple of years, but it's clearly not something for a happy afternoon or two. Plus, it would even have to be optional in the compiler to avoid performance regressions for modules that want to continue using fast static globals simply because they cannot support multiple instances anyway (e.g. due to external C library dependencies). Let's see if we can solve that at C compilation time by throwing in a couple of macros. That would at least help keeping the Cython compiler itself simple in that regard... (I guess it would also help with testing as we could just duplicate the test suite runs for both design modes) >> As soon as you have more than one extension type in your module, and they >> interact with each other, they will almost certainly have to do type >> checks >> against each other to make sure users haven't passed them rubbish before >> they access any C struct fields of the object. Doing a type check means >> that at least one type has a pointer to the other, meaning that it holds >> global module state. > > Sure, but you can use the CPython API rather than writing normal C code. We > do this fairly often in CPython when we're dealing with things stored in > modules that can be manipulated from Python. > > It incurs CPython's dynamic dispatch overhead, but sometimes that's worth > it to avoid needing to deal with C level lifecycle issues. Not so much of a problem in Cython, because all you usually have to do to get fast C level access to something is to change a "def" into a "cdef" somewhere, or add a decorator, or an assignment to a known extension type variable. Once the module global state is 'virtualised', this will also be a safe thing to do in the face of multiple module instances, and still be much faster than going through Python calls. >> I really think that having some kind of global module state is the >> exceedingly common case for an extension module. > > I wouldn't be willing to make the call about which of stateless vs stateful > is more common without a lot more research :) > > They're both common enough that I think they should both be well supported, > and making the "no custom C level state" case as simple as possible. Agreed. >>>> I didn't know about PyType_FromSpec(), BTW. It looks like a nice >>>> addition for manually written code (although useless for Cython). >>> >>> This is the only way to create custom types when using the stable ABI. I actually think I recall reading about it in the PEP back when it was designed, decided that it made sense in the given context, and then forgot about it as I didn't consider it relevant. > The main advantage of the stable ABI is being able to publish cross-version > binary extension modules. I guess if Cython already supports generating > binaries for each new version of CPython before we release it, that > capability is indeed less useful than it is for those that are maintaining > extension modules by hand. I consider it mostly interesting for Linux distributions and closed source module vendors as it reduces the build/support overhead. But compiling the generated C code for the specific CPython version at hand really has some major advantages. Stefan From ncoghlan at gmail.com Sun Sep 1 14:23:02 2013 From: ncoghlan at gmail.com (Nick Coghlan) Date: Sun, 1 Sep 2013 22:23:02 +1000 Subject: [Python-Dev] Pre-PEP: Redesigning extension modules In-Reply-To: References: <20130823111822.49cba700@pitrou.net> Message-ID: On 1 September 2013 18:11, Stefan Behnel wrote: > Nick Coghlan, 01.09.2013 03:28: >> On 1 Sep 2013 05:18, "Stefan Behnel" wrote: >>> I can't really remember a case where I could afford the >>> runtime overhead of implementing a wrapper in Python and going through >>> something like ctypes or cffi. I mean, testing C libraries with Python >>> tools would be one, but then, you wouldn't want to write an extension >>> module for that and instead want to call it directly from the test code as >>> directly as possible. >>> >>> I'm certainly aware that that use case exists, though, and also the case >>> of just wanting to get things done as quickly and easily as possible. >> >> Keep in mind I first came to Python as a tool for test automation of custom >> C++ hardware APIs that could be written to be SWIG friendly. > > Interesting again. Would you still do it that way? I recently had a > discussion with Holger Krekel of py.test fame about testing C code with > Cython, and we quickly agreed that wrapping the code in an extension module > was both too cumbersome and too inflexible for testing purposes. > Specifically, neither of Cython's top selling points fits here, not speed, > not clarity, not API design. It's most likely different for SWIG, which > involves less (not no, just less) manual work and gives you API-wise more > of less exactly what you put in. However, cffi is almost certainly the > better way to do it, because it gives you all sorts of flexibility for your > test code without having to think about the wrapper design all the time. > > The situation is also different for C++ where you have less options for > wrapping it. I can imagine SWIG still being the tool of choice on that > front when it comes to bare and direct testing of large code bases. To directly wrap C++, I'd still use SWIG. It makes a huge difference when you can tweak the C++ side of the API to be SWIG friendly rather than having to live with whatever a third party C++ library provides. Having classes in C++ map directly to classes in Python is the main benefit of doing it this way over using a C wrapper and cffi. However, for an existing C API, or a custom API where I didn't need the direct object mapping that C++ can provide, using cffi would be a more attractive option than SWIG these days (the stuff I was doing with SWIG was back around 2003 or so). I think this is getting a little off topic for the list, though :) >> I now work for an OS vendor where the 3 common languages for system >> utilities are C, C++ and Python. >> >> For those use cases, dropping a bunch of standard Python objects in a >> module dict is often going to be a quick and easy solution that avoids a >> lot of nasty pointer lifecycle issues at the C level. > > That's yet another use case, BTW. When you control the whole application, > then safety doesn't really matter at these points and keeping a bunch of > stuff in a dict will usually work just fine. I'm mainly used to writing > libraries for (sometimes tons of) other people, in which case the > requirements are so diverse on user side that safety is a top thing to care > about. Anything you can keep inside of C code should stay there. > (Especially when dealing with libxml2&friends in lxml which continuously > present their 'interesting' usability characteristics.) I don't think it's a coincidence that it was the etree interface with expat that highlighted the deficiencies of the current extension module hooks when it comes to working properly with test.support.import_fresh_module :) >> * PEP 3121 with a size of "0". As above, but avoids the module state APIs >> in order to support reloading. All module state (including type >> cross-references) is stored in hidden state (e.g. an instance of a custom >> type not exposed to Python, with a reference stored on each custom type >> object defined in the module, and any module level "functions" actually >> being methods of a hidden object). > > Thanks for elaborating. I had completely failed to make the mental link > that you could simply stick bound methods as functions into the module > dict, i.e. that they don't even have to be methods of the module itself. > That's something that Cython could already use in older CPythons, even as a > preparation for any future import protocol changes. The object that they > are methods of would then eventually become the module instance. > > You'd still suffer a slight performance hit from going from a static global > C variable to a pointer indirection - for everything: string constants, > cached Python objects, all user defined global C variables would have to go > there as Cython cannot know if they are module instance specific state or > not (they usually will be, I guess). But that has to be done anyway if the > goal is to get rid of static state to enable sub-interpreters. I can't wait > seeing lxml run threaded in mod_wsgi... ;-) To be honest, I didn't realise that such a trick might already be possible until I was writing down this list of alternatives. If you manage to turn it into a real solution for lxml (or Cython in general), it would be great to hear more about how you turned the general idea into something real :) That means the powers any new extension initialisation API will offer will be limited to: * letting the module know its own name (and other details) * letting the module explicitly block reloading * letting the module support loading multiple copies at once by taking the initial import out of sys.modules (but keeping a separate reference to it alive) >>> As soon as you have more than one extension type in your module, and they >>> interact with each other, they will almost certainly have to do type >>> checks >>> against each other to make sure users haven't passed them rubbish before >>> they access any C struct fields of the object. Doing a type check means >>> that at least one type has a pointer to the other, meaning that it holds >>> global module state. >> >> Sure, but you can use the CPython API rather than writing normal C code. We >> do this fairly often in CPython when we're dealing with things stored in >> modules that can be manipulated from Python. >> >> It incurs CPython's dynamic dispatch overhead, but sometimes that's worth >> it to avoid needing to deal with C level lifecycle issues. > > Not so much of a problem in Cython, because all you usually have to do to > get fast C level access to something is to change a "def" into a "cdef" > somewhere, or add a decorator, or an assignment to a known extension type > variable. Once the module global state is 'virtualised', this will also be > a safe thing to do in the face of multiple module instances, and still be > much faster than going through Python calls. It's kinda cool how designing a next generation API can sometimes reveal hidden possibilities of an *existing* API :) We had another one of those recently on distutils-sig, when I realised the much-maligned .pth modules are actually a decent solution to sharing distributions between virtual environments. I'm so used to disliking their global side effects when used with the system Python that it took me a long time to recognise the validity of using them to make implicit path additions in a more controlled virtual environment :) In terms of where we go from here - do you mind if I use your pre-PEP as the initial basis for a PEP of my own some time in the next week or two (listing you as co-author)? Improving extension module initialisation has been the driver for most of the PEP 451 feedback I've been giving to Eric over on import-sig, so I have some definite ideas on how I think that API should look :) Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia From stefan_ml at behnel.de Sun Sep 1 14:41:50 2013 From: stefan_ml at behnel.de (Stefan Behnel) Date: Sun, 01 Sep 2013 14:41:50 +0200 Subject: [Python-Dev] Pre-PEP: Redesigning extension modules In-Reply-To: References: <20130823111822.49cba700@pitrou.net> Message-ID: Nick Coghlan, 01.09.2013 14:23: > That means the powers any new extension initialisation API will offer > will be limited to: > > * letting the module know its own name (and other details) > * letting the module explicitly block reloading > * letting the module support loading multiple copies at once by taking > the initial import out of sys.modules (but keeping a separate > reference to it alive) Which, all by themselves, can be considered a huge benefit, IMHO. Plus, if we design the protocol broad enough now, specifically as a two-way interface (info in, module out), we won't have to make any major changes to it again anywhere in the near future, because incremental changes can just be integrated into what's there then, in case we need any. It's sad that we didn't see these requirements for Py3.0. > In terms of where we go from here - do you mind if I use your pre-PEP > as the initial basis for a PEP of my own some time in the next week or > two (listing you as co-author)? Improving extension module > initialisation has been the driver for most of the PEP 451 feedback > I've been giving to Eric over on import-sig, so I have some definite > ideas on how I think that API should look :) Go for it. I'm not sure how much time I can actively spend on this during the next weeks anyway, so I'm happy if this continues to get pushed onwards in the meantime. Stefan From solipsis at pitrou.net Sun Sep 1 15:03:51 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Sun, 1 Sep 2013 15:03:51 +0200 Subject: [Python-Dev] Pre-PEP: Redesigning extension modules References: <20130823111822.49cba700@pitrou.net> Message-ID: <20130901150351.2f2aa44c@fsol> On Sun, 1 Sep 2013 11:28:36 +1000 Nick Coghlan wrote: > * PEP 3121 with a size of "0". As above, but avoids the module state APIs > in order to support reloading. All module state (including type > cross-references) is stored in hidden state (e.g. an instance of a custom > type not exposed to Python, with a reference stored on each custom type > object defined in the module, and any module level "functions" actually > being methods of a hidden object). Still doesn't support loading a *fresh* > copy due to the hidden PEP 3121 module cache. Not sure what you mean by that: >>> import atexit >>> id(atexit) 140031896222680 >>> import sys >>> del sys.modules['atexit'] >>> import atexit >>> id(atexit) 140031896221400 > Due to refcounting, all instances of Python objects qualify as mutable > state. That's an overly broad definition. Many objects are shared between subinterpreters without any problems (None, the empty tuple, built-in types and most C extension types, etc.). As long as the state is an internal implementation detail, there shouldn't be any problem. > I wouldn't be willing to make the call about which of stateless vs stateful > is more common without a lot more research :) > > They're both common enough that I think they should both be well supported, > and making the "no custom C level state" case as simple as possible. Agreed. Regards Antoine. From ncoghlan at gmail.com Sun Sep 1 16:10:08 2013 From: ncoghlan at gmail.com (Nick Coghlan) Date: Mon, 2 Sep 2013 00:10:08 +1000 Subject: [Python-Dev] Pre-PEP: Redesigning extension modules In-Reply-To: <20130901150351.2f2aa44c@fsol> References: <20130823111822.49cba700@pitrou.net> <20130901150351.2f2aa44c@fsol> Message-ID: On 1 September 2013 23:03, Antoine Pitrou wrote: > On Sun, 1 Sep 2013 11:28:36 +1000 > Nick Coghlan wrote: >> * PEP 3121 with a size of "0". As above, but avoids the module state APIs >> in order to support reloading. All module state (including type >> cross-references) is stored in hidden state (e.g. an instance of a custom >> type not exposed to Python, with a reference stored on each custom type >> object defined in the module, and any module level "functions" actually >> being methods of a hidden object). Still doesn't support loading a *fresh* >> copy due to the hidden PEP 3121 module cache. > > Not sure what you mean by that: > >>>> import atexit >>>> id(atexit) > 140031896222680 >>>> import sys >>>> del sys.modules['atexit'] >>>> import atexit >>>> id(atexit) > 140031896221400 Ah, you're right - I misremembered the exact problem that broke xml.etree.ElementTree testing. PyModule_GetState is actually fine (since that pointer is hidden state on the module object), it's only PyState_GetModule that is broken when you import a second copy. So, here, when the second import happens, it breaks the original atexit module's callbacks, even though the two callback registries are properly isolated: $ ./python Python 3.4.0a1+ (default:575071257c92+, Aug 25 2013, 00:42:17) [GCC 4.7.2 20121109 (Red Hat 4.7.2-8)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import atexit >>> atexit.register(print, "Hello World!") >>> import sys >>> del sys.modules["atexit"] >>> import atexit as atexit2 >>> atexit2.register(print, "Goodbye World!") >>> Goodbye World! So I think PEP 3121 is actually as good as we can get on the hidden state front, but the important point is that it is the *PyState_GetModule* API that can't handle fresh imports - the second import will always replace the first one. So anyone affected needs to find some other way of passing the state, like using bound methods of a hidden type rather than ordinary callables. If you have to interoperate with a C API that only accepts a C callback without allowing additional state arguments, you're going to have trouble. I think atexit serves as a good example, though - that _Py_PyAtExit call will *always* be destructive (even if you still have a reference to the original module), so there should be a way for the module to explicitly indicate to the import system "you can only create this module once, and then you're committed - unloading it and importing it again won't work properly due to side effects on the process state". Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia From rdmurray at bitdance.com Sun Sep 1 18:28:06 2013 From: rdmurray at bitdance.com (R. David Murray) Date: Sun, 01 Sep 2013 12:28:06 -0400 Subject: [Python-Dev] Completing the email6 API changes. In-Reply-To: <878uzhdh24.fsf@uwakimon.sk.tsukuba.ac.jp> References: <20130831052136.42D4B2507F5@webabinitio.net> <87bo4echcr.fsf@uwakimon.sk.tsukuba.ac.jp> <20130831142352.600462507F5@webabinitio.net> <878uzhdh24.fsf@uwakimon.sk.tsukuba.ac.jp> Message-ID: <20130901162807.0C345250813@webabinitio.net> On Sun, 01 Sep 2013 00:18:59 +0900, "Stephen J. Turnbull" wrote: > R. David Murray writes: > > > Full validation is something that is currently a "future > > objective". > > I didn't mean it to be anything else. :-) > > > There's infrastructure to do it, but not all of the necessary knowledge > > has been coded in yet. > > Well, I assume you already know that there's no way that can ever > happen (at least until we abandon messaging entirely): new RFCs will > continue to be published. So it needs to be an extensible mechanism, > a "pipeline" of checks (Barry would say a "chain of rules", I think). My idea was to encode as much of the current known rules as as we have the stomach for, and to have a validation flag that you turn on if you want to check your message against those standards. But without that flag the code allows you to set arbitrary parameters and headers. As you say, an extensible mechanism for the validators is a good idea. So I take it back that the infrastructure is in place, since extensibility doesn't exist for that feature yet. --David From solipsis at pitrou.net Sun Sep 1 19:40:48 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Sun, 1 Sep 2013 19:40:48 +0200 Subject: [Python-Dev] Pre-PEP: Redesigning extension modules In-Reply-To: References: <20130823111822.49cba700@pitrou.net> <20130901150351.2f2aa44c@fsol> Message-ID: <20130901194048.0d7d1b75@fsol> On Mon, 2 Sep 2013 00:10:08 +1000 Nick Coghlan wrote: > > $ ./python > Python 3.4.0a1+ (default:575071257c92+, Aug 25 2013, 00:42:17) > [GCC 4.7.2 20121109 (Red Hat 4.7.2-8)] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> import atexit > >>> atexit.register(print, "Hello World!") > > >>> import sys > >>> del sys.modules["atexit"] > >>> import atexit as atexit2 > >>> atexit2.register(print, "Goodbye World!") > > >>> > Goodbye World! Yeah, atexit is a very particular example, because it interacts with global state by design (the main interpreter instance), and no amount of module initialization magic can prevent that :-) Speaking of which, it also doesn't work (well) with subinterpreters: http://bugs.python.org/issue18618 Regards Antoine. From tjreedy at udel.edu Sun Sep 1 22:02:33 2013 From: tjreedy at udel.edu (Terry Reedy) Date: Sun, 01 Sep 2013 16:02:33 -0400 Subject: [Python-Dev] 'Subinterpreter' (was Re: Pre-PEP: Redesigning extension modules) In-Reply-To: <20130901194048.0d7d1b75@fsol> References: <20130823111822.49cba700@pitrou.net> <20130901150351.2f2aa44c@fsol> <20130901194048.0d7d1b75@fsol> Message-ID: > Speaking of which, it also doesn't work (well) with subinterpreters: Could someone briefly explain 'subinterpreter' or point me somewhere in the docs? It appears throughout this thread but there is no index or glossary entry. -- Terry Jan Reedy From solipsis at pitrou.net Sun Sep 1 22:06:49 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Sun, 1 Sep 2013 22:06:49 +0200 Subject: [Python-Dev] 'Subinterpreter' (was Re: Pre-PEP: Redesigning extension modules) References: <20130823111822.49cba700@pitrou.net> <20130901150351.2f2aa44c@fsol> <20130901194048.0d7d1b75@fsol> Message-ID: <20130901220649.3e9c3ab4@fsol> On Sun, 01 Sep 2013 16:02:33 -0400 Terry Reedy wrote: > > > Speaking of which, it also doesn't work (well) with subinterpreters: > > Could someone briefly explain 'subinterpreter' or point me somewhere in > the docs? It appears throughout this thread but there is no index or > glossary entry. http://docs.python.org/dev/c-api/init.html#sub-interpreter-support Subinterpreters are a somewhat borderline feature that allows embedding applications to host multiple Python programs in a single process. A well-known example is mod_wsgi. Regards Antoine. From solipsis at pitrou.net Sun Sep 1 23:04:14 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Sun, 1 Sep 2013 23:04:14 +0200 Subject: [Python-Dev] cpython (merge 3.3 -> default): Merge fix from 3.3 into default. References: <3cSn1P710Hz7LjX@mail.python.org> Message-ID: <20130901230414.44af5426@fsol> On Sun, 1 Sep 2013 23:02:17 +0200 (CEST) tim.peters wrote: > http://hg.python.org/cpython/rev/25211a22228b > changeset: 85495:25211a22228b > parent: 85493:267e09700978 > parent: 85494:8efcf3c823f9 > user: Tim Peters > date: Sun Sep 01 16:01:46 2013 -0500 > summary: > Merge fix from 3.3 into default. > > Fix issue 18889: test_sax: multiple failures on Windows desktop. > > "The fix" is to tell Mercurial that the test files are binary. > > Windows developers: to get the correct line endings in your checkout, > delete Lib\test\xmltestdata, and then "hg revert" that directory. > > Why the Windows buildbots didn't fail test_sax remains a mystery :-( Probably because they don't have the hgeol extension enabled. Regards Antoine. From stefan_ml at behnel.de Sun Sep 1 23:13:36 2013 From: stefan_ml at behnel.de (Stefan Behnel) Date: Sun, 01 Sep 2013 23:13:36 +0200 Subject: [Python-Dev] 'Subinterpreter' (was Re: Pre-PEP: Redesigning extension modules) In-Reply-To: <20130901220649.3e9c3ab4@fsol> References: <20130823111822.49cba700@pitrou.net> <20130901150351.2f2aa44c@fsol> <20130901194048.0d7d1b75@fsol> <20130901220649.3e9c3ab4@fsol> Message-ID: Antoine Pitrou, 01.09.2013 22:06: > On Sun, 01 Sep 2013 16:02:33 -0400 > Terry Reedy wrote: >>> Speaking of which, it also doesn't work (well) with subinterpreters: >> >> Could someone briefly explain 'subinterpreter' or point me somewhere in >> the docs? It appears throughout this thread but there is no index or >> glossary entry. > > http://docs.python.org/dev/c-api/init.html#sub-interpreter-support > > Subinterpreters are a somewhat borderline feature that allows embedding > applications to host multiple Python programs in a single process. A > well-known example is mod_wsgi. And extension modules usually don't play well with subinterpreters because each subinterpreter requires its own separate version of the module and extension modules are rarely designed to keep their state completely local to an interpreter, let alone being prepared for having their module init function be called more than once. Stefan From rdmurray at bitdance.com Mon Sep 2 00:10:39 2013 From: rdmurray at bitdance.com (R. David Murray) Date: Sun, 01 Sep 2013 18:10:39 -0400 Subject: [Python-Dev] Completing the email6 API changes. In-Reply-To: <87bo4echcr.fsf@uwakimon.sk.tsukuba.ac.jp> References: <20130831052136.42D4B2507F5@webabinitio.net> <87bo4echcr.fsf@uwakimon.sk.tsukuba.ac.jp> Message-ID: <20130901221040.DC76E250818@webabinitio.net> On Sat, 31 Aug 2013 18:57:56 +0900, "Stephen J. Turnbull" wrote: > R. David Murray writes: > > > But I would certainly appreciate review from anyone so moved, since I > > haven't gotten any yet. > > I'll try to make time for a serious (but obviously partial) review by > Monday. > > I don't know if this is "serious" bikeshedding, but I have a comment > or two on the example: > > > from email.message import MIMEMessage > > from email.headerregistry import Address > > fullmsg = MIMEMessage() > > fullmsg['To'] = Address('Fo?? Bar', 'fbar at example.com') > > fullmsg['From'] = "m???? " > > fullmsg['Subject'] = "j'ai un probl??me de python." > > This is very nice! *I* *love* it. > > But (sorry!) I worry that it's not obvious to "naive" users. Maybe it > would be useful to have a Message() factory which has one semantic > difference from MIMEMessage: it "requires" RFC 822-required headers > (or optionally RFC 1036 for news). Eg: > > # This message will be posted and mailed > # These would conform to the latest Draft Standards > # and be DKIM-signed > fullmsg = Message('rfc822', 'rfc1036', 'dmarc') > > I'm not sure how "required" would be implemented (perhaps through a > .validate() method). So the signature of the API suggested above is > Message(*validators, **kw). Adding new constructor arguments to the existing Message class is possible. However, given the new architecture, the more logical way to do this is to put it in the policy. So currently the idea would be for this to be spelled like this: fullmsg = Message(policy=policy.SMTP+policy.strict) Then what would happen is that when the message is serialized (be it via str(), bytes(), by passing it to smtplib.sendmail or smtplib.sendmessage, or by an explicit call to a Generator), an error would be raised if the minimum required headers are not present. As I said in an earlier message, currently there's no extensibility mechanism for the validation. If the parser recognizes a defect, whether or not an error is raised is controlled by the policy. But there's no mechanism for adding new defect checking that the parser doesn't already know about, or for issues that are not parse-time defects. (There is currently one non-parsing defect for which there is a custom control: the maximum number of headers of a given type that are allowed to be added to a Message object.) So we need some way to add additional constraints as well. Probably a list of validation functions that take a Message/MIMEPart as the argument and do a raise if they want to reject the message. The tricky bit is that currently raise_on_defect means you get an error as soon as a (parsing) defect is discovered. Likewise, if max_count is being enforced for headers, the error is raised as soon as the duplicate header is added. Generating errors early when building messages was one of or original design goals, and *only* detecting problems via validators runs counter to that unless all the validators are called every time an operation is performed that modifies a message. Maybe that would be OK, but it feels ugly. For the missing header problem, the custom solution could be to add a 'headers' argument to Message that would allow you to write: fullmsg = Message(header=( Header('Date', email.utils.localtime()), Header('To', Address('Fred', 'abc at xyz.com')), Header('From', Address('Sally, 'fgd at xyz.com')), Header('Subject', 'Foo'), ), policy=policy.SMTP+policy.Strict) This call could then immediately raise an error if not all of the required headers are present. (Header is unfortunately not a good choice of name here because we already have a 'Header' class that has a different API). Aside: I could also imagine adding a 'content' argument that would let you generate a simple text message via a single call...which means you could also extend this model to specifying the entire message in a single call, if you wrote a suitable content manager function for tuples: fullmsg = Message( policy=policy.SMTP+policy.Strict, header=( Header('Date', datetime.datetime.now()), Header('To', Address('Fred', 'abc at xyz.com')), Header('From', Address('Sally, 'fgd at xyz.com')), Header('Subject', 'Foo'), ), content=( ( 'This is the text part', ( '

Here is the html

', {'image1': b'image data'}, ), ), b'attachment data', ) But that is probably a little bit crazy...easier to just write a custom function for your application that calls the message building APIs. Well, anyway, coming back from that little tangent, it seems to me in summary that if we want to raise errors as soon as possible, we need to add custom mechanisms for the error detection as we figure out each class of error we want to handle, so that the validation gets done right away without adding too much overhead. For parsing defects, that means if you want to control which ones are raised you hook handle_defect and make your decision there (there's no way to *add* parsing defects via that hook). For duplicate headers, you hook header_max_count (or set max_count on your custom header classes). For missing headers we *could* introduce something like the above headers argument to Message, which would be required in 'strict' mode. But clearly we should also have a general "validation function" list on the policy, where all the functions would be called before serialization and have an opportunity to reject the message by raising errors. That would provide a generalized, if heavier handed, hook to use when there is no specific hook that provides extendability. For missing headers I'm inclined to use a serialization-time check rather than the Message constructor check I speculated about above. My logic is that the message isn't complete until you are ready to send it, so generating an error earlier probably isn't wanted in many cases, nor will generating it at serialization time loose you much debugging information. So I'm inclined to implement it as a default validator in the proposed list of serialization time validators. It is still probably worthwhile providing a utility function for creating a message in a single call. I think there's even an open issue in the tracker for that. But I'm inclined to postpone that until 3.5. > For MIMEMessage, I think I prefer the name "MIMEPart". To naive > users, the idea of MIMEMessages containing MIMEMessages is a bit > disconcerting, except in the case of multipart/digest, I think. Or message/rfc822: [...] try: smtplib.sendmessage(msg) except Exception as exc: errormsg = MIMEMEssage() errormsg['To'] = msg['sender'] or msg['from'] errormsg['From'] = 'robot at mydomain.org' errormsg.set_content("I'm sorry, sending failed: {}".format(exc)) errormsg.add_attachment(orig_msg, disposition='inline') smtplib.sendmessage(errormsg) (Terrible code, but you get the idea :) > > fullmsg.set_content("et la il est mont?? sur moi et il commence" > > " a m'????touffer.") > > htmlmsg = MIMEMessage() > > htmlmsg.set_content("

et la il est mont?? sur moi et il commence" > > " a m'??touffer.

", > > subtype='html') > > I think I'd like to express the suite above as > > fullmsg.payload.add_alternative(...) > fullmsg.payload.add_alternative(..., subtype='html') > > This would automatically convert the MIME type of fullmsg to > 'multipart/alternative', and .payload to a list where necessary. > .set_content() would be available but it's "dangerous" (it could > replace an arbitrary multipart -- this would be useful operation to > replace it with a textual URL or external-body part). Having an attribute with methods that affect the parent object is not a natural act in Python. (Is it in OO in general?) But aside from that, I'm not sure I see the point of a two level name here. You are still talking about mutating the message model object, which is exactly what is going on in my example: if you call add_alternative on a text part, it gets turned into a multipart/alternative with the first part being the text part and the second part being the thing you just added. That's in the docs but I didn't refer to it explicitly in my example. Does that make things clearer? It is a good point about unintentionally overwriting the existing contents. That would be simple to fix: make it an error to call set_content if payload is not None. Possibly a 'clear' method would then be useful, especially since so many other Python datatypes have one. > Aside: it occurs to me that the .payload attribute (and other such > attributes) could be avoided by the device of using names prefixed by > ":" such as ":payload" as keys: "fullmsg[':payload']" since colon is > illegal in field names (cf RFC 5322). Probably I've just been writing > too much Common Lisp, though. I think maybe so :). I'd rather write 'msg.payload' than 'msg[:payload']. So I don't have a motivation to "avoid" those attributes. (Nor would I find msg[':payload'].sommethod mutating the parent object any less surprising.) > I'm not sure whether "payload" is a better name than "content" for > that attribute. > > Now the suite > > > with open('python.jpg', 'rb') as python: > > htmlmsg.add_related(python.read(), 'image', 'jpg', cid='image1' > > disposition='inline') > > fullmsg.make_alternative() > > fullmsg.attach(htmlmsg) > > becomes just > > with open('python.jpg', 'rb') as python: > fullmsg.payload['text/html'].add_related(...) This doesn't work, though, because you could (although you usually won't) have more than one 'text/html' part in a single multipart. The reason behind the structure of my example is to avoid having to think about indexing into already existing parts. It *could* have been written: fullmsg.add_alternative(...) fullmsg.add_alternative(...., subtype='html') with open('python.jpg', 'rb') as python: fullmsg.get_payload()[1].add_related(...) But that means you have to think about payload lists and order of parts and figure out the right index to use. But perhaps some people will find that more congenial than the make_alternative() dance, and I should probably make sure that I include that alternative in the examples (that I haven't yet written for the docs). (I dislike the 'get_payload' API, by the way.) The awkwardness of the code in my example arises from the fact that a Message object is a valid thing to want to use as content (see message/rfc822 above), so I can't have the code just assume that: fullmsg.add_alternative(htmlmsg) means "make fullmsg into a multipart/alternative and attach htmlmsg", since in the logic of my API what it naturally means is "make_fullmsg into a multipart/alternative and attach a new message/rfc822 part containing htmlmsg". Thus the make/attach dance instead. However, what I really want, as I mentioned in my original proposal but have dropped from my 3.4 proposed code addition, is: with open('python.jpg', 'rb') as python: fullmsg.add_alternative( Webpage('

example<\p>', {'image1': python.read()} )) I dropped it from the code proposal because it seems to me that we should give the community an opportunity to experiment with the content manager interface before we decide what the best stuff is to include in the stdlib. > At this point, "fullmsg.add_related()" without the .payload attribute > would be an error, unless a "insertPart=True" keyword argument were > present. With "insertPart=True", a new top-level multipart/related > would be interposed with the existing multipart/alternative as its > first child, and the argument of add_related as the second. Maybe > that's too complicated, but I suspect it's harder for people who think > of MIME messages as trees, than for people who think of messages as > documents and don't want to hear about mimes other than Marcel > Marceau. I *think* I see what you are suggesting, but I don't see that it is easier for the non-tree thinker than my proposal. My proposal doesn't even let you make the conversion your insertPart=True would produce. (That could indeed be a bug, so we may want a "I know what I'm doing" keyword for 'make_related' and friends). > The indexing of the .payload attribute by part type is perhaps too > smart for my own good, haven't thought carefully about it. It's > plausible, though, since a message with multiple parts of the same > type can only have one displayed -- normally that shouldn't happen. > OTOH, this wouldn't work without modification for multipart/mixed or > multipart/related. Could use Yet Another Keyword Argument, maybe. Ah, good point. But the mechanism doesn't generalize to other types (eg: you can have any number of 'image/jpg'), which would make the API quite inconsistent (you can index by 'text/html' but not by 'image/jpeg'? Wat?) > (BTW, it's really annoying when the text/plain part refers to images > etc that are attached only to the text/html part. AFAICT from RFC > 2387 it ought to be possible to put the multipart/related part at the > top so both text/html and text/plain can refer to it.) Is there a text part format that can actually refer to related parts? text/plain isn't one, as far as I know. As I said in another message, it is worth thinking about supporting more unusual structures. The tradeoff is not getting an error when you do something that is in most cases a mistake. Absent information about a reasonably common text format that actually embeds images, I'm inclined to keep the restriction. We can always remove it later, but we can't add it back later. > > with open('police-report.txt') as report: > > fullmsg.add_attachment(report.read(), filename='p????lice-report.txt', > > params=dict(wrap='flow'), headers=( > > 'X-Secret-Level: top', > > 'X-Authorization: Monty')) > > I can't find an RFC that specifies a "wrap" parameter to text/plain. > Do you mean RFC 2646 'format="flowed"' here? Yes, I did. I just didn't bother to look it up (my apologies), since the point of the example was that you could add arbitrary extra parameters. > (A "validate" method could raise a warning on unregistered parameters.) Yes, which if we want it to happen at the time the parameter is set, means we probably want a custom (extendible) mechanism for this in the policy. > > (Hmm. Looking at that I see I didn't fully fix a bug I had meant to fix: > > some of the parts have a MIME-Version header that don't need it.) > > Another reason why the top-level part should be treated differently in > the API. True. And if we add MIMEPart but keep MIMEMessage as the top level part rather than re-using the existing Message, we can make the MIMEMessage policy strict by default. --David From eliben at gmail.com Mon Sep 2 00:57:02 2013 From: eliben at gmail.com (Eli Bendersky) Date: Sun, 1 Sep 2013 15:57:02 -0700 Subject: [Python-Dev] [Python-checkins] cpython: Further reduce the cost of hash collisions by inspecting an additional nearby In-Reply-To: <3cSLzl490rzSc9@mail.python.org> References: <3cSLzl490rzSc9@mail.python.org> Message-ID: On Sat, Aug 31, 2013 at 9:29 PM, raymond.hettinger < python-checkins at python.org> wrote: > http://hg.python.org/cpython/rev/d40a65658ff0 > changeset: 85486:d40a65658ff0 > parent: 85482:4d604f1f0219 > user: Raymond Hettinger > date: Sat Aug 31 21:27:08 2013 -0700 > summary: > Further reduce the cost of hash collisions by inspecting an additional > nearby entry. > Hi Raymond, I'm curious about the benchmarks used to test such micro-optimizations. Do you use one of the existing Python benchmark suites or do you have a particular set of micro-benchmarks you're running this on? Eli > > files: > Objects/setobject.c | 43 +++++++++++++++++++++++++++++--- > 1 files changed, 39 insertions(+), 4 deletions(-) > > > diff --git a/Objects/setobject.c b/Objects/setobject.c > --- a/Objects/setobject.c > +++ b/Objects/setobject.c > @@ -65,10 +65,11 @@ > The initial probe index is computed as hash mod the table size. Subsequent > probe indices are computed as explained in Objects/dictobject.c. > > -To improve cache locality, each probe is done in pairs. > -After the probe is examined, an adjacent entry is then examined as well. > -The likelihood is that an adjacent entry is in the same cache line and > -can be examined more cheaply than another probe elsewhere in memory. > +To improve cache locality, each probe inspects nearby entries before > +moving on to probes elsewhere in memory. Depending on alignment and the > +size of a cache line, the nearby entries are cheaper to inspect than > +other probes elsewhere in memory. This probe strategy reduces the cost > +of hash collisions. > > All arithmetic on hash should ignore overflow. > > @@ -130,6 +131,26 @@ > if (entry->key == dummy && freeslot == NULL) > freeslot = entry; > > + entry = &table[j ^ 2]; > + if (entry->key == NULL) > + break; > + if (entry->key == key) > + return entry; > + if (entry->hash == hash && entry->key != dummy) { > + PyObject *startkey = entry->key; > + Py_INCREF(startkey); > + cmp = PyObject_RichCompareBool(startkey, key, Py_EQ); > + Py_DECREF(startkey); > + if (cmp < 0) > + return NULL; > + if (table != so->table || entry->key != startkey) > + return set_lookkey(so, key, hash); > + if (cmp > 0) > + return entry; > + } > + if (entry->key == dummy && freeslot == NULL) > + freeslot = entry; > + > i = i * 5 + perturb + 1; > j = i & mask; > perturb >>= PERTURB_SHIFT; > @@ -190,6 +211,17 @@ > if (entry->key == dummy && freeslot == NULL) > freeslot = entry; > > + entry = &table[j ^ 2]; > + if (entry->key == NULL) > + break; > + if (entry->key == key > + || (entry->hash == hash > + && entry->key != dummy > + && unicode_eq(entry->key, key))) > + return entry; > + if (entry->key == dummy && freeslot == NULL) > + freeslot = entry; > + > i = i * 5 + perturb + 1; > j = i & mask; > perturb >>= PERTURB_SHIFT; > @@ -258,6 +290,9 @@ > entry = &table[j ^ 1]; > if (entry->key == NULL) > break; > + entry = &table[j ^ 2]; > + if (entry->key == NULL) > + break; > i = i * 5 + perturb + 1; > j = i & mask; > perturb >>= PERTURB_SHIFT; > > -- > Repository URL: http://hg.python.org/cpython > > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From eliben at gmail.com Mon Sep 2 00:58:54 2013 From: eliben at gmail.com (Eli Bendersky) Date: Sun, 1 Sep 2013 15:58:54 -0700 Subject: [Python-Dev] [Python-checkins] cpython: Issue #11798: fix tests for regrtest -R : In-Reply-To: <3cSMds1ZCzzPrk@mail.python.org> References: <3cSMds1ZCzzPrk@mail.python.org> Message-ID: On Sat, Aug 31, 2013 at 9:58 PM, andrew.svetlov wrote: > http://hg.python.org/cpython/rev/39781c3737f8 > changeset: 85490:39781c3737f8 > user: Andrew Svetlov > date: Sun Sep 01 07:58:41 2013 +0300 > summary: > Issue #11798: fix tests for regrtest -R : > > files: > Lib/test/regrtest.py | 5 +++++ > Lib/unittest/suite.py | 8 ++++++-- > Lib/unittest/test/test_suite.py | 8 ++++++++ > 3 files changed, 19 insertions(+), 2 deletions(-) > > > Hi Andrew, It would help if you could add more details into the commit message. This would make both post-commit reviews and future code archeology simpler. Eli > diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py > --- a/Lib/test/regrtest.py > +++ b/Lib/test/regrtest.py > @@ -496,6 +496,8 @@ > > if ns.slaveargs is not None: > args, kwargs = json.loads(ns.slaveargs) > + if kwargs.get('huntrleaks'): > + unittest.BaseTestSuite._cleanup = False > try: > result = runtest(*args, **kwargs) > except KeyboardInterrupt: > @@ -528,6 +530,9 @@ > #gc.set_debug(gc.DEBUG_SAVEALL) > found_garbage = [] > > + if ns.huntrleaks: > + unittest.BaseTestSuite._cleanup = False > + > if ns.single: > filename = os.path.join(TEMPDIR, 'pynexttest') > try: > diff --git a/Lib/unittest/suite.py b/Lib/unittest/suite.py > --- a/Lib/unittest/suite.py > +++ b/Lib/unittest/suite.py > @@ -16,6 +16,8 @@ > class BaseTestSuite(object): > """A simple test suite that doesn't provide class or module shared > fixtures. > """ > + _cleanup = True > + > def __init__(self, tests=()): > self._tests = [] > self.addTests(tests) > @@ -61,7 +63,8 @@ > if result.shouldStop: > break > test(result) > - self._removeTestAtIndex(index) > + if self._cleanup: > + self._removeTestAtIndex(index) > return result > > def _removeTestAtIndex(self, index): > @@ -115,7 +118,8 @@ > else: > test.debug() > > - self._removeTestAtIndex(index) > + if self._cleanup: > + self._removeTestAtIndex(index) > > if topLevel: > self._tearDownPreviousClass(None, result) > diff --git a/Lib/unittest/test/test_suite.py > b/Lib/unittest/test/test_suite.py > --- a/Lib/unittest/test/test_suite.py > +++ b/Lib/unittest/test/test_suite.py > @@ -303,6 +303,9 @@ > suite.run(unittest.TestResult()) > > def test_remove_test_at_index(self): > + if not unittest.BaseTestSuite._cleanup: > + raise unittest.SkipTest("Suite cleanup is disabled") > + > suite = unittest.TestSuite() > > suite._tests = [1, 2, 3] > @@ -311,6 +314,9 @@ > self.assertEqual([1, None, 3], suite._tests) > > def test_remove_test_at_index_not_indexable(self): > + if not unittest.BaseTestSuite._cleanup: > + raise unittest.SkipTest("Suite cleanup is disabled") > + > suite = unittest.TestSuite() > suite._tests = None > > @@ -318,6 +324,8 @@ > suite._removeTestAtIndex(2) > > def assert_garbage_collect_test_after_run(self, TestSuiteClass): > + if not unittest.BaseTestSuite._cleanup: > + raise unittest.SkipTest("Suite cleanup is disabled") > > class Foo(unittest.TestCase): > def test_nothing(self): > > -- > Repository URL: http://hg.python.org/cpython > > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From eliben at gmail.com Mon Sep 2 00:59:12 2013 From: eliben at gmail.com (Eli Bendersky) Date: Sun, 1 Sep 2013 15:59:12 -0700 Subject: [Python-Dev] [Python-checkins] cpython: Update whatsnew/3.4.rst wrt. the socket constants switch to IntEnum In-Reply-To: <522281B1.50004@udel.edu> References: <3cSBmf31XfzPkT@mail.python.org> <522281B1.50004@udel.edu> Message-ID: On Sat, Aug 31, 2013 at 4:52 PM, Terry Reedy wrote: > On 8/31/2013 6:19 PM, eli.bendersky wrote: > >> http://hg.python.org/cpython/**rev/4d604f1f0219 >> changeset: 85482:4d604f1f0219 >> user: Eli Bendersky >> date: Sat Aug 31 15:18:48 2013 -0700 >> summary: >> Update whatsnew/3.4.rst wrt. the socket constants switch to IntEnum >> >> [issue #18730] >> > > > Wrong issue number I think. > _______________________________________________ > Oops, yes. Sorry about that. Eli -------------- next part -------------- An HTML attachment was scrubbed... URL: From v+python at g.nevcal.com Mon Sep 2 01:08:18 2013 From: v+python at g.nevcal.com (Glenn Linderman) Date: Sun, 01 Sep 2013 16:08:18 -0700 Subject: [Python-Dev] Completing the email6 API changes. In-Reply-To: <20130901221040.DC76E250818@webabinitio.net> References: <20130831052136.42D4B2507F5@webabinitio.net> <87bo4echcr.fsf@uwakimon.sk.tsukuba.ac.jp> <20130901221040.DC76E250818@webabinitio.net> Message-ID: <5223C8E2.2000006@g.nevcal.com> On 9/1/2013 3:10 PM, R. David Murray wrote: > This doesn't work, though, because you could (although you usually > won't) have more than one 'text/html' part in a single multipart. I was traveling and your original message is still unread in my queue of "things to look at later" :( I haven't caught up with old stuff yet, but am trying to stay current on current stuff... The quoted issue was mentioned in another message in this thread, though in different terms. I recall being surprised when first seeing messages generated by Apple Mail software, that are multipart/related, having a sequence of intermixed text/plain and image/jpeg parts. This is apparently how Apple Mail generates messages that have inline pictures, without resorting to use of HTML mail. Other email clients handle this relatively better or worse, depending on the expectations of their authors! Several of them treat all the parts after the initial text/html part as attachments; some of them display inline attachments if they are text/html or image/jpeg and others do not. I can't say for sure if there are other ways they are treated; I rather imagine that Apple Mail displays the whole message with interspersed pictures quite effectively, without annoying the user with attachment "markup", but I'm not an Apple Mail user so I couldn't say for sure. You should, of course, ensure that it is possible to create such a message. Whether Apple Mail does that with other embedded image/* formats, or with other text/* formats, or other non-image, non-text formats, I couldn't say. I did attempt to determine if it was non-standard usage: it is certainly non-common usage, but I found nothing in the email/MIME RFCs that precludes such usage. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tjreedy at udel.edu Mon Sep 2 01:25:31 2013 From: tjreedy at udel.edu (Terry Reedy) Date: Sun, 01 Sep 2013 19:25:31 -0400 Subject: [Python-Dev] cpython (merge 3.3 -> default): Merge fix from 3.3 into default. In-Reply-To: <20130901230414.44af5426@fsol> References: <3cSn1P710Hz7LjX@mail.python.org> <20130901230414.44af5426@fsol> Message-ID: On 9/1/2013 5:04 PM, Antoine Pitrou wrote: > On Sun, 1 Sep 2013 23:02:17 +0200 (CEST) > tim.peters wrote: >> Windows developers: to get the correct line endings in your checkout, >> delete Lib\test\xmltestdata, and then "hg revert" that directory. Or, in Tortoisehg Workbenck, select the four Working Directory patch entries, right click, and revert. >> Why the Windows buildbots didn't fail test_sax remains a mystery :-( > > Probably because they don't have the hgeol extension enabled. Since the tests also failed on installed Python, it seems that the .msi installer is created in a repository with the extension enabled. If so, I think that the buildbots should have the extension enabled also, so that they are testing Python as it will be distributed. Or we could stop supporting Notepad and change what we distribute ;-). -- Terry Jan Reedy From tjreedy at udel.edu Mon Sep 2 01:38:58 2013 From: tjreedy at udel.edu (Terry Reedy) Date: Sun, 01 Sep 2013 19:38:58 -0400 Subject: [Python-Dev] 'Subinterpreter' (was Re: Pre-PEP: Redesigning extension modules) In-Reply-To: References: <20130823111822.49cba700@pitrou.net> <20130901150351.2f2aa44c@fsol> <20130901194048.0d7d1b75@fsol> <20130901220649.3e9c3ab4@fsol> Message-ID: On 9/1/2013 5:13 PM, Stefan Behnel wrote: > Antoine Pitrou, 01.09.2013 22:06: >> On Sun, 01 Sep 2013 16:02:33 -0400 >> Terry Reedy wrote: >>>> Speaking of which, it also doesn't work (well) with subinterpreters: >>> >>> Could someone briefly explain 'subinterpreter' or point me somewhere in >>> the docs? It appears throughout this thread but there is no index or >>> glossary entry. >> >> http://docs.python.org/dev/c-api/init.html#sub-interpreter-support So cpython specific. >> Subinterpreters are a somewhat borderline feature that allows embedding >> applications to host multiple Python programs in a single process. A >> well-known example is mod_wsgi. Thank you for both the link *and* the explanatory example, which just what I needed to make the past discussion more intelligible. I imagine that wsgi uses a sub-interpreter for each user connection. > And extension modules usually don't play well with subinterpreters because > each subinterpreter requires its own separate version of the module and > extension modules are rarely designed to keep their state completely local > to an interpreter, let alone being prepared for having their module init > function be called more than once. I can see now why this is a bit of a 'hair-puller';-). -- Terry Jan Reedy From tjreedy at udel.edu Mon Sep 2 01:42:10 2013 From: tjreedy at udel.edu (Terry Reedy) Date: Sun, 01 Sep 2013 19:42:10 -0400 Subject: [Python-Dev] [Python-checkins] cpython: Update whatsnew/3.4.rst wrt. the socket constants switch to IntEnum In-Reply-To: References: <3cSBmf31XfzPkT@mail.python.org> <522281B1.50004@udel.edu> Message-ID: On 9/1/2013 6:59 PM, Eli Bendersky wrote: > > > > On Sat, Aug 31, 2013 at 4:52 PM, Terry Reedy > wrote: > > On 8/31/2013 6:19 PM, eli.bendersky wrote: > [issue #18730] > Wrong issue number I think. > _______________________________________________ > > > Oops, yes. Sorry about that. I unlinked it from 18730. -- Terry Jan Reedy From eliben at gmail.com Mon Sep 2 03:02:30 2013 From: eliben at gmail.com (Eli Bendersky) Date: Sun, 1 Sep 2013 18:02:30 -0700 Subject: [Python-Dev] SEEK_* constants in io and os Message-ID: Hello, I was looking at the possibility of replacing the SEEK_* constants by IntEnums, and the first thing that catches attention is that these constants are defined in both Lib/os.py and Lib/io.py; both places also recently started supporting SEEK_HOLE and SEEK_DATA (though here io refers to os.SEEK_HOLE and os.SEEK_DATA). Additional data points: other modules take these constants as arguments - * mmap: directs to use os.SEEK_* * chunk and fcntk: spell out the numeric values. os seems to import io in some functions; can this be done always? If yes, we can just define the constants once and os.SEEK_* will alias io.SEEK_*? The other way (io taking from os) is also a possibility (maybe the preferred one because io already refers to os.SEEK_HOLE/DATA, at least in the documentation). Any ideas and suggestions are welcome, Eli -------------- next part -------------- An HTML attachment was scrubbed... URL: From db3l.net at gmail.com Mon Sep 2 03:08:57 2013 From: db3l.net at gmail.com (David Bolen) Date: Sun, 01 Sep 2013 21:08:57 -0400 Subject: [Python-Dev] cpython (merge 3.3 -> default): Merge fix from 3.3 into default. References: <3cSn1P710Hz7LjX@mail.python.org> <20130901230414.44af5426@fsol> Message-ID: Terry Reedy writes: > On 9/1/2013 5:04 PM, Antoine Pitrou wrote: >> Probably because they don't have the hgeol extension enabled. Yes, I believe that's correct, at least for my Windows buildbots. > Since the tests also failed on installed Python, it seems that the > .msi installer is created in a repository with the extension > enabled. If so, I think that the buildbots should have the extension > enabled also, so that they are testing Python as it will be > distributed. If it should be enabled, I believe it will have to be done globally, so affecting all buildbot branches (not that it sounds like that would be an issue). The individual branch repositories are physically removed at times (such as during a failure to update, which escalates to a removal followed by full clone, as well as I believe during a custom build), so I don't believe persistent local changes to the repository's own hgrc are possible in a reliable way. In the event we did want per-repository control, then I think we'd need to have some sort of additional script that ran as part of the buildbot build process to ensure the right contents for the local repository hgrc following a clone, or just prior to the update step. -- David From andrew.svetlov at gmail.com Mon Sep 2 04:37:20 2013 From: andrew.svetlov at gmail.com (Andrew Svetlov) Date: Mon, 2 Sep 2013 05:37:20 +0300 Subject: [Python-Dev] [Python-checkins] cpython: Issue #11798: fix tests for regrtest -R : In-Reply-To: References: <3cSMds1ZCzzPrk@mail.python.org> Message-ID: regrtest -R runs test suites several times. That's why test cleanup should be disabled for this case. Details discussed in issue. I'll do more expressive commit messages next time. Thanks. On Mon, Sep 2, 2013 at 1:58 AM, Eli Bendersky wrote: > > > > On Sat, Aug 31, 2013 at 9:58 PM, andrew.svetlov > wrote: >> >> http://hg.python.org/cpython/rev/39781c3737f8 >> changeset: 85490:39781c3737f8 >> user: Andrew Svetlov >> date: Sun Sep 01 07:58:41 2013 +0300 >> summary: >> Issue #11798: fix tests for regrtest -R : >> >> files: >> Lib/test/regrtest.py | 5 +++++ >> Lib/unittest/suite.py | 8 ++++++-- >> Lib/unittest/test/test_suite.py | 8 ++++++++ >> 3 files changed, 19 insertions(+), 2 deletions(-) >> >> > > Hi Andrew, > > It would help if you could add more details into the commit message. This > would make both post-commit reviews and future code archeology simpler. > > Eli > > >> >> diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py >> --- a/Lib/test/regrtest.py >> +++ b/Lib/test/regrtest.py >> @@ -496,6 +496,8 @@ >> >> if ns.slaveargs is not None: >> args, kwargs = json.loads(ns.slaveargs) >> + if kwargs.get('huntrleaks'): >> + unittest.BaseTestSuite._cleanup = False >> try: >> result = runtest(*args, **kwargs) >> except KeyboardInterrupt: >> @@ -528,6 +530,9 @@ >> #gc.set_debug(gc.DEBUG_SAVEALL) >> found_garbage = [] >> >> + if ns.huntrleaks: >> + unittest.BaseTestSuite._cleanup = False >> + >> if ns.single: >> filename = os.path.join(TEMPDIR, 'pynexttest') >> try: >> diff --git a/Lib/unittest/suite.py b/Lib/unittest/suite.py >> --- a/Lib/unittest/suite.py >> +++ b/Lib/unittest/suite.py >> @@ -16,6 +16,8 @@ >> class BaseTestSuite(object): >> """A simple test suite that doesn't provide class or module shared >> fixtures. >> """ >> + _cleanup = True >> + >> def __init__(self, tests=()): >> self._tests = [] >> self.addTests(tests) >> @@ -61,7 +63,8 @@ >> if result.shouldStop: >> break >> test(result) >> - self._removeTestAtIndex(index) >> + if self._cleanup: >> + self._removeTestAtIndex(index) >> return result >> >> def _removeTestAtIndex(self, index): >> @@ -115,7 +118,8 @@ >> else: >> test.debug() >> >> - self._removeTestAtIndex(index) >> + if self._cleanup: >> + self._removeTestAtIndex(index) >> >> if topLevel: >> self._tearDownPreviousClass(None, result) >> diff --git a/Lib/unittest/test/test_suite.py >> b/Lib/unittest/test/test_suite.py >> --- a/Lib/unittest/test/test_suite.py >> +++ b/Lib/unittest/test/test_suite.py >> @@ -303,6 +303,9 @@ >> suite.run(unittest.TestResult()) >> >> def test_remove_test_at_index(self): >> + if not unittest.BaseTestSuite._cleanup: >> + raise unittest.SkipTest("Suite cleanup is disabled") >> + >> suite = unittest.TestSuite() >> >> suite._tests = [1, 2, 3] >> @@ -311,6 +314,9 @@ >> self.assertEqual([1, None, 3], suite._tests) >> >> def test_remove_test_at_index_not_indexable(self): >> + if not unittest.BaseTestSuite._cleanup: >> + raise unittest.SkipTest("Suite cleanup is disabled") >> + >> suite = unittest.TestSuite() >> suite._tests = None >> >> @@ -318,6 +324,8 @@ >> suite._removeTestAtIndex(2) >> >> def assert_garbage_collect_test_after_run(self, TestSuiteClass): >> + if not unittest.BaseTestSuite._cleanup: >> + raise unittest.SkipTest("Suite cleanup is disabled") >> >> class Foo(unittest.TestCase): >> def test_nothing(self): >> >> -- >> Repository URL: http://hg.python.org/cpython >> >> _______________________________________________ >> Python-checkins mailing list >> Python-checkins at python.org >> http://mail.python.org/mailman/listinfo/python-checkins >> > > > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/andrew.svetlov%40gmail.com > -- Thanks, Andrew Svetlov From stephen at xemacs.org Mon Sep 2 05:03:40 2013 From: stephen at xemacs.org (Stephen J. Turnbull) Date: Mon, 02 Sep 2013 12:03:40 +0900 Subject: [Python-Dev] Completing the email6 API changes. In-Reply-To: <5223C8E2.2000006@g.nevcal.com> References: <20130831052136.42D4B2507F5@webabinitio.net> <87bo4echcr.fsf@uwakimon.sk.tsukuba.ac.jp> <20130901221040.DC76E250818@webabinitio.net> <5223C8E2.2000006@g.nevcal.com> Message-ID: <874na3diwj.fsf@uwakimon.sk.tsukuba.ac.jp> This is getting off-topic IMO; we should probably take this thread to email-sig. Glenn Linderman writes: > I recall being surprised when first seeing messages generated by > Apple Mail software, that are multipart/related, having a sequence > of intermixed text/plain and image/jpeg parts. This is apparently > how Apple Mail generates messages that have inline pictures, > without resorting to use of HTML mail. (Are you sure you mean "text/plain" above? I've not seen this form of message. And you mention only "text/html" below.) This practice (like my suggestion) is based on the conjecture that MUAs that implement multipart/related will treat it as multipart/mixed if the "main" subpart isn't known to implement links to external entities. > Other email clients handle this relatively better or worse, > depending on the expectations of their authors! Sure. After all, this is a world in which some MUAs have a long history of happily executing virus executables. > I did attempt to determine if it was non-standard usage: it is > certainly non-common usage, but I found nothing in the email/MIME > RFCs that precludes such usage. Clearly RFCs 2046 and 2387 envision a fallback to multipart/mixed, but are silent on how to do it for MUAs that implement multipart/related. RFC 2387 says: MIME User Agents that do recognize Multipart/Related entities but are unable to process the given type should give the user the option of suppressing the entire Multipart/Related body part shall be. [...] Handling Multipart/Related differs [from handling of existing composite subtypes] in that processing cannot be reduced to handling the individual entities. I think that the sane policy is that when processing multipart/related internally, the MUA should treat the whole as multipart/mixed, unless it knows how links are implemented in the "start" part. But the RFC doesn't say that. > Several of them treat all the parts after the initial text/html > part as attachments; They don't implement RFC 2387 (promoted to draft standard in 1998, following two others, the earlier being RFC 1872 from 1995). Too bad for their users. But what I'm worried about is a different issue, which is how to ensure that multipart/alternative messages present all relevant content entities in both presentations. For example, the following hypothetical structure is efficient: multipart/alternative text/plain multipart/related text/html application/x-opentype-font because the text/plain can't use the font. But this multipart/alternative text/plain multipart/related text/html image/png image/png often cost the text/plain receiver a view of the images, and I don't see any way to distinguish the two cases. (The images might be character glyphs, for example, effectively a "poor man's font".) OTOH, if the message is structured multipart/related multipart/alternative text/plain text/html image/png image/png the receiver can infer that the images are related to both text/* parts and DTRT for each. Steve From v+python at g.nevcal.com Mon Sep 2 07:55:58 2013 From: v+python at g.nevcal.com (Glenn Linderman) Date: Sun, 01 Sep 2013 22:55:58 -0700 Subject: [Python-Dev] Completing the email6 API changes. In-Reply-To: <874na3diwj.fsf@uwakimon.sk.tsukuba.ac.jp> References: <20130831052136.42D4B2507F5@webabinitio.net> <87bo4echcr.fsf@uwakimon.sk.tsukuba.ac.jp> <20130901221040.DC76E250818@webabinitio.net> <5223C8E2.2000006@g.nevcal.com> <874na3diwj.fsf@uwakimon.sk.tsukuba.ac.jp> Message-ID: <5224286E.4040409@g.nevcal.com> On 9/1/2013 8:03 PM, Stephen J. Turnbull wrote: > This is getting off-topic IMO; we should probably take this thread to > email-sig. Probably, but you didn't :) > Glenn Linderman writes: > > > I recall being surprised when first seeing messages generated by > > Apple Mail software, that are multipart/related, having a sequence > > of intermixed text/plain and image/jpeg parts. This is apparently > > how Apple Mail generates messages that have inline pictures, > > without resorting to use of HTML mail. > > (Are you sure you mean "text/plain" above? I've not seen this form of > message. And you mention only "text/html" below.) Yes, I'm sure it was text/plain. I may be able to access the archived discussion from a non-Python mailing list about it, to verify, if that becomes important. But now that you mention mulitpart/mixed, I'm not sure if it was multipart/related or mulitpart/mixed for the grouping MIME part. Perhaps someone with Apple Mail could produce one... probably by composing a message as text/plain, and dragging in a picture or two. The other references to text/html was in error. > This practice (like my suggestion) is based on the conjecture that > MUAs that implement multipart/related will treat it as multipart/mixed > if the "main" subpart isn't known to implement links to external > entities. > > > Other email clients handle this relatively better or worse, > > depending on the expectations of their authors! > > Sure. After all, this is a world in which some MUAs have a long > history of happily executing virus executables. > > > I did attempt to determine if it was non-standard usage: it is > > certainly non-common usage, but I found nothing in the email/MIME > > RFCs that precludes such usage. > > Clearly RFCs 2046 and 2387 envision a fallback to multipart/mixed, but > are silent on how to do it for MUAs that implement multipart/related. > RFC 2387 says: > > MIME User Agents that do recognize Multipart/Related entities but > are unable to process the given type should give the user the > option of suppressing the entire Multipart/Related body part shall > be. [...] Handling Multipart/Related differs [from handling of > existing composite subtypes] in that processing cannot be reduced > to handling the individual entities. > > I think that the sane policy is that when processing multipart/related > internally, the MUA should treat the whole as multipart/mixed, unless > it knows how links are implemented in the "start" part. But the RFC > doesn't say that. > > > Several of them treat all the parts after the initial text/html > > part as attachments; > > They don't implement RFC 2387 (promoted to draft standard in 1998, > following two others, the earlier being RFC 1872 from 1995). Too bad > for their users. Correct... but the MUA receiving the Apple Mail message I was talking about being a text-mostly MUA, it is probably a reasonable method of handling them. > But what I'm worried about is a different issue, > which is how to ensure that multipart/alternative messages present all > relevant content entities in both presentations. For example, the > following hypothetical structure is efficient: > > multipart/alternative > text/plain > multipart/related > text/html > application/x-opentype-font > > because the text/plain can't use the font. But this > > multipart/alternative > text/plain > multipart/related > text/html > image/png > image/png > > often cost the text/plain receiver a view of the images, and I don't > see any way to distinguish the two cases. (The images might be > character glyphs, for example, effectively a "poor man's font".) Yes, that issue is handled by some text MUA by showing the image/png (or anything in such a position) as attachments. Again, being text-mostly, that might be a reasonable way of handling them. Perhaps the standard says they should be ignored, when displaying text/plain alternative. > OTOH, if the message is structured > > multipart/related > multipart/alternative > text/plain > text/html > image/png > image/png > > the receiver can infer that the images are related to both text/* > parts and DTRT for each. > With the images being treated as attachments. Or is there a syntax to allow the text/html to embed the images and the text/plain to see them as attachments? I think the text/html wants to refer to things within its containing multipart/related, but am not sure if that allows the intervening multipart/alternative. -------------- next part -------------- An HTML attachment was scrubbed... URL: From stephen at xemacs.org Mon Sep 2 09:06:53 2013 From: stephen at xemacs.org (Stephen J. Turnbull) Date: Mon, 02 Sep 2013 16:06:53 +0900 Subject: [Python-Dev] Completing the email6 API changes. In-Reply-To: <5224286E.4040409@g.nevcal.com> References: <20130831052136.42D4B2507F5@webabinitio.net> <87bo4echcr.fsf@uwakimon.sk.tsukuba.ac.jp> <20130901221040.DC76E250818@webabinitio.net> <5223C8E2.2000006@g.nevcal.com> <874na3diwj.fsf@uwakimon.sk.tsukuba.ac.jp> <5224286E.4040409@g.nevcal.com> Message-ID: <87y57fbt2q.fsf@uwakimon.sk.tsukuba.ac.jp> >>>>> Glenn writes: > >>>>> Steve writes: >> OTOH, if the message is structured >> >> multipart/related >> multipart/alternative >> text/plain >> text/html >> image/png >> image/png >> >> the receiver can infer that the images are related to both text/* >> parts and DTRT for each. >With the images being treated as attachments. Or is there a syntax to >allow the text/html to embed the images and the text/plain to see them >as attachments? I believe the above is that syntax. But the standard doesn't say anything about this. The standard for multipart/alternative is RFC 2046, which doesn't know about multipart/related. RFC 2387 doesn't update RFC 2046, so it doesn't say anything about multipart/alternative within multipart/related, either. >I think the text/html wants to refer to things within its containing >multipart/related, but am not sure if that allows the intervening >multipart/alternative. I don't see why not. But it would depend on the implementations, which we'll have to test before recommending the structure I (theoretically :-) prefer.e From solipsis at pitrou.net Mon Sep 2 10:16:42 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Mon, 2 Sep 2013 10:16:42 +0200 Subject: [Python-Dev] Pre-PEP: Redesigning extension modules References: Message-ID: <20130902101642.04b69588@pitrou.net> Le Sun, 1 Sep 2013 02:19:48 +1000, Nick Coghlan a ?crit : > On 1 Sep 2013 00:10, "Stefan Behnel" wrote: > > > > *bump* > > > > Does this sound like a viable solution? > > This isn't likely to progress until we have Eric's PEP 451 to a point > where it's ready for python-dev discussion and pronouncement. > > However, the revised loader API is being designed to allow for the > loader returning arbitrary objects, so something along these lines > should work. There will likely be some adjustments to the API > signature to allow extension modules to optionally support reloading > if they so desire. I think the biggest challenge here is to propose an API that's simple and easy to use (i.e. that doesn't make extension module writing more complicated than it currently is). The basic concept of putting custom module objects in sys.modules is sound, IMHO. As for "extension module as a wrapper", though, it shounds like the kind of complication I would personally prefer to stay away from. Also, it would make extension modules less like Python modules, rather than more. Regards Antoine. > > Cheers, > Nick. > > > > > Stefan > > > > > > Stefan Behnel, 25.08.2013 14:36: > > > Hi, > > > > > > thanks for bringing this up. It clearly shows that there is more > > > to this problem than I initially thought. > > > > > > Let me just add one idea that your post gave me. > > > > > > PJ Eby, 25.08.2013 06:12: > > >> My "Importing" package offers lazy imports by creating module > > >> objects in sys.modules that are a subtype of ModuleType, and use > > >> a __getattribute__ hook so that trying to use them fires off a > > >> reload() of the module. > > > > > > I wonder if this wouldn't be an approach to fix the reloading > > > problem in general. What if extension module loading, at least > > > with the new scheme, didn't return the module object itself and > > > put it into sys.modules but created a wrapper that redirects its > > > __getattr__ and __setattr__ to the actual module object? That > > > would have a tiny performance impact on attribute access, but I'd > > > expect that to be negligible given that the > usual > > > reason for the extension module to exist is that it does > > > non-trivial > stuff > > > in whatever its API provides. Reloading could then really create a > > > completely new module object and replace the reference inside of > > > the > wrapper. > > > > > > That way, code that currently uses "from extmodule import xyz" > > > would continue to see the original version of the module as of > > > the time of its import, and code that just did "import extmodule" > > > and then used > attribute > > > access at need would always see the current content of the module > > > as it > was > > > last loaded. I think that, together with keeping module global > > > state in > the > > > module object itself, would nicely fix both cases. > > > > > > Stefan > > > > > > _______________________________________________ > > Python-Dev mailing list > > Python-Dev at python.org > > http://mail.python.org/mailman/listinfo/python-dev > > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com > From solipsis at pitrou.net Mon Sep 2 10:18:17 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Mon, 2 Sep 2013 10:18:17 +0200 Subject: [Python-Dev] Add a new tracemalloc module to trace memory allocations References: Message-ID: <20130902101817.1a6d1c5d@pitrou.net> Le Sun, 1 Sep 2013 11:36:51 +1000, Nick Coghlan a ?crit : > +1 from me for both tracemalloc and failmalloc in the same vein as > faulthandler (and using similar API concepts to faulthandler). > > While I like the flat top level naming structure, we should clearly > document these as implementation dependent runtime services. Other > implementations may not provide them at all, and even if they do, many > details will likely be different. So, it sounds like Victor may write a new PEP soon :-) +1 from me on a flat namespace. Non-designed naming hierarchies are just a pain to work with. Regards Antoine. From solipsis at pitrou.net Mon Sep 2 10:24:37 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Mon, 2 Sep 2013 10:24:37 +0200 Subject: [Python-Dev] SEEK_* constants in io and os References: Message-ID: <20130902102437.197c1708@pitrou.net> Le Sun, 1 Sep 2013 18:02:30 -0700, Eli Bendersky a ?crit : > Hello, > > I was looking at the possibility of replacing the SEEK_* constants by > IntEnums, and the first thing that catches attention is that these > constants are defined in both Lib/os.py and Lib/io.py; both places > also recently started supporting SEEK_HOLE and SEEK_DATA (though here > io refers to os.SEEK_HOLE and os.SEEK_DATA). What is the runtime cost of doing so? os is a fundamental module that is imported by almost every Python program. Regards Antoine. From ncoghlan at gmail.com Mon Sep 2 15:02:24 2013 From: ncoghlan at gmail.com (Nick Coghlan) Date: Mon, 2 Sep 2013 23:02:24 +1000 Subject: [Python-Dev] Pre-PEP: Redesigning extension modules In-Reply-To: <20130902101642.04b69588@pitrou.net> References: <20130902101642.04b69588@pitrou.net> Message-ID: On 2 September 2013 18:16, Antoine Pitrou wrote: > Le Sun, 1 Sep 2013 02:19:48 +1000, > Nick Coghlan a ?crit : >> On 1 Sep 2013 00:10, "Stefan Behnel" wrote: >> > >> > *bump* >> > >> > Does this sound like a viable solution? >> >> This isn't likely to progress until we have Eric's PEP 451 to a point >> where it's ready for python-dev discussion and pronouncement. >> >> However, the revised loader API is being designed to allow for the >> loader returning arbitrary objects, so something along these lines >> should work. There will likely be some adjustments to the API >> signature to allow extension modules to optionally support reloading >> if they so desire. > > I think the biggest challenge here is to propose an API that's simple > and easy to use (i.e. that doesn't make extension module writing more > complicated than it currently is). > > The basic concept of putting custom module objects in sys.modules is > sound, IMHO. The hook API I currently have in mind is a two step initialisation: PyImport_PrepareNAME (optional) PyImport_ExecNAME If you don't define prepare, the import system takes care of creating a module object for you, and passing it in to the exec hook. The return result from that is just an integer indicating success or failure (on failure, an exception should be set). If you *do* define the prepare hook, then it's similar to the existing init hook, but receives a PEP 451 module spec object with info about the module being imported (see PEP 451 for the draft details) and is permitted to return an arbitrary PyObject reference. The main open questions I have are how to deal with clearly indicating whether modules support in-place reloading, unloading, loading in subinterpreters and/or loading a second copy in the same interpreter. That's actually more a question for PEP 451 though, so I'll post some more detailed thoughts on that over on import-sig, which may eventually make their way into a PEP 451 draft. > As for "extension module as a wrapper", though, it shounds like the > kind of complication I would personally prefer to stay away from. Also, > it would make extension modules less like Python modules, rather than > more. Yeah, that will be allowed (since we'll probably permit returning arbitrary objects), but definitely not required. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia From eliben at gmail.com Mon Sep 2 15:18:31 2013 From: eliben at gmail.com (Eli Bendersky) Date: Mon, 2 Sep 2013 06:18:31 -0700 Subject: [Python-Dev] SEEK_* constants in io and os In-Reply-To: <20130902102437.197c1708@pitrou.net> References: <20130902102437.197c1708@pitrou.net> Message-ID: On Mon, Sep 2, 2013 at 1:24 AM, Antoine Pitrou wrote: > Le Sun, 1 Sep 2013 18:02:30 -0700, > Eli Bendersky a ?crit : > > Hello, > > > > I was looking at the possibility of replacing the SEEK_* constants by > > IntEnums, and the first thing that catches attention is that these > > constants are defined in both Lib/os.py and Lib/io.py; both places > > also recently started supporting SEEK_HOLE and SEEK_DATA (though here > > io refers to os.SEEK_HOLE and os.SEEK_DATA). > > What is the runtime cost of doing so? os is a fundamental module that is > imported by almost every Python program. > Theoretically, it should be very low given that we just need to add an import and define one class. os already does a number of things in its toplevel (mostly a few imports which transitively do other things). Compounded with import caching, since this is done just once per run, doesn't seem like a problem. Empirically, I tried measuring it but I can't discern a difference with/without translating SEEK_* to enums. There's a fluctuation of ~1usec which I can't distinguish from noise. Let me know if you have a good methodology of benchmarking these things Eli -------------- next part -------------- An HTML attachment was scrubbed... URL: From solipsis at pitrou.net Mon Sep 2 15:45:22 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Mon, 2 Sep 2013 15:45:22 +0200 Subject: [Python-Dev] SEEK_* constants in io and os References: <20130902102437.197c1708@pitrou.net> Message-ID: <20130902154522.495b1697@pitrou.net> Le Mon, 2 Sep 2013 06:18:31 -0700, Eli Bendersky a ?crit : > On Mon, Sep 2, 2013 at 1:24 AM, Antoine Pitrou > wrote: > > > Le Sun, 1 Sep 2013 18:02:30 -0700, > > Eli Bendersky a ?crit : > > > Hello, > > > > > > I was looking at the possibility of replacing the SEEK_* > > > constants by IntEnums, and the first thing that catches attention > > > is that these constants are defined in both Lib/os.py and > > > Lib/io.py; both places also recently started supporting SEEK_HOLE > > > and SEEK_DATA (though here io refers to os.SEEK_HOLE and > > > os.SEEK_DATA). > > > > What is the runtime cost of doing so? os is a fundamental module > > that is imported by almost every Python program. > > > > Theoretically, it should be very low given that we just need to add an > import and define one class. os already does a number of things in its > toplevel (mostly a few imports which transitively do other things). > Compounded with import caching, since this is done just once per run, > doesn't seem like a problem. > > Empirically, I tried measuring it but I can't discern a difference > with/without translating SEEK_* to enums. There's a fluctuation of > ~1usec which I can't distinguish from noise. Let me know if you have > a good methodology of benchmarking these things How did you get that result? You have to remove to "os" from sys.modules before importing it again, otherwise "import os" will simply return the already imported module. Regards Antoine. From solipsis at pitrou.net Mon Sep 2 15:51:09 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Mon, 2 Sep 2013 15:51:09 +0200 Subject: [Python-Dev] SEEK_* constants in io and os References: <20130902102437.197c1708@pitrou.net> <20130902154522.495b1697@pitrou.net> Message-ID: <20130902155109.7da869bd@pitrou.net> Le Mon, 2 Sep 2013 15:45:22 +0200, Antoine Pitrou a ?crit : > Le Mon, 2 Sep 2013 06:18:31 -0700, > Eli Bendersky a ?crit : > > On Mon, Sep 2, 2013 at 1:24 AM, Antoine Pitrou > > wrote: > > > > > Le Sun, 1 Sep 2013 18:02:30 -0700, > > > Eli Bendersky a ?crit : > > > > Hello, > > > > > > > > I was looking at the possibility of replacing the SEEK_* > > > > constants by IntEnums, and the first thing that catches > > > > attention is that these constants are defined in both Lib/os.py > > > > and Lib/io.py; both places also recently started supporting > > > > SEEK_HOLE and SEEK_DATA (though here io refers to os.SEEK_HOLE > > > > and os.SEEK_DATA). > > > > > > What is the runtime cost of doing so? os is a fundamental module > > > that is imported by almost every Python program. > > > > > > > Theoretically, it should be very low given that we just need to add > > an import and define one class. os already does a number of things > > in its toplevel (mostly a few imports which transitively do other > > things). Compounded with import caching, since this is done just > > once per run, doesn't seem like a problem. > > > > Empirically, I tried measuring it but I can't discern a difference > > with/without translating SEEK_* to enums. There's a fluctuation of > > ~1usec which I can't distinguish from noise. Let me know if you have > > a good methodology of benchmarking these things > > How did you get that result? You have to remove to "os" from > sys.modules before importing it again, otherwise "import os" will > simply return the already imported module. Oh and remove "enum" too... Regards Antoine. From eliben at gmail.com Mon Sep 2 16:49:31 2013 From: eliben at gmail.com (Eli Bendersky) Date: Mon, 2 Sep 2013 07:49:31 -0700 Subject: [Python-Dev] SEEK_* constants in io and os In-Reply-To: <20130902155109.7da869bd@pitrou.net> References: <20130902102437.197c1708@pitrou.net> <20130902154522.495b1697@pitrou.net> <20130902155109.7da869bd@pitrou.net> Message-ID: On Mon, Sep 2, 2013 at 6:51 AM, Antoine Pitrou wrote: > Le Mon, 2 Sep 2013 15:45:22 +0200, > Antoine Pitrou a ?crit : > > Le Mon, 2 Sep 2013 06:18:31 -0700, > > Eli Bendersky a ?crit : > > > On Mon, Sep 2, 2013 at 1:24 AM, Antoine Pitrou > > > wrote: > > > > > > > Le Sun, 1 Sep 2013 18:02:30 -0700, > > > > Eli Bendersky a ?crit : > > > > > Hello, > > > > > > > > > > I was looking at the possibility of replacing the SEEK_* > > > > > constants by IntEnums, and the first thing that catches > > > > > attention is that these constants are defined in both Lib/os.py > > > > > and Lib/io.py; both places also recently started supporting > > > > > SEEK_HOLE and SEEK_DATA (though here io refers to os.SEEK_HOLE > > > > > and os.SEEK_DATA). > > > > > > > > What is the runtime cost of doing so? os is a fundamental module > > > > that is imported by almost every Python program. > > > > > > > > > > Theoretically, it should be very low given that we just need to add > > > an import and define one class. os already does a number of things > > > in its toplevel (mostly a few imports which transitively do other > > > things). Compounded with import caching, since this is done just > > > once per run, doesn't seem like a problem. > > > > > > Empirically, I tried measuring it but I can't discern a difference > > > with/without translating SEEK_* to enums. There's a fluctuation of > > > ~1usec which I can't distinguish from noise. Let me know if you have > > > a good methodology of benchmarking these things > > > > How did you get that result? You have to remove to "os" from > > sys.modules before importing it again, otherwise "import os" will > > simply return the already imported module. > > Oh and remove "enum" too... > Yes, now I see a 500 usec difference timed within the Python script. When timing the whole execution of Python: $ sudo nice -n -20 perf stat -r 100 python -c 'import os' It still gets lost in the noise, though. I usually get around 34 ms per run with 1 - 1.5% jitter. Since 1.5% of 34 ms is ~0.5 ms, it's difficult to distinguish the runs clearly. That 0.5 ms seems to be a one-time penalty for the importing of enum (most time goes to importing, not defining the new class based on IntEnum), no matter where/how it's used in the stdlib and the user code. Eli -------------- next part -------------- An HTML attachment was scrubbed... URL: From victor.stinner at gmail.com Mon Sep 2 17:48:01 2013 From: victor.stinner at gmail.com (Victor Stinner) Date: Mon, 2 Sep 2013 17:48:01 +0200 Subject: [Python-Dev] SEEK_* constants in io and os In-Reply-To: References: <20130902102437.197c1708@pitrou.net> <20130902154522.495b1697@pitrou.net> <20130902155109.7da869bd@pitrou.net> Message-ID: 2013/9/2 Eli Bendersky : > Yes, now I see a 500 usec difference timed within the Python script. When > timing the whole execution of Python: (...) Can you please provide the list of imported modules by: python -c 'import sys; print(sys.modules)' For python with default options and for python with -S (no site module) options? And also with your patch? Python should be fast to write "hello world" (or "python -c pass), it's a dummy but common benchmark (to compare Python to other VM / other programming languages). Victor From eliben at gmail.com Mon Sep 2 18:02:00 2013 From: eliben at gmail.com (Eli Bendersky) Date: Mon, 2 Sep 2013 09:02:00 -0700 Subject: [Python-Dev] SEEK_* constants in io and os In-Reply-To: References: <20130902102437.197c1708@pitrou.net> <20130902154522.495b1697@pitrou.net> <20130902155109.7da869bd@pitrou.net> Message-ID: On Mon, Sep 2, 2013 at 8:48 AM, Victor Stinner wrote: > 2013/9/2 Eli Bendersky : > > Yes, now I see a 500 usec difference timed within the Python script. When > > timing the whole execution of Python: (...) > > Can you please provide the list of imported modules by: > python -c 'import sys; print(sys.modules)' > > For python with default options and for python with -S (no site > module) options? And also with your patch? > > Python should be fast to write "hello world" (or "python -c pass), > it's a dummy but common benchmark (to compare Python to other VM / > other programming languages). > The sorted list for both default and -S (they're identical) is http://pastebin.com/4vzSMCu7 - there are 55 entries there, including things like itertools, heapq, functools and collections. With my patch, enum is also added (which makes sense since os is in the list). So the 0.5ms increase for the 34ms runtime kind-of makes sense. Eli -------------- next part -------------- An HTML attachment was scrubbed... URL: From rdmurray at bitdance.com Mon Sep 2 23:40:55 2013 From: rdmurray at bitdance.com (R. David Murray) Date: Mon, 02 Sep 2013 17:40:55 -0400 Subject: [Python-Dev] Completing the email6 API changes. In-Reply-To: <87y57fbt2q.fsf@uwakimon.sk.tsukuba.ac.jp> References: <20130831052136.42D4B2507F5@webabinitio.net> <87bo4echcr.fsf@uwakimon.sk.tsukuba.ac.jp> <20130901221040.DC76E250818@webabinitio.net> <5223C8E2.2000006@g.nevcal.com> <874na3diwj.fsf@uwakimon.sk.tsukuba.ac.jp> <5224286E.4040409@g.nevcal.com> <87y57fbt2q.fsf@uwakimon.sk.tsukuba.ac.jp> Message-ID: <20130902214056.ADC342502EA@webabinitio.net> On Mon, 02 Sep 2013 16:06:53 +0900, "Stephen J. Turnbull" wrote: > >>>>> Glenn writes: > > >>>>> Steve writes: > > >> OTOH, if the message is structured > >> > >> multipart/related > >> multipart/alternative > >> text/plain > >> text/html > >> image/png > >> image/png > >> > >> the receiver can infer that the images are related to both text/* > >> parts and DTRT for each. > > >With the images being treated as attachments. Or is there a syntax to > >allow the text/html to embed the images and the text/plain to see them > >as attachments? > > I believe the above is that syntax. But the standard doesn't say > anything about this. The standard for multipart/alternative is RFC > 2046, which doesn't know about multipart/related. RFC 2387 doesn't > update RFC 2046, so it doesn't say anything about > multipart/alternative within multipart/related, either. > > >I think the text/html wants to refer to things within its containing > >multipart/related, but am not sure if that allows the intervening > >multipart/alternative. > > I don't see why not. But it would depend on the implementations, > which we'll have to test before recommending the structure I > (theoretically :-) prefer.e I'm still not understanding how the text/plain part *refers* to the related parts. I can understand the structure Glen found in Applemail: a series of text/plain parts interspersed with image/jpg, with all parts after the first being marked 'Contentent-Disposition: inline'. Any MUA that can display text and images *ought* to handle that correctly and produce the expected result. But that isn't what your structure above would produce. If you did: multipart/related multipart/alternative text/html text/plain image/png text/plain image/png text/plain and only referred to the png parts in the text/html part and marked all the parts as 'inline' (even though that is irrelevant in the text/html related case), an MUA that *knew* about this technique *could* display it "correctly", but an MUA that is just following the standards most likely won't. I don't see any way short of duplicating the image parts to make it likely that a typical MUA would display images for both a text/plain sequence and a text/html related part. On the other hand, my experience with MUAs is actually quite limited :) Unless there is some standard for referring to related parts in a text/plain part? I'm not aware of any, but you have much more experience with this stuff than I do. (Even text/enriched (RFC 1896) doesn't seem to have one, though of course there could be "extensions" that define both that and the font support you used as an example.) --David From v+python at g.nevcal.com Tue Sep 3 00:52:59 2013 From: v+python at g.nevcal.com (Glenn Linderman) Date: Mon, 02 Sep 2013 15:52:59 -0700 Subject: [Python-Dev] Completing the email6 API changes. In-Reply-To: <20130902214056.ADC342502EA@webabinitio.net> References: <20130831052136.42D4B2507F5@webabinitio.net> <87bo4echcr.fsf@uwakimon.sk.tsukuba.ac.jp> <20130901221040.DC76E250818@webabinitio.net> <5223C8E2.2000006@g.nevcal.com> <874na3diwj.fsf@uwakimon.sk.tsukuba.ac.jp> <5224286E.4040409@g.nevcal.com> <87y57fbt2q.fsf@uwakimon.sk.tsukuba.ac.jp> <20130902214056.ADC342502EA@webabinitio.net> Message-ID: <522516CB.1030705@g.nevcal.com> On 9/2/2013 2:40 PM, R. David Murray wrote: > I'm still not understanding how the text/plain part*refers* to the > related parts. I don't think the text/plain part can refer to the related parts, but, like you, am willing to be educated if there is a way; but while the text/html may be able to if things like cid: URIs can reach up a level in a given MUA, the text/plain would be left with the additional parts being attachments, methinks. This is less interesting than the technique Apple Mail uses, but more interesting than not even seeing the attached pictures. MUAs tend to be able to display what they produce themselves, but I have situations where they don't handle what other MUAs produce. One nice thing about this email6 toolkit might be the ability to produce, more easily than before, a variety of MIME combinations to exercise and test a variety of MUAs. While perhaps most of them have been tested with some obviously standard MIME combinations, I suspect most of them will produce strange results with combinations that are out of the ordinary. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rdmurray at bitdance.com Tue Sep 3 03:27:15 2013 From: rdmurray at bitdance.com (R. David Murray) Date: Mon, 02 Sep 2013 21:27:15 -0400 Subject: [Python-Dev] Completing the email6 API changes. In-Reply-To: <522516CB.1030705@g.nevcal.com> References: <20130831052136.42D4B2507F5@webabinitio.net> <87bo4echcr.fsf@uwakimon.sk.tsukuba.ac.jp> <20130901221040.DC76E250818@webabinitio.net> <5223C8E2.2000006@g.nevcal.com> <874na3diwj.fsf@uwakimon.sk.tsukuba.ac.jp> <5224286E.4040409@g.nevcal.com> <87y57fbt2q.fsf@uwakimon.sk.tsukuba.ac.jp> <20130902214056.ADC342502EA@webabinitio.net> <522516CB.1030705@g.nevcal.com> Message-ID: <20130903012716.1E3FF250166@webabinitio.net> On Mon, 02 Sep 2013 15:52:59 -0700, Glenn Linderman wrote: > MUAs tend to be able to display what they produce themselves, but I have > situations where they don't handle what other MUAs produce. > > One nice thing about this email6 toolkit might be the ability to > produce, more easily than before, a variety of MIME combinations to > exercise and test a variety of MUAs. While perhaps most of them have > been tested with some obviously standard MIME combinations, I suspect > most of them will produce strange results with combinations that are out > of the ordinary. Yeah, RFC compliance and other types of testing is something I want this package to be good for. The API under discussion here, though, is oriented toward people using the library for easily generating emails from their application and/or easily accessing the information from emails sent to their application. --David From stephen at xemacs.org Tue Sep 3 03:56:36 2013 From: stephen at xemacs.org (Stephen J. Turnbull) Date: Tue, 03 Sep 2013 10:56:36 +0900 Subject: [Python-Dev] Completing the email6 API changes. In-Reply-To: <20130902214056.ADC342502EA@webabinitio.net> References: <20130831052136.42D4B2507F5@webabinitio.net> <87bo4echcr.fsf@uwakimon.sk.tsukuba.ac.jp> <20130901221040.DC76E250818@webabinitio.net> <5223C8E2.2000006@g.nevcal.com> <874na3diwj.fsf@uwakimon.sk.tsukuba.ac.jp> <5224286E.4040409@g.nevcal.com> <87y57fbt2q.fsf@uwakimon.sk.tsukuba.ac.jp> <20130902214056.ADC342502EA@webabinitio.net> Message-ID: <87r4d6brcb.fsf@uwakimon.sk.tsukuba.ac.jp> R. David Murray writes: > I'm still not understanding how the text/plain part *refers* to the > related parts. Like this: "Check out this picture of my dog!" Or this: "The terms of the contract are found in the attached PDF. Please print it and sign it, then return it by carrier pigeon (attached)." With this structure multipart/alternative text/plain multipart/related text/html application/pdf application/rfc6214-transport the rendering of the text/plain part will not show evidence of the PDF at all (eg, a view/download button), at least in some of the MUAs I've tested. And it *should* not, in an RFC-conforming MUA. > I can understand the structure Glen found in Applemail: > a series of text/plain parts interspersed with image/jpg, with all parts > after the first being marked 'Contentent-Disposition: inline'. Any MUA > that can display text and images *ought* to handle that correctly and > produce the expected result. But that isn't what your structure above > would produce. If you did: > > multipart/related > multipart/alternative > text/html > text/plain > image/png > text/plain > image/png > text/plain > > and only referred to the png parts in the text/html part and marked all > the parts as 'inline' (even though that is irrelevant in the text/html > related case), an MUA that *knew* about this technique *could* display it > "correctly", but an MUA that is just following the standards most > likely won't. OK, I see that now. It requires non-MIME information about the treatment of the root entity by the implementation. On the other hand, it shouldn't *hurt*. RFC 2387 explicitly specifies that at least some parts of a contained multipart/related part should be able to refer to entities related via the containing multipart/related. Since it does not mention *any* restrictions on contained root entities, I take it that it implicitly specifies that any contained multipart may make such references. But I suspect it's not implemented by most MUAs. I'll have to test. > I don't see any way short of duplicating the image parts to make it > likely that a typical MUA would display images for both a text/plain > sequence and a text/html related part. On the other hand, my experience > with MUAs is actually quite limited :) > > Unless there is some standard for referring to related parts in a > text/plain part? No, the whole point is that we MUA implementers *know* that there is no machine-parsable way to refer to the related parts in text/plain, and therefore the only way to communicate even the *presence* of the attachment in multipart/related text/plain image/jpeg; name="dog-photo.jpg" to the receiving user is to make an exception in the implementation and treat it as multipart/mixed.[1] It *does* make sense, i.e., doesn't require any information not already available to the implementation. I wonder if use of external bodies could avoid the duplication in current implementations. Probably too fragile, though. Footnotes: [1] This is conformant to the RFC, as the mechanism of "relation" is explicitly application-dependent. From rdmurray at bitdance.com Tue Sep 3 16:01:42 2013 From: rdmurray at bitdance.com (R. David Murray) Date: Tue, 03 Sep 2013 10:01:42 -0400 Subject: [Python-Dev] Completing the email6 API changes. In-Reply-To: <87r4d6brcb.fsf@uwakimon.sk.tsukuba.ac.jp> References: <20130831052136.42D4B2507F5@webabinitio.net> <87bo4echcr.fsf@uwakimon.sk.tsukuba.ac.jp> <20130901221040.DC76E250818@webabinitio.net> <5223C8E2.2000006@g.nevcal.com> <874na3diwj.fsf@uwakimon.sk.tsukuba.ac.jp> <5224286E.4040409@g.nevcal.com> <87y57fbt2q.fsf@uwakimon.sk.tsukuba.ac.jp> <20130902214056.ADC342502EA@webabinitio.net> <87r4d6brcb.fsf@uwakimon.sk.tsukuba.ac.jp> Message-ID: <20130903140143.4EC862502EA@webabinitio.net> On Tue, 03 Sep 2013 10:56:36 +0900, "Stephen J. Turnbull" wrote: > R. David Murray writes: > > I can understand the structure Glen found in Applemail: > > a series of text/plain parts interspersed with image/jpg, with all parts > > after the first being marked 'Contentent-Disposition: inline'. Any MUA > > that can display text and images *ought* to handle that correctly and > > produce the expected result. But that isn't what your structure above > > would produce. If you did: > > > > multipart/related > > multipart/alternative > > text/html > > text/plain > > image/png > > text/plain > > image/png > > text/plain > > > > and only referred to the png parts in the text/html part and marked all > > the parts as 'inline' (even though that is irrelevant in the text/html > > related case), an MUA that *knew* about this technique *could* display it > > "correctly", but an MUA that is just following the standards most > > likely won't. > > OK, I see that now. It requires non-MIME information about the > treatment of the root entity by the implementation. On the other > hand, it shouldn't *hurt*. RFC 2387 explicitly specifies that at > least some parts of a contained multipart/related part should be able > to refer to entities related via the containing multipart/related. > Since it does not mention *any* restrictions on contained root > entities, I take it that it implicitly specifies that any contained > multipart may make such references. But I suspect it's not > implemented by most MUAs. I'll have to test. OK, I see what you are driving at now. Whether or not it works is dependent on whether or not typical MUAs handle a multipart/related with a text/plain root part by treating it as if it were a multipart/mixed with inline or attachment sub-parts. So yes, whether or not we should support and/or document this technique very much depends on whether or not typical MUAs do so. I will, needless to say, be very interested in the results of your research :) --David From rdmurray at bitdance.com Tue Sep 3 17:28:32 2013 From: rdmurray at bitdance.com (R. David Murray) Date: Tue, 03 Sep 2013 11:28:32 -0400 Subject: [Python-Dev] Completing the email6 API changes. In-Reply-To: <20130903140143.4EC862502EA@webabinitio.net> References: <20130831052136.42D4B2507F5@webabinitio.net> <87bo4echcr.fsf@uwakimon.sk.tsukuba.ac.jp> <20130901221040.DC76E250818@webabinitio.net> <5223C8E2.2000006@g.nevcal.com> <874na3diwj.fsf@uwakimon.sk.tsukuba.ac.jp> <5224286E.4040409@g.nevcal.com> <87y57fbt2q.fsf@uwakimon.sk.tsukuba.ac.jp> <20130902214056.ADC342502EA@webabinitio.net> <87r4d6brcb.fsf@uwakimon.sk.tsukuba.ac.jp> <20130903140143.4EC862502EA@webabinitio.net> Message-ID: <20130903152832.EB219250166@webabinitio.net> On Tue, 03 Sep 2013 10:01:42 -0400, "R. David Murray" wrote: > On Tue, 03 Sep 2013 10:56:36 +0900, "Stephen J. Turnbull" wrote: > > R. David Murray writes: > > > I can understand the structure Glen found in Applemail: > > > a series of text/plain parts interspersed with image/jpg, with all parts > > > after the first being marked 'Contentent-Disposition: inline'. Any MUA > > > that can display text and images *ought* to handle that correctly and > > > produce the expected result. But that isn't what your structure above > > > would produce. If you did: > > > > > > multipart/related > > > multipart/alternative > > > text/html > > > text/plain > > > image/png > > > text/plain > > > image/png > > > text/plain > > > > > > and only referred to the png parts in the text/html part and marked all > > > the parts as 'inline' (even though that is irrelevant in the text/html > > > related case), an MUA that *knew* about this technique *could* display it > > > "correctly", but an MUA that is just following the standards most > > > likely won't. > > > > OK, I see that now. It requires non-MIME information about the > > treatment of the root entity by the implementation. On the other > > hand, it shouldn't *hurt*. RFC 2387 explicitly specifies that at > > least some parts of a contained multipart/related part should be able > > to refer to entities related via the containing multipart/related. > > Since it does not mention *any* restrictions on contained root > > entities, I take it that it implicitly specifies that any contained > > multipart may make such references. But I suspect it's not > > implemented by most MUAs. I'll have to test. > > OK, I see what you are driving at now. Whether or not it works is > dependent on whether or not typical MUAs handle a multipart/related with > a text/plain root part by treating it as if it were a multipart/mixed I meant "a text/plain root part *inside* a multipart/alternative", which is what you said, I just didn't understand it at first :) Although I wonder how many GUI MUAs do the fallback to multipart/mixed with just a normal text/plain root part, too. I would expect a text-only MUA would, since it has no other way to display a multipart/related...but a graphical MUA might just assume that there will always be an html part in a multipart/related. > with inline or attachment sub-parts. So yes, whether or not we should > support and/or document this technique very much depends on whether or > not typical MUAs do so. I will, needless to say, be very interested in > the results of your research :) > > --David > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/rdmurray%40bitdance.com From barry at python.org Tue Sep 3 20:51:05 2013 From: barry at python.org (Barry Warsaw) Date: Tue, 3 Sep 2013 14:51:05 -0400 Subject: [Python-Dev] Python 2.6 to end support with 2.6.9 in October 2013 Message-ID: <20130903145105.76944e79@anarchist> Hello Pythonistas, Python 2.6.9 is the last planned release of the 2.6.x series. This will be a security-only source-only release. It is currently scheduled for October 2013, and after this Python 2.6 will have reached its end-of-life and the branch will be retired. http://www.python.org/dev/peps/pep-0361/ I would like to release 2.6.9rc1 on Monday, September 30th, and 2.6.9 final on Monday, October 28th. I've added both dates to the Python calendar. Here are the list of candidates still to be fixed for 2.6.9: - 18747 - Re-seed OpenSSL's PRNG after fork - 16037 - httplib: header parsing is not delimited - 16038 - ftplib: unlimited readline() from connection - 16039 - imaplib: unlimited readline() from connection - 16040 - nntplib: unlimited readline() from connection - 16041 - poplib: unlimited readline() from connection - 16042 - smtplib: unlimited readline() from connection - 16043 - xmlrpc: gzip_decode has unlimited read() These were the ones I previously had on my list, and I've now marked these all as release blockers for 2.6.9... for now. If you know of any others that I should be aware of, please let me know. If you can contribute to 2.6.9 by reviewing, testing, developing, or commenting, that would be greatly appreciated. I will be spending some time triaging these and any other issues that get identified as possible 2.6.9 candidates. If you have any questions regarding 2.6.9, please contact me via mailing list or IRC. Cheers, -Barry -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: not available URL: From rymg19 at gmail.com Tue Sep 3 21:53:53 2013 From: rymg19 at gmail.com (Ryan) Date: Tue, 03 Sep 2013 14:53:53 -0500 Subject: [Python-Dev] Python 2.6 to end support with 2.6.9 in October 2013 In-Reply-To: <20130903145105.76944e79@anarchist> References: <20130903145105.76944e79@anarchist> Message-ID: I'm still waiting on Python 2.7 for Android! Stuck on 2.6 for now...ugh! Wonder if I can build it myself... Barry Warsaw wrote: >Hello Pythonistas, > >Python 2.6.9 is the last planned release of the 2.6.x series. This >will be a >security-only source-only release. It is currently scheduled for >October >2013, and after this Python 2.6 will have reached its end-of-life and >the >branch will be retired. > >http://www.python.org/dev/peps/pep-0361/ > >I would like to release 2.6.9rc1 on Monday, September 30th, and 2.6.9 >final on >Monday, October 28th. I've added both dates to the Python calendar. > >Here are the list of candidates still to be fixed for 2.6.9: > >- 18747 - Re-seed OpenSSL's PRNG after fork >- 16037 - httplib: header parsing is not delimited >- 16038 - ftplib: unlimited readline() from connection >- 16039 - imaplib: unlimited readline() from connection >- 16040 - nntplib: unlimited readline() from connection >- 16041 - poplib: unlimited readline() from connection >- 16042 - smtplib: unlimited readline() from connection >- 16043 - xmlrpc: gzip_decode has unlimited read() > >These were the ones I previously had on my list, and I've now marked >these all >as release blockers for 2.6.9... for now. > >If you know of any others that I should be aware of, please let me >know. > >If you can contribute to 2.6.9 by reviewing, testing, developing, or >commenting, that would be greatly appreciated. I will be spending some >time >triaging these and any other issues that get identified as possible >2.6.9 >candidates. > >If you have any questions regarding 2.6.9, please contact me via >mailing list >or IRC. > >Cheers, >-Barry > > >------------------------------------------------------------------------ > >_______________________________________________ >Python-Dev mailing list >Python-Dev at python.org >https://mail.python.org/mailman/listinfo/python-dev >Unsubscribe: >https://mail.python.org/mailman/options/python-dev/rymg19%40gmail.com -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. -------------- next part -------------- An HTML attachment was scrubbed... URL: From victor.stinner at gmail.com Wed Sep 4 01:27:15 2013 From: victor.stinner at gmail.com (Victor Stinner) Date: Wed, 4 Sep 2013 01:27:15 +0200 Subject: [Python-Dev] RFC: PEP 454: Add a new tracemalloc module Message-ID: Hi, Antoine Pitrou suggested me to write a PEP to discuss the API of the new tracemalloc module that I proposed to add to Python 3.4. Here you have. If you prefer to read the HTML version: http://www.python.org/dev/peps/pep-0454/ See also the documentation of the current implementation of the module. http://hg.python.org/features/tracemalloc/file/tip/Doc/library/tracemalloc.rst The documentaion contains examples and a short "tutorial". PEP: 454 Title: Add a new tracemalloc module to trace Python memory allocations Version: $Revision$ Last-Modified: $Date$ Author: Victor Stinner Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 3-September-2013 Python-Version: 3.4 Abstract ======== Add a new ``tracemalloc`` module to trace Python memory allocations. Rationale ========= Common debug tools tracing memory allocations read the C filename and number. Using such tool to analyze Python memory allocations does not help because most memory allocations are done in the same C function, ``PyMem_Malloc()`` for example. There are debug tools dedicated to the Python languages like ``Heapy`` and ``PySizer``. These projects analyze objects type and/or content. These tools are useful when the most memory leak are instances of the same type and this type in allocated only in a few functions. The problem is when the object type is very common like ``str`` or ``tuple``, and it is hard to identify where these objects are allocated. Finding reference cycles is also a difficult task. There are different tools to draw a diagram of all references. These tools cannot be used huge on large applications with thousands of objects because the diagram is too huge to be analyzed manually. Proposal ======== Using the PEP 445, it becomes easy to setup an hook on Python memory allocators. The hook can inspect the current Python frame to get the Python filename and line number. This PEP proposes to add a new ``tracemalloc`` module. It is a debug tool to trace memory allocations made by Python. The module provides the following information: * Statistics on Python memory allocations per Python filename and line number: size, number, and average size of allocations * Compute differences between two snapshots of Python memory allocations * Location of a Python memory allocation: size in bytes, Python filename and line number Command line options ==================== The ``python -m tracemalloc`` command can be used to analyze and compare snapshots. The command takes a list of snapshot filenames and has the following options. ``-g``, ``--group-per-file`` Group allocations per filename, instead of grouping per line number. ``-n NTRACES``, ``--number NTRACES`` Number of traces displayed per top (default: 10). ``--first`` Compare with the first snapshot, instead of comparing with the previous snapshot. ``--include PATTERN`` Only include filenames matching pattern *PATTERN*. The option can be specified multiple times. See ``fnmatch.fnmatch()`` for the syntax of patterns. ``--exclude PATTERN`` Exclude filenames matching pattern *PATTERN*. The option can be specified multiple times. See ``fnmatch.fnmatch()`` for the syntax of patterns. ``-S``, ``--hide-size`` Hide the size of allocations. ``-C``, ``--hide-count`` Hide the number of allocations. ``-A``, ``--hide-average`` Hide the average size of allocations. ``-P PARTS``, ``--filename-parts=PARTS`` Number of displayed filename parts (default: 3). ``--color`` Force usage of colors even if ``sys.stdout`` is not a TTY device. ``--no-color`` Disable colors if ``sys.stdout`` is a TTY device. API === To trace the most Python memory allocations, the module should be enabled as early as possible in your application by calling ``tracemalloc.enable()`` function, by setting the ``PYTHONTRACEMALLOC`` environment variable to ``1``, or by using ``-X tracemalloc`` command line option. Functions --------- ``enable()`` function: Start tracing Python memory allocations. ``disable()`` function: Stop tracing Python memory allocations and stop the timer started by ``start_timer()``. ``is_enabled()`` function: Get the status of the module: ``True`` if it is enabled, ``False`` otherwise. ``get_object_address(obj)`` function: Get the address of the memory block of the specified Python object. ``get_object_trace(obj)`` function: Get the trace of a Python object *obj* as a ``trace`` instance. Return ``None`` if the tracemalloc module did not save the location when the object was allocated, for example if the module was disabled. ``get_process_memory()`` function: Get the memory usage of the current process as a meminfo namedtuple with two attributes: * ``rss``: Resident Set Size in bytes * ``vms``: size of the virtual memory in bytes Return ``None`` if the platform is not supported. Use the ``psutil`` module if available. ``get_stats()`` function: Get statistics on Python memory allocations per Python filename and per Python line number. Return a dictionary ``{filename: str -> {line_number: int -> stats: line_stat}}`` where *stats* in a ``line_stat`` instance. *filename* and *line_number* can be ``None``. Return an empty dictionary if the tracemalloc module is disabled. ``get_traces(obj)`` function: Get all traces of a Python memory allocations. Return a dictionary ``{pointer: int -> trace}`` where *trace* is a ``trace`` instance. Return an empty dictionary if the ``tracemalloc`` module is disabled. ``start_timer(delay: int, func: callable, args: tuple=(), kwargs: dict={})`` function: Start a timer calling ``func(*args, **kwargs)`` every *delay* seconds. The timer is based on the Python memory allocator, it is not real time. *func* is called after at least *delay* seconds, it is not called exactly after *delay* seconds if no Python memory allocation occurred. If ``start_timer()`` is called twice, previous parameters are replaced. The timer has a resolution of 1 second. ``start_timer()`` is used by ``DisplayTop`` and ``TakeSnapshot`` to run regulary a task. ``stop_timer()`` function: Stop the timer started by ``start_timer()``. trace class ----------- ``trace`` class: This class represents debug information of an allocated memory block. ``size`` attribute: Size in bytes of the memory block. ``filename`` attribute: Name of the Python script where the memory block was allocated, ``None`` if unknown. ``lineno`` attribute: Line number where the memory block was allocated, ``None`` if unknown. line_stat class ---------------- ``line_stat`` class: Statistics on Python memory allocations of a specific line number. ``size`` attribute: Total size in bytes of all memory blocks allocated on the line. ``count`` attribute: Number of memory blocks allocated on the line. DisplayTop class ---------------- ``DisplayTop(count: int=10, file=sys.stdout)`` class: Display the list of the *count* biggest memory allocations into *file*. ``display()`` method: Display the top once. ``start(delay: int)`` method: Start a task using ``tracemalloc`` timer to display the top every *delay* seconds. ``stop()`` method: Stop the task started by the ``DisplayTop.start()`` method ``color`` attribute: If ``True``, ``display()`` uses color. The default value is ``file.isatty()``. ``compare_with_previous`` attribute: If ``True`` (default value), ``display()`` compares with the previous snapshot. If ``False``, compare with the first snapshot. ``filename_parts`` attribute: Number of displayed filename parts (int, default: ``3``). Extra parts are replaced with ``"..."``. ``group_per_file`` attribute: If ``True``, group memory allocations per Python filename. If ``False`` (default value), group allocation per Python line number. ``show_average`` attribute: If ``True`` (default value), ``display()`` shows the average size of allocations. ``show_count`` attribute: If ``True`` (default value), ``display()`` shows the number of allocations. ``show_size`` attribute: If ``True`` (default value), ``display()`` shows the size of allocations. ``user_data_callback`` attribute: Optional callback collecting user data (callable, default: ``None``). See ``Snapshot.create()``. Snapshot class -------------- ``Snapshot()`` class: Snapshot of Python memory allocations. Use ``TakeSnapshot`` to take regulary snapshots. ``create(user_data_callback=None)`` method: Take a snapshot. If *user_data_callback* is specified, it must be a callable object returning a list of ``(title: str, format: str, value: int)``. *format* must be ``'size'``. The list must always have the same length and the same order to be able to compute differences between values. Example: ``[('Video memory', 'size', 234902)]``. ``filter_filenames(patterns: list, include: bool)`` method: Remove filenames not matching any pattern of *patterns* if *include* is ``True``, or remove filenames matching a pattern of *patterns* if *include* is ``False`` (exclude). See ``fnmatch.fnmatch()`` for the syntax of a pattern. ``load(filename)`` classmethod: Load a snapshot from a file. ``write(filename)`` method: Write the snapshot into a file. ``pid`` attribute: Identifier of the process which created the snapshot (int). ``process_memory`` attribute: Result of the ``get_process_memory()`` function, can be ``None``. ``stats`` attribute: Result of the ``get_stats()`` function (dict). ``timestamp`` attribute: Creation date and time of the snapshot, ``datetime.datetime`` instance. ``user_data`` attribute: Optional list of user data, result of *user_data_callback* in ``Snapshot.create()`` (default: None). TakeSnapshot class ------------------ ``TakeSnapshot`` class: Task taking snapshots of Python memory allocations: write them into files. By default, snapshots are written in the current directory. ``start(delay: int)`` method: Start a task taking a snapshot every delay seconds. ``stop()`` method: Stop the task started by the ``TakeSnapshot.start()`` method. ``take_snapshot()`` method: Take a snapshot. ``filename_template`` attribute: Template (``str``) used to create a filename. The following variables can be used in the template: * ``$pid``: identifier of the current process * ``$timestamp``: current date and time * ``$counter``: counter starting at 1 and incremented at each snapshot The default pattern is ``'tracemalloc-$counter.pickle'``. ``user_data_callback`` attribute: Optional callback collecting user data (callable, default: ``None``). See ``Snapshot.create()``. Links ===== Python issues: * `#18874: Add a new tracemalloc module to trace Python memory allocations `_ Similar projects: * `Meliae: Python Memory Usage Analyzer `_ * `Guppy-PE: umbrella package combining Heapy and GSL `_ * `PySizer `_: developed for Python 2.4 * `memory_profiler `_ * `pympler `_ * `Dozer `_: WSGI Middleware version of the CherryPy memory leak debugger * `objgraph `_ * `caulk `_ Copyright ========= This document has been placed into the public domain. From victor.stinner at gmail.com Wed Sep 4 01:56:21 2013 From: victor.stinner at gmail.com (Victor Stinner) Date: Wed, 4 Sep 2013 01:56:21 +0200 Subject: [Python-Dev] RFC: PEP 454: Add a new tracemalloc module In-Reply-To: References: Message-ID: > ``get_object_trace(obj)`` function: > > Get the trace of a Python object *obj* as a ``trace`` instance. > > Return ``None`` if the tracemalloc module did not save the location > when the object was allocated, for example if the module was > disabled. This function and get_traces() can be reused by other debug tools like Heapy and objgraph to add where objects were allocated. > ``get_stats()`` function: > > Get statistics on Python memory allocations per Python filename and > per Python line number. > > Return a dictionary > ``{filename: str -> {line_number: int -> stats: line_stat}}`` > where *stats* in a ``line_stat`` instance. *filename* and > *line_number* can be ``None``. > > Return an empty dictionary if the tracemalloc module is disabled. > > ``get_traces(obj)`` function: > > Get all traces of a Python memory allocations. > Return a dictionary ``{pointer: int -> trace}`` where *trace* > is a ``trace`` instance. > > Return an empty dictionary if the ``tracemalloc`` module is disabled. get_stats() can computed from get_traces(), example: ----- import pprint, tracemalloc traces = tracemalloc.get_traces() stats = {} for trace in traces.values(): if trace.filename not in stats: stats[trace.filename] = line_stats = {} else: line_stats = stats[trace.filename] if trace.lineno not in line_stats: line_stats[trace.lineno] = line_stat = tracemalloc.line_stat((0, 0)) size = trace.size count = 1 else: line_stat = line_stats[trace.lineno] size = line_stat.size + trace.size count = line_stat.count + 1 line_stats[trace.lineno] = tracemalloc.line_stat((size, count)) pprint.pprint(stats) ----- The problem is the efficiency. At startup, Python already allocated more than 20,000 memory blocks: $ ./python -X tracemalloc -c 'import tracemalloc; print(len(tracemalloc.get_traces()))' 21704 At the end of the Python test suite, Python allocated more than 500,000 memory blocks. Storing all these traces in a snapshot eats a lot of memory, disk space and uses CPU to build the statistics. > ``start_timer(delay: int, func: callable, args: tuple=(), kwargs: > dict={})`` function: > > Start a timer calling ``func(*args, **kwargs)`` every *delay* > seconds. (...) > > If ``start_timer()`` is called twice, previous parameters are > replaced. The timer has a resolution of 1 second. > > ``start_timer()`` is used by ``DisplayTop`` and ``TakeSnapshot`` to > run regulary a task. So DisplayTop and TakeSnapshot cannot be used at the same time. It would be convinient to be able to register more than one function. What do you think? > ``trace`` class: > This class represents debug information of an allocated memory block. > > ``size`` attribute: > Size in bytes of the memory block. > ``filename`` attribute: > Name of the Python script where the memory block was allocated, > ``None`` if unknown. > ``lineno`` attribute: > Line number where the memory block was allocated, ``None`` if > unknown. I though twice and it would be posible to store more than 1 frame per trace instance, to be able to rebuild a (partial) Python traceback. The hook on the memory allocator has access to the chain of Python frames. The API should be changed to support such enhancement. > ``DisplayTop(count: int=10, file=sys.stdout)`` class: > Display the list of the *count* biggest memory allocations into > *file*. > (...) > ``group_per_file`` attribute: > > If ``True``, group memory allocations per Python filename. If > ``False`` (default value), group allocation per Python line number. This attribute is very important. We may add it to the constructor. By the way, the self.stream attribute is not documented. > Snapshot class > -------------- > > ``Snapshot()`` class: > > Snapshot of Python memory allocations. > > Use ``TakeSnapshot`` to take regulary snapshots. > > ``create(user_data_callback=None)`` method: > > Take a snapshot. If *user_data_callback* is specified, it must be a > callable object returning a list of > ``(title: str, format: str, value: int)``. > *format* must be ``'size'``. The list must always have the same > length and the same order to be able to compute differences between > values. > > Example: ``[('Video memory', 'size', 234902)]``. (Oops, create() is a class method, not a method.) Having to call a class method to build an instance of a class is surprising. But I didn't find a way to implement the load() class method otherwise. The user_data_callback API can be improved. The "format must be size" is not very convinient. Victor From stephen at xemacs.org Wed Sep 4 03:30:28 2013 From: stephen at xemacs.org (Stephen J. Turnbull) Date: Wed, 04 Sep 2013 10:30:28 +0900 Subject: [Python-Dev] Completing the email6 API changes. In-Reply-To: <20130903152832.EB219250166@webabinitio.net> References: <20130831052136.42D4B2507F5@webabinitio.net> <87bo4echcr.fsf@uwakimon.sk.tsukuba.ac.jp> <20130901221040.DC76E250818@webabinitio.net> <5223C8E2.2000006@g.nevcal.com> <874na3diwj.fsf@uwakimon.sk.tsukuba.ac.jp> <5224286E.4040409@g.nevcal.com> <87y57fbt2q.fsf@uwakimon.sk.tsukuba.ac.jp> <20130902214056.ADC342502EA@webabinitio.net> <87r4d6brcb.fsf@uwakimon.sk.tsukuba.ac.jp> <20130903140143.4EC862502EA@webabinitio.net> <20130903152832.EB219250166@webabinitio.net> Message-ID: <87eh95bcgb.fsf@uwakimon.sk.tsukuba.ac.jp> R. David Murray writes: > I meant "a text/plain root part *inside* a multipart/alternative", which > is what you said, I just didn't understand it at first :) Although I > wonder how many GUI MUAs do the fallback to multipart/mixed with just a > normal text/plain root part, too. I would expect a text-only MUA would, > since it has no other way to display a multipart/related...but a > graphical MUA might just assume that there will always be an html part > in a multipart/related. It's not really a problem with text vs. GUI, or an assumption of HMTL. There are plenty of formats that have such links, and some which don't have links, but rather assigned roles such as "Mac files" (with data fork and resource fork) and digital signatures (though that turned out to be worth designing a new multipart subtype). The problem is that "multipart/related" says "pass all the part entities to the handler appropriate to the root part entity, which will process the links found in the root part entity". If you implement that in the natural way, you just pass the text/plain part to the text/plain handler, which won't find any links for the simple reason that it has no protocol for representing them. This means that the kind of multipart/related handler I envision needs to implement linking itself, rather than delegate them to the root part handler. This requires checking the type of the root part: # not intended to look like Email API def handle_multipart_related (part_list, root_part): if root_part.content_type in ['text/plain']: # just display the parts in order handle_multipart_mixed (part_list) else: # cid -> entities in internal representation entity_map = extract_entity_map(part_list) root_part.content_type.handle(root_part, entity_map) From victor.stinner at gmail.com Wed Sep 4 13:20:11 2013 From: victor.stinner at gmail.com (Victor Stinner) Date: Wed, 4 Sep 2013 13:20:11 +0200 Subject: [Python-Dev] RFC: PEP 454: Add a new tracemalloc module In-Reply-To: References: Message-ID: >> ``trace`` class: >> This class represents debug information of an allocated memory block. >> >> ``size`` attribute: >> Size in bytes of the memory block. >> ``filename`` attribute: >> Name of the Python script where the memory block was allocated, >> ``None`` if unknown. >> ``lineno`` attribute: >> Line number where the memory block was allocated, ``None`` if >> unknown. > > I though twice and it would be posible to store more than 1 frame per > trace instance, to be able to rebuild a (partial) Python traceback. > The hook on the memory allocator has access to the chain of Python > frames. The API should be changed to support such enhancement. Oh, it was much easier than expected to retrieve the traceback (maximum 10 frames) instead of only the current frame. I modified the trace class to replace filename and lineno with a new frames attribute which is list of frames. Script example: --- import tracemalloc, linecache def g(): return object() def f(): return g() tracemalloc.enable() obj = f() trace = tracemalloc.get_object_trace(obj) print("Traceback (most recent first):") for frame in trace.frames: print(' File "%s", line %s' % (frame.filename, frame.lineno)) line = linecache.getline(frame.filename, frame.lineno) if line: print(" " + line.strip()) --- Output of the script: --- Traceback (most recent first): File "x.py", line 4 return object() File "x.py", line 7 return g() File "x.py", line 10 obj = f() --- I updated the PEP 454 (add a new frame class, update trace class): frame class ----------- ``frame`` class: Trace of a Python frame. ``filename`` attribute (``str``): Python filename, ``None`` if unknown. ``lineno`` attribute (``int``): Python line number, ``None`` if unknown. trace class ----------- ``trace`` class: This class represents debug information of an allocated memory block. ``size`` attribute (``int``): Size in bytes of the memory block. ``frames`` attribute (``list``): Traceback where the memory block was allocated as a list of ``frame`` instances (most recent first). The list can be empty or incomplete if the tracemalloc module was unable to retrieve the full traceback. For efficiency, the traceback is truncated to 10 frames. Victor From alexander.belopolsky at gmail.com Thu Sep 5 02:46:21 2013 From: alexander.belopolsky at gmail.com (Alexander Belopolsky) Date: Wed, 4 Sep 2013 20:46:21 -0400 Subject: [Python-Dev] RFC: PEP 454: Add a new tracemalloc module In-Reply-To: References: Message-ID: On Tue, Sep 3, 2013 at 7:27 PM, Victor Stinner wrote: > API > === > > To trace the most Python memory allocations, the module should be > enabled as early as possible in your application by calling > ``tracemalloc.enable()`` function, by setting the ``PYTHONTRACEMALLOC`` > environment variable to ``1``, or by using ``-X tracemalloc`` command > line option. > > > Functions > --------- > > ``enable()`` function: > > Start tracing Python memory allocations. > > ``disable()`` function: > > Stop tracing Python memory allocations and stop the timer started by > ``start_timer()``. > > ``is_enabled()`` function: > > Get the status of the module: ``True`` if it is enabled, ``False`` > otherwise. > Please mention that this API is similar to that of faulthandler and add a link to faulthandler docs. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jcea at jcea.es Thu Sep 5 19:31:59 2013 From: jcea at jcea.es (Jesus Cea) Date: Thu, 05 Sep 2013 19:31:59 +0200 Subject: [Python-Dev] Offtopic: OpenID Providers Message-ID: <5228C00F.7000209@jcea.es> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I just received an email from my OpenID provider, "myOpenID", saying that they drop OpenID service next February. I wonder what other OpenID providers are used by other python-dev fellows. What are you using?. bugs.python.org admins could share some data? I agree than OpenID is (quite) dead, but I rather prefer OpenID to use user/pass. I have big hopes for Mozilla Persona, looking forward Python infrastructure support :). PS: I use "http://www.jcea.es/" as my OpenID identity, and I delegate the actual service to "myOpenID". I can switch delegation trivially. - -- Jes?s Cea Avi?n _/_/ _/_/_/ _/_/_/ jcea at jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/ Twitter: @jcea _/_/ _/_/ _/_/_/_/_/ jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/ _/_/ _/_/ "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ "El amor es poner tu felicidad en la felicidad de otro" - Leibniz -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQCVAwUBUijAD5lgi5GaxT1NAQLH0wQAkKDORrAtfJFzzIHl3lHRp7GfxOzdqdNP uiuW65l/pas+p9+B0G6qR6EE2AAL7YPozcNF5AkmuGmxkpyn/JyUYKJcUWmUotpj V9Buz9jz3qpPuv7AlTnMbjBBQK4YTYenbdk2HgI41SVQHZHkU/+y4CL3Y1hWyJNo C8CCWfR0VlA= =YXIq -----END PGP SIGNATURE----- From phd at phdru.name Thu Sep 5 20:12:31 2013 From: phd at phdru.name (Oleg Broytman) Date: Thu, 5 Sep 2013 22:12:31 +0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <5228C00F.7000209@jcea.es> References: <5228C00F.7000209@jcea.es> Message-ID: <20130905181231.GA25306@iskra.aviel.ru> On Thu, Sep 05, 2013 at 07:31:59PM +0200, Jesus Cea wrote: > I just received an email from my OpenID provider, "myOpenID", saying > that they drop OpenID service next February. I wonder what other > OpenID providers are used by other python-dev fellows. > > What are you using?. bugs.python.org admins could share some data? > > I agree than OpenID is (quite) dead, but I rather prefer OpenID to use > user/pass. I have big hopes for Mozilla Persona, looking forward > Python infrastructure support :). > > PS: I use "http://www.jcea.es/" as my OpenID identity, and I delegate > the actual service to "myOpenID". I can switch delegation trivially. I used to use myOpenID and became my own provider using poit[1]. These days I seldom use OpenID -- there are too few sites that allow full-featured login with OpenID. The future lies in OAuth 2.0. 1. http://yangman.ca/poit/ Oleg. -- Oleg Broytman http://phdru.name/ phd at phdru.name Programmers don't die, they just GOSUB without RETURN. From donald at stufft.io Thu Sep 5 20:16:29 2013 From: donald at stufft.io (Donald Stufft) Date: Thu, 5 Sep 2013 14:16:29 -0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130905181231.GA25306@iskra.aviel.ru> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> Message-ID: <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> On Sep 5, 2013, at 2:12 PM, Oleg Broytman wrote: > On Thu, Sep 05, 2013 at 07:31:59PM +0200, Jesus Cea wrote: >> I just received an email from my OpenID provider, "myOpenID", saying >> that they drop OpenID service next February. I wonder what other >> OpenID providers are used by other python-dev fellows. >> >> What are you using?. bugs.python.org admins could share some data? >> >> I agree than OpenID is (quite) dead, but I rather prefer OpenID to use >> user/pass. I have big hopes for Mozilla Persona, looking forward >> Python infrastructure support :). >> >> PS: I use "http://www.jcea.es/" as my OpenID identity, and I delegate >> the actual service to "myOpenID". I can switch delegation trivially. > > I used to use myOpenID and became my own provider using poit[1]. > These days I seldom use OpenID -- there are too few sites that allow > full-featured login with OpenID. The future lies in OAuth 2.0. The Auth in OAuth stands for Authorization not Authentication. > > 1. http://yangman.ca/poit/ > > Oleg. > -- > Oleg Broytman http://phdru.name/ phd at phdru.name > Programmers don't die, they just GOSUB without RETURN. > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/donald%40stufft.io ----------------- Donald Stufft PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: Message signed with OpenPGP using GPGMail URL: From phd at phdru.name Thu Sep 5 20:25:22 2013 From: phd at phdru.name (Oleg Broytman) Date: Thu, 5 Sep 2013 22:25:22 +0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> Message-ID: <20130905182522.GA26090@iskra.aviel.ru> On Thu, Sep 05, 2013 at 02:16:29PM -0400, Donald Stufft wrote: > > On Sep 5, 2013, at 2:12 PM, Oleg Broytman wrote: > > I used to use myOpenID and became my own provider using poit[1]. > > These days I seldom use OpenID -- there are too few sites that allow > > full-featured login with OpenID. The future lies in OAuth 2.0. > > The Auth in OAuth stands for Authorization not Authentication. There is no authorization without authentication, so OAuth certainly performs authentication: http://oauth.net/core/1.0a/#anchor9 , http://tools.ietf.org/html/rfc5849#section-3 Oleg. -- Oleg Broytman http://phdru.name/ phd at phdru.name Programmers don't die, they just GOSUB without RETURN. From barry at python.org Thu Sep 5 20:30:43 2013 From: barry at python.org (Barry Warsaw) Date: Thu, 5 Sep 2013 14:30:43 -0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <5228C00F.7000209@jcea.es> References: <5228C00F.7000209@jcea.es> Message-ID: <20130905143043.590a12b2@anarchist> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On Sep 05, 2013, at 07:31 PM, Jesus Cea wrote: >I just received an email from my OpenID provider, "myOpenID", saying >that they drop OpenID service next February. I wonder what other >OpenID providers are used by other python-dev fellows. > >What are you using?. bugs.python.org admins could share some data? Launchpad. It's not going anywhere. >I agree than OpenID is (quite) dead, but I rather prefer OpenID to use >user/pass. I have big hopes for Mozilla Persona, looking forward >Python infrastructure support :). We at the Mailman project like Persona a lot. It'll be the primary way people can log into Postorius (the new web ui). - -Barry -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) iQIcBAEBCAAGBQJSKM3TAAoJEBJutWOnSwa/jP8QAJ4BkV8285TexZq+9GuTwzFf qx2OlUwtiv6lhDZq9uY0sXijyKl76N0/nTsSf5Fr8nDsn5KaETd14PFGfwbg6WVS jMZcKz+3j7eq6zq/Qm47qFbcBb2moyxptkE96BMCqEw+DCnPo87q8DXOb2W67ROI XDsRW2T/D8v5SvAqkmgOPlWsXWc1QzOpJCGkYcufzDeCjkFPXvck3mFI0TpizXnv 7L4IjrK9Qn6D1zNvKmovTkQOu3sk3C2FvPT2QG0b+DWkPtERE6o/xK2OTkhIzbBd /YfLEkb60tJYtwKqfHei+n4pVreExT0DtCDFHh5bYbdcD23VuHfDZtaHCDzYEhK9 rjuY2odydxD/xH9F21enHqYuU76TBr8ceodYsP2FNlqO5XeOJwgAXhWdpBYwN+SU G0B5k3wDb6VCDkqM1u7VGcA/yQLeGQ43s/klxxAxo08sA3url9HcIeuO5rnmnB5l lGIehq/SJPVQXQevEJvL8Atm7uLnsaWEJg34+T04MyR+TLeUcjKsNrUZBS8bGOZu agygKg3M/zi1k9LW/uxKR7IKLyBK+axYoEQS9yydqpgO1e8BQa6XlLQ89Sv9r38Y y1qTFmGdRRQSItrlS1urMQ9Q8m7pJBSyfBywlsck07hpXlZLRwRm2S3DnMBrF6It I7f28XXirrnBf/la/+6g =xqI7 -----END PGP SIGNATURE----- From donald at stufft.io Thu Sep 5 20:35:16 2013 From: donald at stufft.io (Donald Stufft) Date: Thu, 5 Sep 2013 14:35:16 -0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130905182522.GA26090@iskra.aviel.ru> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> Message-ID: <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> On Sep 5, 2013, at 2:25 PM, Oleg Broytman wrote: > On Thu, Sep 05, 2013 at 02:16:29PM -0400, Donald Stufft wrote: >> >> On Sep 5, 2013, at 2:12 PM, Oleg Broytman wrote: >>> I used to use myOpenID and became my own provider using poit[1]. >>> These days I seldom use OpenID -- there are too few sites that allow >>> full-featured login with OpenID. The future lies in OAuth 2.0. >> >> The Auth in OAuth stands for Authorization not Authentication. > > There is no authorization without authentication, so OAuth certainly > performs authentication: http://oauth.net/core/1.0a/#anchor9 , > http://tools.ietf.org/html/rfc5849#section-3 They are separate topics and authorization does not need to imply authentication, it so happens that in many particular instances of OAuth you can estimate authentication. https://en.wikipedia.org/wiki/OAuth#OpenID_vs._pseudo-authentication_using_OAuth Persona is the logical successor to OpenID. ----------------- Donald Stufft PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: Message signed with OpenPGP using GPGMail URL: From a.badger at gmail.com Thu Sep 5 20:33:47 2013 From: a.badger at gmail.com (Toshio Kuratomi) Date: Thu, 5 Sep 2013 11:33:47 -0700 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130905182522.GA26090@iskra.aviel.ru> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> Message-ID: <20130905183347.GO10747@unaka.lan> On Thu, Sep 05, 2013 at 10:25:22PM +0400, Oleg Broytman wrote: > On Thu, Sep 05, 2013 at 02:16:29PM -0400, Donald Stufft wrote: > > > > On Sep 5, 2013, at 2:12 PM, Oleg Broytman wrote: > > > I used to use myOpenID and became my own provider using poit[1]. > > > These days I seldom use OpenID -- there are too few sites that allow > > > full-featured login with OpenID. The future lies in OAuth 2.0. > > > > The Auth in OAuth stands for Authorization not Authentication. > > There is no authorization without authentication, so OAuth certainly > performs authentication: http://oauth.net/core/1.0a/#anchor9 , > http://tools.ietf.org/html/rfc5849#section-3 > Sortof.... The way OAuth looks to me, it's designed to prove that a given client is authorized to perform an action. It's not designed to prove that the given client is a specific person. In some cases, you really want to know the latter and not merely the former. So I think in these situations Donald's separation of Authz and Authn makes sense. -Toshio -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From phd at phdru.name Thu Sep 5 20:43:37 2013 From: phd at phdru.name (Oleg Broytman) Date: Thu, 5 Sep 2013 22:43:37 +0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> Message-ID: <20130905184337.GA26926@iskra.aviel.ru> On Thu, Sep 05, 2013 at 02:35:16PM -0400, Donald Stufft wrote: > Persona is the logical successor to OpenID. OpenID lived a short life and died a quiet death. I'm afraid Persona wouldn't live even that much. Dead-born idea, in my so humble opinion. Oleg. -- Oleg Broytman http://phdru.name/ phd at phdru.name Programmers don't die, they just GOSUB without RETURN. From eliben at gmail.com Thu Sep 5 20:45:01 2013 From: eliben at gmail.com (Eli Bendersky) Date: Thu, 5 Sep 2013 11:45:01 -0700 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <5228C00F.7000209@jcea.es> References: <5228C00F.7000209@jcea.es> Message-ID: On Thu, Sep 5, 2013 at 10:31 AM, Jesus Cea wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > I just received an email from my OpenID provider, "myOpenID", saying > that they drop OpenID service next February. I wonder what other > OpenID providers are used by other python-dev fellows. > > What are you using?. bugs.python.org admins could share some data? > > I agree than OpenID is (quite) dead, but I rather prefer OpenID to use > user/pass. I have big hopes for Mozilla Persona, looking forward > Python infrastructure support :). > > PS: I use "http://www.jcea.es/" as my OpenID identity, and I delegate > the actual service to "myOpenID". I can switch delegation trivially. > http://bugs.python.org/?@action=openid_login&provider=Google Eli -------------- next part -------------- An HTML attachment was scrubbed... URL: From donald at stufft.io Thu Sep 5 20:50:44 2013 From: donald at stufft.io (Donald Stufft) Date: Thu, 5 Sep 2013 14:50:44 -0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130905184337.GA26926@iskra.aviel.ru> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> Message-ID: <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> On Sep 5, 2013, at 2:43 PM, Oleg Broytman wrote: > On Thu, Sep 05, 2013 at 02:35:16PM -0400, Donald Stufft wrote: >> Persona is the logical successor to OpenID. > > OpenID lived a short life and died a quiet death. I'm afraid Persona > wouldn't live even that much. Dead-born idea, in my so humble opinion. I don't think there's much evidence to support this. I'm seeing more sites support Persona not less. It solves some of the major problems with OpenID. ----------------- Donald Stufft PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: Message signed with OpenPGP using GPGMail URL: From barry at python.org Thu Sep 5 20:53:43 2013 From: barry at python.org (Barry Warsaw) Date: Thu, 5 Sep 2013 14:53:43 -0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130905183347.GO10747@unaka.lan> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <20130905183347.GO10747@unaka.lan> Message-ID: <20130905145343.08d40db8@anarchist> On Sep 05, 2013, at 11:33 AM, Toshio Kuratomi wrote: >Sortof.... The way OAuth looks to me, it's designed to prove that a given >client is authorized to perform an action. It's not designed to prove that >the given client is a specific person. In some cases, you really want to >know the latter and not merely the former. So I think in these situations >Donald's separation of Authz and Authn makes sense. This probably isn't the only application of these technologies, but I've always thought about OAuth as delegating authority to scripts and programs to act on your behalf. For example, you can write a script to interact with Launchpad's REST API, but before you can use the script, you have to interact with the web ui once (since your browser is trusted, presumably) to receive a token which the script can then use to prove that it's acting on your behalf. If at some point you stop trusting that script, you can revoke the token to disable its access, without having to reset your password. To me, OpenID is about logging into web sites using single-sign on. For example, once I've logged into Launchpad, I can essentially go anywhere that accepts OpenID, type my OpenID and generally not have to log in again (things like two-factor auth and such may change that interaction pattern). Or to summarize to a rough approximation: OpenID is for logins, OAuth is for scripts. Persona seems to fit the OpenID use case. You'd still want OAuth for scripting. -Barry -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: not available URL: From skip at pobox.com Thu Sep 5 21:07:11 2013 From: skip at pobox.com (Skip Montanaro) Date: Thu, 5 Sep 2013 14:07:11 -0500 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> Message-ID: >> On Thu, Sep 05, 2013 at 02:35:16PM -0400, Donald Stufft wrote: >>> Persona is the logical successor to OpenID. >> >> OpenID lived a short life and died a quiet death. I'm afraid Persona >> wouldn't live even that much. Dead-born idea, in my so humble opinion. > > I don't think there's much evidence to support this. I'm seeing more sites support Persona > not less. It solves some of the major problems with OpenID. I was completely unaware of OpenID's demise. Can someone point me to/provide an explanation? I much prefer using OpenID to login to a site than having to either come up with yet another username/password which I will just forget, or using Facebook or similar (I don't really trust them with my info). Thx, Skip From solipsis at pitrou.net Thu Sep 5 21:08:18 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Thu, 5 Sep 2013 21:08:18 +0200 Subject: [Python-Dev] Offtopic: OpenID Providers References: <5228C00F.7000209@jcea.es> Message-ID: <20130905210818.5fd499f8@fsol> On Thu, 05 Sep 2013 19:31:59 +0200 Jesus Cea wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > I just received an email from my OpenID provider, "myOpenID", saying > that they drop OpenID service next February. I wonder what other > OpenID providers are used by other python-dev fellows. I use a self-hosted SimpleID instance: > > What are you using?. bugs.python.org admins could share some data? > > I agree than OpenID is (quite) dead, but I rather prefer OpenID to use > user/pass. I have big hopes for Mozilla Persona, looking forward > Python infrastructure support :). > > PS: I use "http://www.jcea.es/" as my OpenID identity, and I delegate > the actual service to "myOpenID". I can switch delegation trivially. > > - -- > Jes?s Cea Avi?n _/_/ _/_/_/ _/_/_/ > jcea at jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/ > Twitter: @jcea _/_/ _/_/ _/_/_/_/_/ > jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/ _/_/ _/_/ > "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ > "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ > "El amor es poner tu felicidad en la felicidad de otro" - Leibniz > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.10 (GNU/Linux) > Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ > > iQCVAwUBUijAD5lgi5GaxT1NAQLH0wQAkKDORrAtfJFzzIHl3lHRp7GfxOzdqdNP > uiuW65l/pas+p9+B0G6qR6EE2AAL7YPozcNF5AkmuGmxkpyn/JyUYKJcUWmUotpj > V9Buz9jz3qpPuv7AlTnMbjBBQK4YTYenbdk2HgI41SVQHZHkU/+y4CL3Y1hWyJNo > C8CCWfR0VlA= > =YXIq > -----END PGP SIGNATURE----- From solipsis at pitrou.net Thu Sep 5 21:10:51 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Thu, 5 Sep 2013 21:10:51 +0200 Subject: [Python-Dev] Offtopic: OpenID Providers References: <5228C00F.7000209@jcea.es> Message-ID: <20130905211051.307f38ce@fsol> On Thu, 05 Sep 2013 19:31:59 +0200 Jesus Cea wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > I just received an email from my OpenID provider, "myOpenID", saying > that they drop OpenID service next February. I wonder what other > OpenID providers are used by other python-dev fellows. > > What are you using?. bugs.python.org admins could share some data? I use a self-hosted SimpleID instance: http://simpleid.koinic.net/ It works fine with python.org, except recent problems with PyPI for which I haven't had an answer yet: https://mail.python.org/pipermail/distutils-sig/2013-September/022583.html (sorry for the previous message, keyboard mishap) Regards Antoine. From a.badger at gmail.com Thu Sep 5 21:15:30 2013 From: a.badger at gmail.com (Toshio Kuratomi) Date: Thu, 5 Sep 2013 12:15:30 -0700 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130905145343.08d40db8@anarchist> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <20130905183347.GO10747@unaka.lan> <20130905145343.08d40db8@anarchist> Message-ID: <20130905191529.GP10747@unaka.lan> On Thu, Sep 05, 2013 at 02:53:43PM -0400, Barry Warsaw wrote: > > This probably isn't the only application of these technologies, but I've > always thought about OAuth as delegating authority to scripts and programs to > act on your behalf. For example, you can write a script to interact with > Launchpad's REST API, but before you can use the script, you have to interact > with the web ui once (since your browser is trusted, presumably) to receive a > token which the script can then use to prove that it's acting on your behalf. > If at some point you stop trusting that script, you can revoke the token to > disable its access, without having to reset your password. > > To me, OpenID is about logging into web sites using single-sign on. For > example, once I've logged into Launchpad, I can essentially go anywhere that > accepts OpenID, type my OpenID and generally not have to log in again (things > like two-factor auth and such may change that interaction pattern). > > Or to summarize to a rough approximation: OpenID is for logins, OAuth is for > scripts. > > Persona seems to fit the OpenID use case. You'd still want OAuth for > scripting. > However, in some cases, Persona/OpenID can make more sense for scripts. For instance, if you have a script that is primarily interactive in nature, it may be better to have the user login via that script than to have an OAuth token laying around on the filesystem all the time (Contrariwise, if the script is primarily run from cron or similar, it's better to have a token with limited permissions laying around on the filesystem than your OpenID password ;-) It's probably also useful to point out that OAuth (because it was developed to let third party websites have limited permission to act on your behalf) is more paranoid than strictly required for many scripts where that "third-party" is a script that you've written running on a box that you control. If that's the main use case for your service, OAuth may not be a good fit for your authz needs. -Toshio -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From solipsis at pitrou.net Thu Sep 5 21:07:33 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Thu, 5 Sep 2013 21:07:33 +0200 Subject: [Python-Dev] Offtopic: OpenID Providers References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> Message-ID: <20130905210733.29975b0a@fsol> On Thu, 5 Sep 2013 14:50:44 -0400 Donald Stufft wrote: > > On Sep 5, 2013, at 2:43 PM, Oleg Broytman wrote: > > > On Thu, Sep 05, 2013 at 02:35:16PM -0400, Donald Stufft wrote: > >> Persona is the logical successor to OpenID. > > > > OpenID lived a short life and died a quiet death. I'm afraid Persona > > wouldn't live even that much. Dead-born idea, in my so humble opinion. > > I don't think there's much evidence to support this. I'm seeing more sites support Persona > not less. Which sites exactly? I can login to BitBucket and *.python.org using OpenID, not Persona. From barry at python.org Thu Sep 5 21:40:44 2013 From: barry at python.org (Barry Warsaw) Date: Thu, 5 Sep 2013 15:40:44 -0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130905210733.29975b0a@fsol> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905210733.29975b0a@fsol> Message-ID: <20130905154044.44d93e67@anarchist> On Sep 05, 2013, at 09:07 PM, Antoine Pitrou wrote: >Which sites exactly? I can login to BitBucket and *.python.org using >OpenID, not Persona. I think Persona is just too new to see it around much yet. Or maybe Mozilla needs better PR. -Barry From skip at pobox.com Thu Sep 5 21:52:29 2013 From: skip at pobox.com (Skip Montanaro) Date: Thu, 5 Sep 2013 14:52:29 -0500 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130905154044.44d93e67@anarchist> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905210733.29975b0a@fsol> <20130905154044.44d93e67@anarchist> Message-ID: > I think Persona is just too new to see it around much yet. Or maybe Mozilla > needs better PR. The Persona site touts: "Signing in using Persona requires only a valid email address; allowing you to provide personal information on as-needed basis, when and where you think it?s appropriate." They clearly need a better example site. They chose something called Voost. Sure enough, all I needed to enter was my Gmail address. That got me signed in, but then Voost asked me for a bunch of other personal information (name, gender, birthdate, etc), and wouldn't let me go any farther without that. :-/ Skip From ben+python at benfinney.id.au Thu Sep 5 21:53:25 2013 From: ben+python at benfinney.id.au (Ben Finney) Date: Fri, 06 Sep 2013 05:53:25 +1000 Subject: [Python-Dev] Offtopic: OpenID Providers References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> Message-ID: <7wk3ivyrii.fsf@benfinney.id.au> Skip Montanaro writes: > >> On Thu, Sep 05, 2013 at 02:35:16PM -0400, Donald Stufft wrote: > >>> Persona is the logical successor to OpenID. > >> > >> OpenID lived a short life and died a quiet death. I'm afraid Persona > >> wouldn't live even that much. Dead-born idea, in my so humble opinion. > > > > I don't think there's much evidence to support this. I'm seeing more sites support Persona > > not less. It solves some of the major problems with OpenID. > > I was completely unaware of OpenID's demise. It has failed at its stated purpose, which was to obviate the need for services to provide their own ad hoc systems and allow users to consolidate their digital identities. This is evident by lookig at how few sites have added OpenID login in the past several years, and how many that once had it have dropped it. If you're unaware of that, I can only surmise you haven't been trying to log in with an OpenID to anything newer than about 2009. > Can someone point me to/provide an explanation? An explanation in terms of what? I can point you to punditry and hand-wringing . My own take is that most people choose convenience and expedience over security and freedom, hence Facebook and Twitter and Google have taken over the online identity game instead of a federated identity system. > I much prefer using OpenID to login to a site than having to either > come up with yet another username/password which I will just forget, > or using Facebook or similar (I don't really trust them with my info). Agreed. Our preferences are not enough though. -- \ ?Anyone who believes exponential growth can go on forever in a | `\ finite world is either a madman or an economist.? ?Kenneth | _o__) Boulding | Ben Finney From phd at phdru.name Thu Sep 5 22:29:21 2013 From: phd at phdru.name (Oleg Broytman) Date: Fri, 6 Sep 2013 00:29:21 +0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> Message-ID: <20130905202921.GA30331@iskra.aviel.ru> On Thu, Sep 05, 2013 at 02:50:44PM -0400, Donald Stufft wrote: > On Sep 5, 2013, at 2:43 PM, Oleg Broytman wrote: > > On Thu, Sep 05, 2013 at 02:35:16PM -0400, Donald Stufft wrote: > >> Persona is the logical successor to OpenID. > > > > OpenID lived a short life and died a quiet death. I'm afraid Persona > > wouldn't live even that much. Dead-born idea, in my so humble opinion. > > I don't think there's much evidence to support this. I'm seeing more sites support Persona > not less. It solves some of the major problems with OpenID. I have seen exactly 0 (zero) sites that support Persona. Can you point me? Oleg. -- Oleg Broytman http://phdru.name/ phd at phdru.name Programmers don't die, they just GOSUB without RETURN. From tseaver at palladion.com Thu Sep 5 22:30:31 2013 From: tseaver at palladion.com (Tres Seaver) Date: Thu, 05 Sep 2013 16:30:31 -0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905210733.29975b0a@fsol> <20130905154044.44d93e67@anarchist> Message-ID: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 09/05/2013 03:52 PM, Skip Montanaro wrote: >> I think Persona is just too new to see it around much yet. Or maybe >> Mozilla needs better PR. > > The Persona site touts: "Signing in using Persona requires only a > valid email address; allowing you to provide personal information on > as-needed basis, when and where you think it?s appropriate." > > They clearly need a better example site. They chose something called > Voost. Sure enough, all I needed to enter was my Gmail address. That > got me signed in, but then Voost asked me for a bunch of other > personal information (name, gender, birthdate, etc), and wouldn't let > me go any farther without that. :-/ As sith OpenID, the key element to Persona is SSO: you can authenticate without needing to create / remember passwords for every site you visit. Whether a given site chooses to authroize an authenticated-but-otherwise-unknown user to do anything meaningful is logically distinct. +1 for supporting Persona as an alternative to OpenID on all *.python.org servers. Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tseaver at palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with undefined - http://www.enigmail.net/ iEYEARECAAYFAlIo6ecACgkQ+gerLs4ltQ6gOwCgrIokRYnddNaNVIVPoY/M4d0k kKcAni6hxXQE4T4QMij3bQHAJwBFX1uW =9ZJP -----END PGP SIGNATURE----- From phd at phdru.name Thu Sep 5 22:36:51 2013 From: phd at phdru.name (Oleg Broytman) Date: Fri, 6 Sep 2013 00:36:51 +0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> Message-ID: <20130905203651.GB30331@iskra.aviel.ru> On Thu, Sep 05, 2013 at 02:07:11PM -0500, Skip Montanaro wrote: > >> OpenID lived a short life and died a quiet death. I'm afraid Persona > >> wouldn't live even that much. Dead-born idea, in my so humble opinion. > > > I was completely unaware of OpenID's demise. There was no demise. Because there was no take-off. OpenID was never popular. I can remember a very limited set of major sites that allow login using OpenID: SourceForge, LiveJournal, BitBucket. The first two in the list allow limited login. BitBucket doesn't allow even that. They only allow full-featured login if you have already created an account and linked your OpenID URL with that account. You cannot login using OpenID to most interesting popular sites. GMail? No. Twitter? No. Facebook? FriendFeed? identi.ca? No, no, no. Small uninteresting blogs? Yes, but who cares? Oleg. -- Oleg Broytman http://phdru.name/ phd at phdru.name Programmers don't die, they just GOSUB without RETURN. From v+python at g.nevcal.com Thu Sep 5 22:33:48 2013 From: v+python at g.nevcal.com (Glenn Linderman) Date: Thu, 05 Sep 2013 13:33:48 -0700 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905210733.29975b0a@fsol> <20130905154044.44d93e67@anarchist> Message-ID: <5228EAAC.2020800@g.nevcal.com> On 9/5/2013 1:30 PM, Tres Seaver wrote: > +1 for supporting Persona as an alternative to OpenID on all *.python.org > servers. Is there a Python implementation of Persona I can install on my web server? -------------- next part -------------- An HTML attachment was scrubbed... URL: From solipsis at pitrou.net Thu Sep 5 22:40:47 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Thu, 5 Sep 2013 22:40:47 +0200 Subject: [Python-Dev] Offtopic: OpenID Providers References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905210733.29975b0a@fsol> <20130905154044.44d93e67@anarchist> Message-ID: <20130905224047.1867fdee@fsol> On Thu, 5 Sep 2013 15:40:44 -0400 Barry Warsaw wrote: > On Sep 05, 2013, at 09:07 PM, Antoine Pitrou wrote: > > >Which sites exactly? I can login to BitBucket and *.python.org using > >OpenID, not Persona. > > I think Persona is just too new to see it around much yet. Or maybe Mozilla > needs better PR. Well, OpenID at least got some publicity since it appeared. Persona is almost unknown at this point (though it was publicly launched two years ago, according to Wikipedia). Comparing the size of the respective Wikipedia pages actually tells quite a bit: http://en.wikipedia.org/wiki/OpenID http://en.wikipedia.org/wiki/Mozilla_Persona Regards Antoine. From fred at fdrake.net Thu Sep 5 22:37:25 2013 From: fred at fdrake.net (Fred Drake) Date: Thu, 5 Sep 2013 16:37:25 -0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130905202921.GA30331@iskra.aviel.ru> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905202921.GA30331@iskra.aviel.ru> Message-ID: On Thu, Sep 5, 2013 at 4:29 PM, Oleg Broytman wrote: > I have seen exactly 0 (zero) sites that support Persona. Can you > point me? We have an internal app that uses Persona, but we did that mostly to play with it. I've not run across any sites that use Persona in the wild, either. -Fred -- Fred L. Drake, Jr. "A storm broke loose in my mind." --Albert Einstein From benjamin at python.org Thu Sep 5 22:45:57 2013 From: benjamin at python.org (Benjamin Peterson) Date: Thu, 5 Sep 2013 16:45:57 -0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <5228EAAC.2020800@g.nevcal.com> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905210733.29975b0a@fsol> <20130905154044.44d93e67@anarchist> <5228EAAC.2020800@g.nevcal.com> Message-ID: There's some sample Python code here: https://developer.mozilla.org/en-US/docs/Mozilla/Persona/Quick_Setup The API is so simple something generic like requests suffices. 2013/9/5 Glenn Linderman : > On 9/5/2013 1:30 PM, Tres Seaver wrote: > > +1 for supporting Persona as an alternative to OpenID on all *.python.org > servers. > > > Is there a Python implementation of Persona I can install on my web server? > > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/benjamin%40python.org > -- Regards, Benjamin From skip at pobox.com Thu Sep 5 22:42:17 2013 From: skip at pobox.com (Skip Montanaro) Date: Thu, 5 Sep 2013 15:42:17 -0500 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905210733.29975b0a@fsol> <20130905154044.44d93e67@anarchist> Message-ID: > Whether a given site chooses to authroize an > authenticated-but-otherwise-unknown user to do anything meaningful is > logically distinct. But the least they could have done was pick a demo site that didn't do exactly what they contend you shouldn't need to do: cough up all sorts of personal information to use their site. Skip From barry at python.org Thu Sep 5 22:53:18 2013 From: barry at python.org (Barry Warsaw) Date: Thu, 5 Sep 2013 16:53:18 -0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130905203651.GB30331@iskra.aviel.ru> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905203651.GB30331@iskra.aviel.ru> Message-ID: <20130905165318.2fa40bab@anarchist> On Sep 06, 2013, at 12:36 AM, Oleg Broytman wrote: > You cannot login using OpenID to most interesting popular sites. >GMail? No. Twitter? No. Facebook? FriendFeed? identi.ca? No, no, no. I'd be surprised if you ever saw the big social networking sites support OpenID or Persona. They want to own that space themselves, so probably have no business incentive to support 3rd party systems. We're open source, and I think it benefits our mission to support open, decentralized, and free systems like OpenID and Persona. -Barry From donald at stufft.io Thu Sep 5 22:57:08 2013 From: donald at stufft.io (Donald Stufft) Date: Thu, 5 Sep 2013 16:57:08 -0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130905165318.2fa40bab@anarchist> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905203651.GB30331@iskra.aviel.ru> <20130905165318.2fa40bab@anarchist> Message-ID: <00E21A32-DEC0-4CB0-A9AA-CDE3E2307D86@stufft.io> On Sep 5, 2013, at 4:53 PM, Barry Warsaw wrote: > On Sep 06, 2013, at 12:36 AM, Oleg Broytman wrote: > >> You cannot login using OpenID to most interesting popular sites. >> GMail? No. Twitter? No. Facebook? FriendFeed? identi.ca? No, no, no. > > I'd be surprised if you ever saw the big social networking sites support > OpenID or Persona. They want to own that space themselves, so probably have > no business incentive to support 3rd party systems. Not that it changes this statement at all but you wouldn't expect to see a Persona login for gmail as persona solves the problem that people don't think of urls as personal identifiers by replacing it with emails. So Gmail would be the Persona IdP > > We're open source, and I think it benefits our mission to support open, > decentralized, and free systems like OpenID and Persona. > > -Barry > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/donald%40stufft.io ----------------- Donald Stufft PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: Message signed with OpenPGP using GPGMail URL: From tseaver at palladion.com Thu Sep 5 22:58:19 2013 From: tseaver at palladion.com (Tres Seaver) Date: Thu, 05 Sep 2013 16:58:19 -0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130905202921.GA30331@iskra.aviel.ru> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905202921.GA30331@iskra.aviel.ru> Message-ID: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 09/05/2013 04:29 PM, Oleg Broytman wrote: > On Thu, Sep 05, 2013 at 02:50:44PM -0400, Donald Stufft > wrote: >> On Sep 5, 2013, at 2:43 PM, Oleg Broytman wrote: >>> On Thu, Sep 05, 2013 at 02:35:16PM -0400, Donald Stufft >>> wrote: >>>> Persona is the logical successor to OpenID. >>> >>> OpenID lived a short life and died a quiet death. I'm afraid >>> Persona wouldn't live even that much. Dead-born idea, in my so >>> humble opinion. >> >> I don't think there's much evidence to support this. I'm seeing more >> sites support Persona not less. It solves some of the major problems >> with OpenID. > > I have seen exactly 0 (zero) sites that support Persona. Can you point > me? - From the "Mozilla Identity" blog: - - https://webmaker.org/ - - http://bornthiswayfoundation.org/ - - http://firebase.com/ - - https://orionhub.org/ - - http://ting.com/ - - http://www.gnu.org/software/mailman/ - - http://discourse.org/ - - https://dailycred.com/ Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tseaver at palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with undefined - http://www.enigmail.net/ iEYEARECAAYFAlIo8GoACgkQ+gerLs4ltQ5OtACdEv/XvYKwGuFQESuLn+uBkNzm UUAAn2YY22+YL+tS0WhE+95tIb0USmV7 =cB96 -----END PGP SIGNATURE----- From dirkjan at ochtman.nl Thu Sep 5 23:03:17 2013 From: dirkjan at ochtman.nl (Dirkjan Ochtman) Date: Thu, 5 Sep 2013 23:03:17 +0200 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <5228EAAC.2020800@g.nevcal.com> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905210733.29975b0a@fsol> <20130905154044.44d93e67@anarchist> <5228EAAC.2020800@g.nevcal.com> Message-ID: On Thu, Sep 5, 2013 at 10:33 PM, Glenn Linderman wrote: > Is there a Python implementation of Persona I can install on my web server? If you mean to use your web server as an Identity Provider, try this: https://bitbucket.org/djc/persona-totp It currently only implements TOTP-based authentication (i.e. no passwords), but it should be easy to add a password or 2FA-mode if you'd prefer that. Cheers, Dirkjan From tseaver at palladion.com Thu Sep 5 23:01:23 2013 From: tseaver at palladion.com (Tres Seaver) Date: Thu, 05 Sep 2013 17:01:23 -0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <5228EAAC.2020800@g.nevcal.com> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905210733.29975b0a@fsol> <20130905154044.44d93e67@anarchist> <5228EAAC.2020800@g.nevcal.com> Message-ID: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 09/05/2013 04:33 PM, Glenn Linderman wrote: > On 9/5/2013 1:30 PM, Tres Seaver wrote: >> +1 for supporting Persona as an alternative to OpenID on all >> *.python.org servers. > > Is there a Python implementation of Persona I can install on my web > server? - - https://readthedocs.org/projects/django-browserid/ - - https://pyramid_persona.readthedocs.org/en/latest/ Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tseaver at palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with undefined - http://www.enigmail.net/ iEYEARECAAYFAlIo8SMACgkQ+gerLs4ltQ57xgCfT2xVkJfMtuDjmed6jlhfsD8I fxMAoNHT69tbi3iKtpkyEcSY0lwJosqc =TTJ8 -----END PGP SIGNATURE----- From dirkjan at ochtman.nl Thu Sep 5 23:05:55 2013 From: dirkjan at ochtman.nl (Dirkjan Ochtman) Date: Thu, 5 Sep 2013 23:05:55 +0200 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <00E21A32-DEC0-4CB0-A9AA-CDE3E2307D86@stufft.io> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905203651.GB30331@iskra.aviel.ru> <20130905165318.2fa40bab@anarchist> <00E21A32-DEC0-4CB0-A9AA-CDE3E2307D86@stufft.io> Message-ID: On Thu, Sep 5, 2013 at 10:57 PM, Donald Stufft wrote: > Not that it changes this statement at all but you wouldn't expect to see a Persona login > for gmail as persona solves the problem that people don't think of urls as personal > identifiers by replacing it with emails. So Gmail would be the Persona IdP And actually you can already trivially login with your GMail account on any Persona-based Relying Party (that is, a site that uses Persona to authenticate you). This is because one of the nice parts of the current implementation of Persona is that Mozilla has implemented bridges that allow GMail and Yahoo addresses to be authenticated via their respective OAuth implementations, such that you don't need to setup an account at Mozilla's fallback IdP (which acts as an Identity Provider for email addresses that don't currently have an IdP available to them). Cheers, Dirkjan From dirkjan at ochtman.nl Thu Sep 5 23:08:13 2013 From: dirkjan at ochtman.nl (Dirkjan Ochtman) Date: Thu, 5 Sep 2013 23:08:13 +0200 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905210733.29975b0a@fsol> <20130905154044.44d93e67@anarchist> Message-ID: On Thu, Sep 5, 2013 at 10:30 PM, Tres Seaver wrote: > +1 for supporting Persona as an alternative to OpenID on all *.python.org > servers. BTW, I'd be happy to assist with any Persona RP implementations for python.org services. The MDN docs are pretty good, I got my first RP going in just a few hours of looking at code (and you can probably do better if you're more into frontend webdev stuff). There's also ongoing work that will replace ReadTheDocs accounts with Persona support. Cheers, Dirkjan From phd at phdru.name Thu Sep 5 23:09:24 2013 From: phd at phdru.name (Oleg Broytman) Date: Fri, 6 Sep 2013 01:09:24 +0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130905165318.2fa40bab@anarchist> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905203651.GB30331@iskra.aviel.ru> <20130905165318.2fa40bab@anarchist> Message-ID: <20130905210924.GA30649@iskra.aviel.ru> On Thu, Sep 05, 2013 at 04:53:18PM -0400, Barry Warsaw wrote: > On Sep 06, 2013, at 12:36 AM, Oleg Broytman wrote: > > You cannot login using OpenID to most interesting popular sites. > >GMail? No. Twitter? No. Facebook? FriendFeed? identi.ca? No, no, no. > > I'd be surprised if you ever saw the big social networking sites support > OpenID or Persona. They want to own that space themselves, so probably have > no business incentive to support 3rd party systems. But of course! And that IMO spells the end of the feature. Things that aren't available for millions seldom are available for a few, and if they are -- they are available for big price. > We're open source, and I think it benefits our mission to support open, > decentralized, and free systems like OpenID and Persona. But they also have disadvantages. Implementing such a major feature is a significant burden to sysadmins and is an additional vein for security breaches. That said, I don't mind if pydotorg would get such features. If FSF pays salaries and admins are willing to work -- no objections from me. But I am not going to use it. What gain if I can login to one site? I will change my mind when Google and GitHub start using them. Oleg. -- Oleg Broytman http://phdru.name/ phd at phdru.name Programmers don't die, they just GOSUB without RETURN. From phd at phdru.name Thu Sep 5 23:25:10 2013 From: phd at phdru.name (Oleg Broytman) Date: Fri, 6 Sep 2013 01:25:10 +0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905202921.GA30331@iskra.aviel.ru> Message-ID: <20130905212510.GB30649@iskra.aviel.ru> On Thu, Sep 05, 2013 at 04:58:19PM -0400, Tres Seaver wrote: > On 09/05/2013 04:29 PM, Oleg Broytman wrote: > > I have seen exactly 0 (zero) sites that support Persona. Can you point > > me? > > - From the "Mozilla Identity" blog: > > - - https://webmaker.org/ > - - http://bornthiswayfoundation.org/ > - - http://firebase.com/ > - - https://orionhub.org/ > - - http://ting.com/ > - - http://www.gnu.org/software/mailman/ > - - http://discourse.org/ > - - https://dailycred.com/ Thank you! Never heard of these sites. Well, I saw WebMaker once, but it's a Mozilla site, no wonder it supports Persona. Oleg. -- Oleg Broytman http://phdru.name/ phd at phdru.name Programmers don't die, they just GOSUB without RETURN. From barry at python.org Thu Sep 5 23:29:07 2013 From: barry at python.org (Barry Warsaw) Date: Thu, 5 Sep 2013 17:29:07 -0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130905210924.GA30649@iskra.aviel.ru> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905203651.GB30331@iskra.aviel.ru> <20130905165318.2fa40bab@anarchist> <20130905210924.GA30649@iskra.aviel.ru> Message-ID: <20130905172907.67a08d29@anarchist> On Sep 06, 2013, at 01:09 AM, Oleg Broytman wrote: >I will change my mind when Google and GitHub start using them. Neither Google nor GitHub are free or open. Bitbucket and Facebook aren't either. I'm not saying they're bad services because of that of course, but I don't want to have to rely on any of them to access python.org resources, and I don't want my choice to be log into Facebook or manage a slew of passwords. But I'm not volunteering to do the work, so I don't get to decide. I'm just stating that I think our principle should be that you *can* (not *must*) use free and open services to access our resources. -Barry From victor.stinner at gmail.com Thu Sep 5 23:30:03 2013 From: victor.stinner at gmail.com (Victor Stinner) Date: Thu, 5 Sep 2013 23:30:03 +0200 Subject: [Python-Dev] RFC: PEP 454: Add a new tracemalloc module In-Reply-To: References: Message-ID: 2013/9/5 Alexander Belopolsky : > Please mention that this API is similar to that of faulthandler and add a > link to faulthandler docs. Done. Victor From victor.stinner at gmail.com Thu Sep 5 23:30:53 2013 From: victor.stinner at gmail.com (Victor Stinner) Date: Thu, 5 Sep 2013 23:30:53 +0200 Subject: [Python-Dev] Add a new tracemalloc module to trace memory allocations In-Reply-To: References: Message-ID: 2013/9/1 Nick Coghlan : > +1 from me for both tracemalloc and failmalloc in the same vein as > faulthandler (and using similar API concepts to faulthandler). > > While I like the flat top level naming structure, we should clearly document > these as implementation dependent runtime services. Other implementations > may not provide them at all, and even if they do, many details will likely > be different. > > The gc module may even fall into the same category. I updated the PEP 454 to mention that tracemalloc has been written for CPython. Victor From victor.stinner at gmail.com Thu Sep 5 23:37:52 2013 From: victor.stinner at gmail.com (Victor Stinner) Date: Thu, 5 Sep 2013 23:37:52 +0200 Subject: [Python-Dev] Add a new tracemalloc module to trace memory allocations In-Reply-To: References: Message-ID: 2013/8/31 Gregory P. Smith : > Think of the possibilities, you could even setup a test runner to > enable/disable before and after each test, test suite or test module to > gather narrow statistics as to what code actually _caused_ the allocations > rather than the ultimate individual file/line doing it. It may be used with "-m test -R" to detect memory leaks, you need to repeat a test. > Taking that further: file and line information is great, but what if you > extend the concept: could you allow for C API or even Python hooks to gather > additional information at the time of each allocation or free? for example: > Gathering the actual C and Python stack traces for correlation to figure out > what call patterns lead allocations is powerful. I modified the PEP 454 and the implementation. By default, tracemalloc only stores 1 "frame" instance (filename and line number). But you can now use tracemalloc.set_number_frame(10) to store 10 frames per memory allocation. Don't store too much frames, remember that tracemalloc traces all Python memory allocations! So when Python allocates 1 byte, tracemalloc may need to allocate 1000 bytes to store the trace... tracemalloc cannot get the C traceback. It was discussed in the design of the PEP 445 (Add new APIs to customize Python memory allocators) how to pass the C filename and line number. It was decided to not add them to have a simpler API. In general, a C function is binded to a Python function. Knowing the Python function should be enough. Victor From phd at phdru.name Thu Sep 5 23:56:22 2013 From: phd at phdru.name (Oleg Broytman) Date: Fri, 6 Sep 2013 01:56:22 +0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130905172907.67a08d29@anarchist> References: <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905203651.GB30331@iskra.aviel.ru> <20130905165318.2fa40bab@anarchist> <20130905210924.GA30649@iskra.aviel.ru> <20130905172907.67a08d29@anarchist> Message-ID: <20130905215622.GA31833@iskra.aviel.ru> On Thu, Sep 05, 2013 at 05:29:07PM -0400, Barry Warsaw wrote: > I don't want my choice to be log into Facebook or manage a slew of passwords. The last part is unavoidable. I regularly login to LiveJournal, Twitter, SourceForge, BitBucket, Gitorious, GitHub and to hundreds of other sites -- blogs, torrents, web shops. I already manage hundreds of passwords. OpenID promised to save me from that and failed. Do you think Persona would succeed in this regard (saved me from managing all those passwords)? And if not -- what are the benefits? I already manage hundreds of passwords -- two or three additional passwords for bugs.python.org, wiki.python.org and so on don't make the situation worse. IMO the very idea of single sign-on in the open web is meaningless. > But I'm not volunteering to do the work, so I don't get to decide. I'm just > stating that I think our principle should be that you *can* (not *must*) use > free and open services to access our resources. Well, I can only use services that are available, not those that are promised. If python.org grows support for Persona -- who will be my provider and for what price? I am not going to install and manage additional software on my servers -- I don't want to be my own provider, I have enough job already. Oleg. -- Oleg Broytman http://phdru.name/ phd at phdru.name Programmers don't die, they just GOSUB without RETURN. From donald at stufft.io Fri Sep 6 00:07:36 2013 From: donald at stufft.io (Donald Stufft) Date: Thu, 5 Sep 2013 18:07:36 -0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130905215622.GA31833@iskra.aviel.ru> References: <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905203651.GB30331@iskra.aviel.ru> <20130905165318.2fa40bab@anarchist> <20130905210924.GA30649@iskra.aviel.ru> <20130905172907.67a08d29@anarchist> <20130905215622.GA31833@iskra.aviel.ru> Message-ID: <637EAFBD-9870-48BD-9206-A8B67B4DBCD3@stufft.io> On Sep 5, 2013, at 5:56 PM, Oleg Broytman wrote: > On Thu, Sep 05, 2013 at 05:29:07PM -0400, Barry Warsaw wrote: >> I don't want my choice to be log into Facebook or manage a slew of passwords. > > The last part is unavoidable. I regularly login to LiveJournal, > Twitter, SourceForge, BitBucket, Gitorious, GitHub and to hundreds of > other sites -- blogs, torrents, web shops. I already manage hundreds of > passwords. OpenID promised to save me from that and failed. Do you think > Persona would succeed in this regard (saved me from managing all those > passwords)? And if not -- what are the benefits? I already manage > hundreds of passwords -- two or three additional passwords for > bugs.python.org, wiki.python.org and so on don't make the situation > worse. > IMO the very idea of single sign-on in the open web is meaningless. > >> But I'm not volunteering to do the work, so I don't get to decide. I'm just >> stating that I think our principle should be that you *can* (not *must*) use >> free and open services to access our resources. > > Well, I can only use services that are available, not those that are > promised. If python.org grows support for Persona -- who will be my > provider and for what price? I am not going to install and manage > additional software on my servers -- I don't want to be my own provider, > I have enough job already. Theoretically whoever runs the domain for your email address (since Persona uses email as your identifier). In order to make it work as a stop gap they also have more openid like idP's which they run a major one (that also offers a "bridge" to make things like Gmail work on Persona without needing to register for anything else). > > Oleg. > -- > Oleg Broytman http://phdru.name/ phd at phdru.name > Programmers don't die, they just GOSUB without RETURN. > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/donald%40stufft.io ----------------- Donald Stufft PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: Message signed with OpenPGP using GPGMail URL: From stephen at xemacs.org Fri Sep 6 03:09:26 2013 From: stephen at xemacs.org (Stephen J. Turnbull) Date: Fri, 06 Sep 2013 10:09:26 +0900 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130905165318.2fa40bab@anarchist> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905203651.GB30331@iskra.aviel.ru> <20130905165318.2fa40bab@anarchist> Message-ID: <87hadyah89.fsf@uwakimon.sk.tsukuba.ac.jp> Barry Warsaw writes: > On Sep 06, 2013, at 12:36 AM, Oleg Broytman wrote: > > You cannot login using OpenID to most interesting popular sites. > >GMail? No. Twitter? No. Facebook? FriendFeed? identi.ca? No, no, no. > > I'd be surprised if you ever saw the big social networking sites support > OpenID or Persona. They want to own that space themselves, so probably have > no business incentive to support 3rd party systems. Quite the reverse, unfortunately. That's why *those* sites *all* appear on most sites that support OpenID. They're not going to delegate to each other until they are forced to. > We're open source, and I think it benefits our mission to support open, > decentralized, and free systems like OpenID and Persona. Thus speaks an employee of yet another Provider-That-Won't-Accept-My- Third-Party-Credentials. Sorry, Barry, but you see the problem: Unfortunately, we can't do it alone. What needs to happen is there needs to be a large network of sites that support login via O-D-F systems like OpenID and Persona. Too many of the sites I use (news sources, GMail, etc) don't support them and my browser manages my logins to most of them, so why bother learning OpenID, and then setting it up site by site? I'm not against it, but it's quixotic (and therefore valuable). One reason that OpenID and Persona fail to achieve penetration is that they overstate their mission. A protocol that any email provider can support is a protocol that provides authentication without identification (imagine what havoc Dogbert could wreak with his own Persona provider), and therefore cannot be used in authorization (except trivially). Think ident (port tcp/113). And most general- audience sites that want to provide high-quality "Web 2.0" service are going to start by asking for your demographics. It's probably at least as effective as CAPTCHA for classifying mammals and 'bots, too! The reason that the "big" providers can take advantage of these protocols as providers without reciprocating as clients is that identities on these sites are very valuable to at least 95% of people who use them (that may or may not correspond to as much as 50% of the accounts). Losing your Facebook site for abuse of TOS is very costly: you can't even contact your "circle" easily. Nor do you want multiple logins on one of these sites, because that will double the amount of spam they send you. Bottom line: A login via Facebook-provided OpenID means that the login is unlikely to perform random mischief. Of course, those issues are easy to deal with if you have even a bit of Internet savvy. So sites still have to worry about a deliberate attack from a Facebook user, but a serious intruder has many ways to get in the front door, so you need to lock up your Waterford crystal and Noritake china anyway whether you support global ID logins or not. From jcea at jcea.es Fri Sep 6 03:43:53 2013 From: jcea at jcea.es (Jesus Cea) Date: Fri, 06 Sep 2013 03:43:53 +0200 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <7wk3ivyrii.fsf@benfinney.id.au> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <7wk3ivyrii.fsf@benfinney.id.au> Message-ID: <52293359.4080304@jcea.es> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 05/09/13 21:53, Ben Finney wrote: > My own take is that most people choose convenience and expedience > over security and freedom, hence Facebook and Twitter and Google > have taken over the online identity game instead of a federated > identity system. That is one of the Persona improvements: If your email provider is not supporting it, you can still use your email with "persona" (thru Mozilla servers). If you provider support OAUTH authentication (let say, Facebook, twitter, Google), You can use that identity to prove your identity to Mozilla, and Mozilla to prove your email ID to any Persona consumer. In the process, you get privacy (facebook doesn't know where are you using authentication, beside Mozilla). Being a Persona provider is easy, being a verifier is trivial. An interesting property of Persona is that if its popularity grows, it becomes decentralized "autom?gically". Anyway, I was asking for alternative OpenID providers, not to open a debate about single sign on methods :). - -- Jes?s Cea Avi?n _/_/ _/_/_/ _/_/_/ jcea at jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/ Twitter: @jcea _/_/ _/_/ _/_/_/_/_/ jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/ _/_/ _/_/ "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ "El amor es poner tu felicidad en la felicidad de otro" - Leibniz -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQCVAwUBUikzWZlgi5GaxT1NAQJMbgP/enbARAwUiDXzJ9PkBmvlAi/OrhXrrXwE Vf1f6XHab+ERyJ6kj1V5yz6F0D0zxl6s7GL+abz7P0JEdGEGMfEJc+aK15HM2r3b LAm9k5ofe+ysdJx0HEd/V6/viqAeK7medb5Hh3xNwxbY6qRe4VkXbAvc0KQuo7eR 1Uf005ibUT8= =i0/D -----END PGP SIGNATURE----- From jcea at jcea.es Fri Sep 6 03:51:30 2013 From: jcea at jcea.es (Jesus Cea) Date: Fri, 06 Sep 2013 03:51:30 +0200 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130905203651.GB30331@iskra.aviel.ru> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905203651.GB30331@iskra.aviel.ru> Message-ID: <52293522.2060304@jcea.es> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 05/09/13 22:36, Oleg Broytman wrote: > There was no demise. Because there was no take-off. OpenID was > never popular. I can remember a very limited set of major sites > that allow login using OpenID: SourceForge, LiveJournal, BitBucket. > The first two I remember a day where OpenID was the ONLY authentication method in StackOverflow. - -- Jes?s Cea Avi?n _/_/ _/_/_/ _/_/_/ jcea at jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/ Twitter: @jcea _/_/ _/_/ _/_/_/_/_/ jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/ _/_/ _/_/ "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ "El amor es poner tu felicidad en la felicidad de otro" - Leibniz -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQCVAwUBUik1Iplgi5GaxT1NAQKHGQP/ayFi3hs5CWwlNCciFguNkUesQBfRaPFF TxHrloNM2Uo9wB2dt2oAVhAQnGSTw3lIYoRMzhk5+tfx4Bn16QVPiDXnbotO5xqn QkAH3ZE9q9/YTDDqPJPFXHP/7eoQwk9Ou4LrTJk97ofp0DM7JcfVm3W0Sys53wEQ ddwoNkrIk/s= =vFd+ -----END PGP SIGNATURE----- From jcea at jcea.es Fri Sep 6 03:52:35 2013 From: jcea at jcea.es (Jesus Cea) Date: Fri, 06 Sep 2013 03:52:35 +0200 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130905215622.GA31833@iskra.aviel.ru> References: <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905203651.GB30331@iskra.aviel.ru> <20130905165318.2fa40bab@anarchist> <20130905210924.GA30649@iskra.aviel.ru> <20130905172907.67a08d29@anarchist> <20130905215622.GA31833@iskra.aviel.ru> Message-ID: <52293563.5070206@jcea.es> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 05/09/13 23:56, Oleg Broytman wrote: > Well, I can only use services that are available, not those that > are promised. If python.org grows support for Persona -- who will > be my provider and for what price? I am not going to install and > manage additional software on my servers -- I don't want to be my > own provider, I have enough job already. If your email provider is not supporting Persona, the automatic fallback is Mozilla, a non-profit, free web, I care about your privacy, organization. - -- Jes?s Cea Avi?n _/_/ _/_/_/ _/_/_/ jcea at jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/ Twitter: @jcea _/_/ _/_/ _/_/_/_/_/ jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/ _/_/ _/_/ "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ "El amor es poner tu felicidad en la felicidad de otro" - Leibniz -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQCVAwUBUik1Y5lgi5GaxT1NAQLKjwP9EXXmMTVORDPOCK5ByBfrwveL71nG/1IJ oTc0ZUjZPMp/JD2UBnibEUIhxJHtmAkTsuMTmNsSbzqx6F74n9zYokfMK4Y0iscC 2EpqDe7lcAzEjJXpIa93A/K8/fh3gaufWHAXND3Ynr7gMdlLkn9jRiXoVMHHX3Sm lEIX/47kzlI= =4+OP -----END PGP SIGNATURE----- From jcea at jcea.es Fri Sep 6 03:54:01 2013 From: jcea at jcea.es (Jesus Cea) Date: Fri, 06 Sep 2013 03:54:01 +0200 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130905202921.GA30331@iskra.aviel.ru> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905202921.GA30331@iskra.aviel.ru> Message-ID: <522935B9.9030208@jcea.es> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 05/09/13 22:29, Oleg Broytman wrote: > I have seen exactly 0 (zero) sites that support Persona. Can you > point me? "Python Espa?a" (Python Spain) association is going to provide Persona Only login. Deployment in four weeks. - -- Jes?s Cea Avi?n _/_/ _/_/_/ _/_/_/ jcea at jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/ Twitter: @jcea _/_/ _/_/ _/_/_/_/_/ jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/ _/_/ _/_/ "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ "El amor es poner tu felicidad en la felicidad de otro" - Leibniz -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQCVAwUBUik1uZlgi5GaxT1NAQIA3wP/eH0HA+gxa/9c1S679lmC7GVoBqahWyWS mmOnIg170MaozIxyjgLruReTKdnfhcFa/QxxWLpS7brGenOSA1UCXdOhRHRTpf5y JMtQ/f1pmS3sdjEIal2F6Fm1Dt1i6YFZr813j9hdzVHgcx96PuxTx5UVO3LpAAkf +edD8PBn3eM= =y1Ri -----END PGP SIGNATURE----- From jcea at jcea.es Fri Sep 6 03:56:55 2013 From: jcea at jcea.es (Jesus Cea) Date: Fri, 06 Sep 2013 03:56:55 +0200 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: References: <5228C00F.7000209@jcea.es> Message-ID: <52293667.8030609@jcea.es> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 05/09/13 20:45, Eli Bendersky wrote: > PS: I use "http://www.jcea.es/" as my OpenID identity, and I > delegate the actual service to "myOpenID". I can switch delegation > trivially. > > http://bugs.python.org/?@action=openid_login&provider=Google Sorry, Google, Facebook, Twitter, etc., are not acceptable OpenID providers for me. I should have made that point in my original email. My excuses. Any other suggestion? - -- Jes?s Cea Avi?n _/_/ _/_/_/ _/_/_/ jcea at jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/ Twitter: @jcea _/_/ _/_/ _/_/_/_/_/ jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/ _/_/ _/_/ "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ "El amor es poner tu felicidad en la felicidad de otro" - Leibniz -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQCVAwUBUik2Z5lgi5GaxT1NAQJEtQP+NdOaMbAB4LzgsUfoL1yelPcYA8wg2rnd WjM7IEsfcs/3NFrmpg9XxjJqSwoxgqW8NqpcQLapGSUdqUxMrhYz3xUnXzSUmM75 IwxUWlTuVVQkscRWwrmIjqMWD20EI3KtmGBtCH5J1Tnmb1EeTH4+wrtpBcl3hBUi Ph8+Afy+E6w= =VkCq -----END PGP SIGNATURE----- From ericsnowcurrently at gmail.com Fri Sep 6 07:26:31 2013 From: ericsnowcurrently at gmail.com (Eric Snow) Date: Thu, 5 Sep 2013 23:26:31 -0600 Subject: [Python-Dev] Pre-PEP: Redesigning extension modules In-Reply-To: References: Message-ID: On Sat, Aug 24, 2013 at 7:07 AM, Stefan Behnel wrote: > PEP 3121 would no longer be necessary. Extension types can do all we need. > No more special casing of modules, that was the idea. > One nice thing about PEP 3121 is the addition of md_state to module objects to store internal module state. Wouldn't we be better served by improving the related API rather than abandoning it? If md_state were the home for all mutable internal state then load/reload could focus directly on just md_state and md_dict and not worry about other internal state, since all remaining state would be immutable (refcounts notwithstanding). If the API made this easier then we could leverage the strengths of PEP 3121 to make loading safer and more independent. Of course, we could certainly go the other way and actively discourage mutable internal state... This, coupled with the PEP 451-compatible API and with a proxying wrapper, would go a long way to various "reloading" issues that extension modules have. On Sun, Aug 25, 2013 at 5:54 AM, Stefan Behnel wrote: > (regarding reloading into the existing module's namespace) > > I'm not sure this can be done in general. What if the module has threads > running that access the global state? In that case, reinitialising the > module object itself would almost certainly lead to a crash. > > And what if you do "from extmodule import some_function" in a Python > module? Then reloading couldn't replace that reference, just as for normal > Python modules. Meaning that you'd still have to keep both modules properly > alive in order to prevent crashes due to lost global state of the imported > function. > > The difference to Python modules here is that in Python code, you'll get > some kind of exception if state is lost during a reload. In C code, you'll > most likely get a crash. > > How would you even make sure global state is properly cleaned up? Would you > call tp_clear() on the module object before re-running the init code? Or > how else would you enable the init code to do the right thing during both > the first run (where global state is uninitialised) and subsequent runs > (where global state may hold valid state and owned Python references)? > > Even tp_clear() may not be enough, because it's only meant to clean up > Python references, not C-level state. Basically, for reloading to be > correct without changing the object reference, it would have to go all the > way through tp_dealloc(), catch the object at the very end, right before it > gets freed, and then re-initialise it. > Right. It would probably require a separate `PyImportInitializeState_(PyObject *mod)` and/or some API that helps make it easier to manage mutable internal module state (on md_state). On Sun, Aug 25, 2013 at 6:36 AM, Stefan Behnel wrote: > PJ Eby, 25.08.2013 06:12: > > My "Importing" package offers lazy imports by creating module objects > > in sys.modules that are a subtype of ModuleType, and use a > > __getattribute__ hook so that trying to use them fires off a reload() > > of the module. > > I wonder if this wouldn't be an approach to fix the reloading problem in > general. What if extension module loading, at least with the new scheme, > didn't return the module object itself and put it into sys.modules but > created a wrapper that redirects its __getattr__ and __setattr__ to the > actual module object? That would have a tiny performance impact on > attribute access, but I'd expect that to be negligible given that the usual > reason for the extension module to exist is that it does non-trivial stuff > in whatever its API provides. Reloading could then really create a > completely new module object and replace the reference inside of the > wrapper. > > That way, code that currently uses "from extmodule import xyz" would > continue to see the original version of the module as of the time of its > import, and code that just did "import extmodule" and then used attribute > access at need would always see the current content of the module as it was > last loaded. I think that, together with keeping module global state in the > module object itself, would nicely fix both cases. > At first blush I like this. -eric p.s. Bear with me if I've missed something in the thread. I'm slogging through a backlog of email -------------- next part -------------- An HTML attachment was scrubbed... URL: From solipsis at pitrou.net Fri Sep 6 07:43:48 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Fri, 6 Sep 2013 07:43:48 +0200 Subject: [Python-Dev] Pre-PEP: Redesigning extension modules References: Message-ID: <20130906074348.2779de48@fsol> On Thu, 5 Sep 2013 23:26:31 -0600 Eric Snow wrote: > On Sat, Aug 24, 2013 at 7:07 AM, Stefan Behnel wrote: > > > PEP 3121 would no longer be necessary. Extension types can do all we need. > > No more special casing of modules, that was the idea. > > > > One nice thing about PEP 3121 is the addition of md_state to module objects > to store internal module state. Wouldn't we be better served by improving > the related API rather than abandoning it? md_state isn't a PyObject and therefore its lifetime management is quirky (as Py_buffer, same bad idea). So I'd be happy for it to disappear from the next API. > This, coupled with the PEP 451-compatible API and with a proxying wrapper, > would go a long way to various "reloading" issues that extension modules > have. Proxying wrapper? We shouldn't need that kind of tricks. Regards Antoine. From ericsnowcurrently at gmail.com Fri Sep 6 07:47:25 2013 From: ericsnowcurrently at gmail.com (Eric Snow) Date: Thu, 5 Sep 2013 23:47:25 -0600 Subject: [Python-Dev] Pre-PEP: Redesigning extension modules In-Reply-To: References: Message-ID: On Sat, Aug 24, 2013 at 10:12 PM, PJ Eby wrote: > I haven't had a chance to address this on the import-sig discussion > yet about ModuleSpec, but I would like to just mention that one > property of the existing module system that I'm not sure either this > proposal or the ModuleSpec proposal preserves is that it's possible to > implement lazy importing of modules using standard reload() semantics. > > My "Importing" package offers lazy imports by creating module objects > in sys.modules that are a subtype of ModuleType, and use a > __getattribute__ hook so that trying to use them fires off a reload() > of the module. Because the dummy module doesn't have __file__ or > anything else initialized, the import system searches for the module > and then loads it, reusing the existing module object, even though > it's actually only executing the module code for the first time. > > That the existing object be reused is important, because once the > dummy is in sys.modules, it can also be imported by other modules, so > references to it can abound everywhere, and we wish only for it to be > loaded lazily, without needing to trace down and replace all instances > of it. This also preserves other invariants of the module system. > > Anyway, the reason I was asking why reloading is being handled as a > special case in the ModuleSpec proposal -- and the reason I'm curious > about certain provisions of this proposal -- is that making the > assumption you can only reload something with the same > spec/location/etc. it was originally loaded with, and/or that if you > are reloading a module then you previously had a chance to do things > to it, doesn't jibe with the way things work currently. > That is to say, in the pure PEP 302 world, there is no special status > for "reload" that is different from "load" -- the *only* thing that's > different is that there is already a module object to use, and there > is *no guarantee that it's a module object that was initialized by the > loader now being invoked*. > In Python 3.3 (#13959) import.reload() was updated to reuse a module's __loader__, which must now be set. If __loader__ is not set, you get an AttributeError. If that's a problem we can create a tracker issue and discuss there. In Python 3.4 imp.reload() is just an alias to importlib.reload(), but it works basically the same. With ModuleSpec things won't work that differently. If you reload such a module as you described, it will look for __spec__ and call it's reload() method. If __spec__ is not set, you get an AttributeError. It wouldn't be that hard to build a spec from the module if need be and then use that. -eric > AFAICT both this proposal and the ModuleSpec one are making an invalid > assumption per PEP 302, and aren't explicitly proposing to change the > status quo: they just assume things that aren't actually assured by > the prior specs or implementations. > > So, for example, this extension module proposal needs to cover what > happens if an extension module is reloaded and the module object is > not of the type or instance it's expecting. Must it do its own > checking? Error handling? Will some other portion of the import > system be expected to handle it? > > For that matter, what happens (in either proposal) if you reload() a > module which only has a __name__, and no other attributes? I haven't > tested with importlib, but with earlier Pythons this results in a > standard module search being done by reload(). But the ModuleSpec > proposal and this one seem to assume that a reload()-ed module must > already be associated with a loader, location, and/or spec. > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/ericsnowcurrently%40gmail.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chris at simplistix.co.uk Fri Sep 6 07:50:07 2013 From: chris at simplistix.co.uk (Chris Withers) Date: Fri, 06 Sep 2013 06:50:07 +0100 Subject: [Python-Dev] windows file closing race condition? Message-ID: <52296D0F.2030400@simplistix.co.uk> Hi All, Continuous testing is a wonderful thing when it comes to finding weird edge case problems, like this one: http://jenkins.simplistix.co.uk/job/testfixtures-tox/COMPONENTS=zc,PYTHON=3.3,label=windows/149/testReport/junit/testfixtures.tests.test_tempdirectory/TempDirectoryTests/test_check_all_tuple/ File "C:\Jenkins\workspace\testfixtures-tox\e8666d4e\.tox\3.3-zc\lib\site-packages\testfixtures\tempdirectory.py", line 323, in __exit__ self.cleanup() File "C:\Jenkins\workspace\testfixtures-tox\e8666d4e\.tox\3.3-zc\lib\site-packages\testfixtures\tempdirectory.py", line 78, in cleanup rmtree(self.path) File "C:\Jenkins\workspace\testfixtures-tox\e8666d4e\.tox\3.3-zc\lib\shutil.py", line 460, in rmtree return _rmtree_unsafe(path, onerror) File "C:\Jenkins\workspace\testfixtures-tox\e8666d4e\.tox\3.3-zc\lib\shutil.py", line 362, in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) File "C:\Jenkins\workspace\testfixtures-tox\e8666d4e\.tox\3.3-zc\lib\shutil.py", line 371, in _rmtree_unsafe onerror(os.rmdir, path, sys.exc_info()) File "C:\Jenkins\workspace\testfixtures-tox\e8666d4e\.tox\3.3-zc\lib\shutil.py", line 369, in _rmtree_unsafe os.rmdir(path) OSError: [WinError 145] The directory is not empty: 'c:\\users\\jenkins\\appdata\\local\\temp\\tmpkeg4d7\\a' I'm 99% certain my code is correct here, the only place I open files for writing in that directory is here: https://github.com/Simplistix/testfixtures/blob/master/testfixtures/tempdirectory.py#L275 So, from my perspective, I'm either looking at a bug in shutil.rmtree (which would be trying to delete a directory before deleting its content or failing to delete a file but ignoring an error) or the file object, when being used as a context manager, going through __exit__ without closing the file and releasing the handle. This happens very infrequently, the OS is Windows 7 and the filesystem is NTFS, if that helps... Any ideas? Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk From ericsnowcurrently at gmail.com Fri Sep 6 07:52:40 2013 From: ericsnowcurrently at gmail.com (Eric Snow) Date: Thu, 5 Sep 2013 23:52:40 -0600 Subject: [Python-Dev] Pre-PEP: Redesigning extension modules In-Reply-To: References: <20130823111822.49cba700@pitrou.net> Message-ID: On Sat, Aug 31, 2013 at 1:16 PM, Stefan Behnel wrote: > Nick Coghlan, 31.08.2013 18:49: > > This is actually my primary motivation for trying to improve the > > "can this be reloaded or not?" aspects of the loader API in PEP 451. > > I assume you mean that the extension module would be able to clearly signal > that it can't be reloaded, right? I agree that that's helpful. If you're > wrapping a C library, then the way that library is implemented might simply > force you to prevent any attempts at reloading the wrapper module. But if > reloading is possible at all, it would be even more helpful if we could > make it really easy to properly support it. > When loader.exec_module() gets called, it should raise ImportError if the module does not support reloading. -eric -------------- next part -------------- An HTML attachment was scrubbed... URL: From ericsnowcurrently at gmail.com Fri Sep 6 07:57:56 2013 From: ericsnowcurrently at gmail.com (Eric Snow) Date: Thu, 5 Sep 2013 23:57:56 -0600 Subject: [Python-Dev] Pre-PEP: Redesigning extension modules In-Reply-To: <20130902101642.04b69588@pitrou.net> References: <20130902101642.04b69588@pitrou.net> Message-ID: On Mon, Sep 2, 2013 at 2:16 AM, Antoine Pitrou wrote: > I think the biggest challenge here is to propose an API that's simple > and easy to use (i.e. that doesn't make extension module writing more > complicated than it currently is). > +1 > > The basic concept of putting custom module objects in sys.modules is > sound, IMHO. > > As for "extension module as a wrapper", though, it shounds like the > kind of complication I would personally prefer to stay away from. Also, > it would make extension modules less like Python modules, rather than > more. > It all depends on how useful it would be to be able to safely reload extension modules from their files. -eric -------------- next part -------------- An HTML attachment was scrubbed... URL: From solipsis at pitrou.net Fri Sep 6 08:10:20 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Fri, 6 Sep 2013 08:10:20 +0200 Subject: [Python-Dev] windows file closing race condition? References: <52296D0F.2030400@simplistix.co.uk> Message-ID: <20130906081020.76e37fba@fsol> On Fri, 06 Sep 2013 06:50:07 +0100 Chris Withers wrote: > > So, from my perspective, I'm either looking at a bug in shutil.rmtree > (which would be trying to delete a directory before deleting its content > or failing to delete a file but ignoring an error) or the file object, > when being used as a context manager, going through __exit__ without > closing the file and releasing the handle. It seems someone forgot to remove the following snippet from FileIO.__exit__: if random.random() > 0.0001: # Sometimes we leave the fd open, to annoy Chris os.close(self.fd) > This happens very infrequently, the OS is Windows 7 and the filesystem > is NTFS, if that helps... It should help indeed: http://blogs.msdn.com/b/oldnewthing/archive/2012/09/07/10347136.aspx :-) Regards Antoine. From stefan_ml at behnel.de Fri Sep 6 08:11:06 2013 From: stefan_ml at behnel.de (Stefan Behnel) Date: Fri, 06 Sep 2013 08:11:06 +0200 Subject: [Python-Dev] Pre-PEP: Redesigning extension modules In-Reply-To: <20130906074348.2779de48@fsol> References: <20130906074348.2779de48@fsol> Message-ID: Antoine Pitrou, 06.09.2013 07:43: > Proxying wrapper? We shouldn't need that kind of tricks. The advantage is that it's controlled by the loader, and transparent to the module itself. Stefan From ncoghlan at gmail.com Fri Sep 6 09:14:18 2013 From: ncoghlan at gmail.com (Nick Coghlan) Date: Fri, 6 Sep 2013 17:14:18 +1000 Subject: [Python-Dev] windows file closing race condition? In-Reply-To: <52296D0F.2030400@simplistix.co.uk> References: <52296D0F.2030400@simplistix.co.uk> Message-ID: On 6 September 2013 15:50, Chris Withers wrote: > Hi All, > > Continuous testing is a wonderful thing when it comes to finding weird edge > case problems, like this one: > > http://jenkins.simplistix.co.uk/job/testfixtures-tox/COMPONENTS=zc,PYTHON=3.3,label=windows/149/testReport/junit/testfixtures.tests.test_tempdirectory/TempDirectoryTests/test_check_all_tuple/ > > File > "C:\Jenkins\workspace\testfixtures-tox\e8666d4e\.tox\3.3-zc\lib\site-packages\testfixtures\tempdirectory.py", > line 323, in __exit__ > self.cleanup() > File > "C:\Jenkins\workspace\testfixtures-tox\e8666d4e\.tox\3.3-zc\lib\site-packages\testfixtures\tempdirectory.py", > line 78, in cleanup > rmtree(self.path) > File > "C:\Jenkins\workspace\testfixtures-tox\e8666d4e\.tox\3.3-zc\lib\shutil.py", > line 460, in rmtree > return _rmtree_unsafe(path, onerror) > File > "C:\Jenkins\workspace\testfixtures-tox\e8666d4e\.tox\3.3-zc\lib\shutil.py", > line 362, in _rmtree_unsafe > _rmtree_unsafe(fullname, onerror) > File > "C:\Jenkins\workspace\testfixtures-tox\e8666d4e\.tox\3.3-zc\lib\shutil.py", > line 371, in _rmtree_unsafe > onerror(os.rmdir, path, sys.exc_info()) > File > "C:\Jenkins\workspace\testfixtures-tox\e8666d4e\.tox\3.3-zc\lib\shutil.py", > line 369, in _rmtree_unsafe > os.rmdir(path) > OSError: [WinError 145] The directory is not empty: > 'c:\\users\\jenkins\\appdata\\local\\temp\\tmpkeg4d7\\a' > > I'm 99% certain my code is correct here, the only place I open files for > writing in that directory is here: > > https://github.com/Simplistix/testfixtures/blob/master/testfixtures/tempdirectory.py#L275 > > So, from my perspective, I'm either looking at a bug in shutil.rmtree (which > would be trying to delete a directory before deleting its content or failing > to delete a file but ignoring an error) or the file object, when being used > as a context manager, going through __exit__ without closing the file and > releasing the handle. > > This happens very infrequently, the OS is Windows 7 and the filesystem is > NTFS, if that helps... > > Any ideas? This feels a lot like an issue we were seeing on the Windows buildbots, which we ended up working around in the test support library: http://bugs.python.org/issue15496 That would be some awfully ugly code to upgrade from "hack in the test support library" to "this is just how Python unlinks files on Windows", though :P Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia From chris at simplistix.co.uk Fri Sep 6 09:48:50 2013 From: chris at simplistix.co.uk (Chris Withers) Date: Fri, 06 Sep 2013 08:48:50 +0100 Subject: [Python-Dev] windows file closing race condition? In-Reply-To: <20130906081020.76e37fba@fsol> References: <52296D0F.2030400@simplistix.co.uk> <20130906081020.76e37fba@fsol> Message-ID: <522988E2.20005@simplistix.co.uk> On 06/09/2013 07:10, Antoine Pitrou wrote: >> This happens very infrequently, the OS is Windows 7 and the filesystem >> is NTFS, if that helps... > > It should help indeed: > http://blogs.msdn.com/b/oldnewthing/archive/2012/09/07/10347136.aspx The box in questions runs no AV software or indexing services... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk From stephen at xemacs.org Fri Sep 6 09:28:21 2013 From: stephen at xemacs.org (Stephen J. Turnbull) Date: Fri, 06 Sep 2013 16:28:21 +0900 Subject: [Python-Dev] windows file closing race condition? In-Reply-To: <20130906081020.76e37fba@fsol> References: <52296D0F.2030400@simplistix.co.uk> <20130906081020.76e37fba@fsol> Message-ID: <87a9jq9zoq.fsf@uwakimon.sk.tsukuba.ac.jp> Antoine Pitrou writes: > http://blogs.msdn.com/b/oldnewthing/archive/2012/09/07/10347136.aspx That was worth it just for the comment from Australia! From mail at timgolden.me.uk Fri Sep 6 09:58:06 2013 From: mail at timgolden.me.uk (Tim Golden) Date: Fri, 06 Sep 2013 08:58:06 +0100 Subject: [Python-Dev] windows file closing race condition? In-Reply-To: References: <52296D0F.2030400@simplistix.co.uk> Message-ID: <52298B0E.7090508@timgolden.me.uk> On 06/09/2013 08:14, Nick Coghlan wrote: > On 6 September 2013 15:50, Chris Withers wrote: >> Continuous testing is a wonderful thing when it comes to finding weird edge >> case problems, like this one: [... snip ...] >> os.rmdir(path) >> OSError: [WinError 145] The directory is not empty: >> 'c:\\users\\jenkins\\appdata\\local\\temp\\tmpkeg4d7\\a' > This feels a lot like an issue we were seeing on the Windows > buildbots, which we ended up working around in the test support > library: http://bugs.python.org/issue15496 > > That would be some awfully ugly code to upgrade from "hack in the test > support library" to "this is just how Python unlinks files on > Windows", though :P I think that any kind of delay-retry loop falls squarely within the remit of the calling application, not core Python. This isn't a problem of Python's making: IIUC, you would see the same effect if you used any other language or simply deleted the folder from within Explorer. (I don't know whether Explorer itself does anything canny under the covers to retry). Obviously our test suite *is* a calling application, and so it makes perfect sense to put some workaround in place. The trouble with this class of problem, where a share-delete handle allows operations to succeed and to fail later which would normally fail early, is that the bad effect is at one remove from its cause. Here, by the time the rmtree has reached the point of removing a parent directory, it's long-since left behind the file which has a still-open handle: the DeleteFile succeeded and the code moved on. You can't even tell which file it was. A related problem arises where the DeleteFile succeeds and an error occurs when a subsequent CreateFile fails for the same filepath, again because a share-delete handle is still open for a file at that path. This is another one which hits our test suite because of an overuse of one temp filename. What should Python do? With some effort it could look for open file handles against the file it's trying to delete, but what then? Wait until they're all closed? That could leave it hanging. And even with a timeout it would introduce a delay which might be unnecessary. A lot of the time, no harm will come of the file existing a few seconds after the DeleteFile has succeeded. In short, I don't believe there's any mileage in introducing extra code into Python's os or io modules. It falls on the shoulders of the calling code to implement retry loops or whatever logic as needed. TJG From chris at simplistix.co.uk Fri Sep 6 09:59:19 2013 From: chris at simplistix.co.uk (Chris Withers) Date: Fri, 06 Sep 2013 08:59:19 +0100 Subject: [Python-Dev] windows file closing race condition? In-Reply-To: References: <52296D0F.2030400@simplistix.co.uk> Message-ID: <52298B57.2020108@simplistix.co.uk> On 06/09/2013 08:14, Nick Coghlan wrote: > This feels a lot like an issue we were seeing on the Windows > buildbots, which we ended up working around in the test support > library: http://bugs.python.org/issue15496 Wow :'( > That would be some awfully ugly code to upgrade from "hack in the test > support library" to "this is just how Python unlinks files on > Windows", though :P Indeed... Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk From solipsis at pitrou.net Fri Sep 6 12:14:36 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Fri, 6 Sep 2013 12:14:36 +0200 Subject: [Python-Dev] windows file closing race condition? References: <52296D0F.2030400@simplistix.co.uk> <52298B0E.7090508@timgolden.me.uk> Message-ID: <20130906121436.7db391f2@pitrou.net> Le Fri, 06 Sep 2013 08:58:06 +0100, Tim Golden a ?crit : > > What should Python do? Maybe using FILE_SHARE_DELETE could help? http://bugs.python.org/issue15244 Regards Antoine. From mail at timgolden.me.uk Fri Sep 6 12:23:39 2013 From: mail at timgolden.me.uk (Tim Golden) Date: Fri, 06 Sep 2013 11:23:39 +0100 Subject: [Python-Dev] windows file closing race condition? In-Reply-To: <20130906121436.7db391f2@pitrou.net> References: <52296D0F.2030400@simplistix.co.uk> <52298B0E.7090508@timgolden.me.uk> <20130906121436.7db391f2@pitrou.net> Message-ID: <5229AD2B.5030206@timgolden.me.uk> On 06/09/2013 11:14, Antoine Pitrou wrote: > Le Fri, 06 Sep 2013 08:58:06 +0100, > Tim Golden a ?crit : >> >> What should Python do? > > Maybe using FILE_SHARE_DELETE could help? > http://bugs.python.org/issue15244 I don't think so. It's the use of FILE_SHARE_DELETE (by other programs, eg Virus Checkers) that typically causes the problem. IOW, the sequence is: * [Some Other Prog] takes FILE_SHARE_DELETE handle, allowing other programs to delete the file even while this handle is still open * Python calls DeleteFile -- succeeds if the only open handles are FILE_SHARE_DELETE; carries on * File has apparently disappeared but still has open handles * Any attempt to create a file of the same name or to delete a containing directory fail because the file is still open, even though it's successfully been deleted. * (Some time later) [Some Other Prog] closes its handle and the file is now completely gone Unless I'm missing something, there's nothing Python can do to help here apart from the sort of delay-retry dance which test.support uses and which I'm advocating against as a core feature. TJG From shibturn at gmail.com Fri Sep 6 13:50:34 2013 From: shibturn at gmail.com (Richard Oudkerk) Date: Fri, 06 Sep 2013 12:50:34 +0100 Subject: [Python-Dev] windows file closing race condition? In-Reply-To: <5229AD2B.5030206@timgolden.me.uk> References: <52296D0F.2030400@simplistix.co.uk> <52298B0E.7090508@timgolden.me.uk> <20130906121436.7db391f2@pitrou.net> <5229AD2B.5030206@timgolden.me.uk> Message-ID: On 06/09/2013 11:23am, Tim Golden wrote: > On 06/09/2013 11:14, Antoine Pitrou wrote: >> Le Fri, 06 Sep 2013 08:58:06 +0100, >> Tim Golden a ?crit : >>> >>> What should Python do? >> >> Maybe using FILE_SHARE_DELETE could help? >> http://bugs.python.org/issue15244 > > I don't think so. It's the use of FILE_SHARE_DELETE (by other programs, > eg Virus Checkers) that typically causes the problem. IOW, the sequence is: > > * [Some Other Prog] takes FILE_SHARE_DELETE handle, allowing other > programs to delete the file even while this handle is still open > > * Python calls DeleteFile -- succeeds if the only open handles are > FILE_SHARE_DELETE; carries on > > * File has apparently disappeared but still has open handles > > * Any attempt to create a file of the same name or to delete a > containing directory fail because the file is still open, even though > it's successfully been deleted. > > * (Some time later) [Some Other Prog] closes its handle and the file is > now completely gone > > > Unless I'm missing something, there's nothing Python can do to help here > apart from the sort of delay-retry dance which test.support uses and > which I'm advocating against as a core feature. Instead of deleting, the file could be moved to a temporary name in the root directory (or some other permanent directory on the same drive) and then deleted. That would allow the directory to be closed even if a FILE_SHARE_DELETE handle is still open for the file. -- Richard From mail at timgolden.me.uk Fri Sep 6 14:21:35 2013 From: mail at timgolden.me.uk (Tim Golden) Date: Fri, 06 Sep 2013 13:21:35 +0100 Subject: [Python-Dev] windows file closing race condition? In-Reply-To: References: <52296D0F.2030400@simplistix.co.uk> <52298B0E.7090508@timgolden.me.uk> <20130906121436.7db391f2@pitrou.net> <5229AD2B.5030206@timgolden.me.uk> Message-ID: <5229C8CF.2050308@timgolden.me.uk> On 06/09/2013 12:50, Richard Oudkerk wrote: > On 06/09/2013 11:23am, Tim Golden wrote: >> On 06/09/2013 11:14, Antoine Pitrou wrote: >>> Le Fri, 06 Sep 2013 08:58:06 +0100, >>> Tim Golden a ?crit : >>>> >>>> What should Python do? >>> >>> Maybe using FILE_SHARE_DELETE could help? >>> http://bugs.python.org/issue15244 >> >> I don't think so. It's the use of FILE_SHARE_DELETE (by other programs, >> eg Virus Checkers) that typically causes the problem. IOW, the >> sequence is: >> >> * [Some Other Prog] takes FILE_SHARE_DELETE handle, allowing other >> programs to delete the file even while this handle is still open >> >> * Python calls DeleteFile -- succeeds if the only open handles are >> FILE_SHARE_DELETE; carries on >> >> * File has apparently disappeared but still has open handles >> >> * Any attempt to create a file of the same name or to delete a >> containing directory fail because the file is still open, even though >> it's successfully been deleted. >> >> * (Some time later) [Some Other Prog] closes its handle and the file is >> now completely gone >> >> >> Unless I'm missing something, there's nothing Python can do to help here >> apart from the sort of delay-retry dance which test.support uses and >> which I'm advocating against as a core feature. > > Instead of deleting, the file could be moved to a temporary name in the > root directory (or some other permanent directory on the same drive) and > then deleted. That would allow the directory to be closed even if a > FILE_SHARE_DELETE handle is still open for the file. > True, but then you're into determining a temporary name somewhere on the same volume if possible and avoiding collisions etc. Again, I don't think this is something we need to be doing by default in core Python. TJG From p.f.moore at gmail.com Fri Sep 6 14:55:17 2013 From: p.f.moore at gmail.com (Paul Moore) Date: Fri, 6 Sep 2013 13:55:17 +0100 Subject: [Python-Dev] windows file closing race condition? In-Reply-To: <5229C8CF.2050308@timgolden.me.uk> References: <52296D0F.2030400@simplistix.co.uk> <52298B0E.7090508@timgolden.me.uk> <20130906121436.7db391f2@pitrou.net> <5229AD2B.5030206@timgolden.me.uk> <5229C8CF.2050308@timgolden.me.uk> Message-ID: On 6 September 2013 13:21, Tim Golden wrote: > True, but then you're into determining a temporary name somewhere on the > same volume if possible and avoiding collisions etc. Again, I don't > think this is something we need to be doing by default in core Python. Agreed. There simply is no solution that works in all cases. If you rename the file to anywhere but the same directory, you potentially have permission issues. And if you rename to the same directory, you still can't delete the directory. It's a shame, because a helper to do this would be useful for Unix users wanting to ensure that their code works properly on Windows, but there really isn't an answer other than knowing how things work (and crafting an appropriate solution for your application), here... Paul From shibturn at gmail.com Fri Sep 6 15:16:25 2013 From: shibturn at gmail.com (Richard Oudkerk) Date: Fri, 06 Sep 2013 14:16:25 +0100 Subject: [Python-Dev] windows file closing race condition? In-Reply-To: References: <52296D0F.2030400@simplistix.co.uk> <52298B0E.7090508@timgolden.me.uk> <20130906121436.7db391f2@pitrou.net> <5229AD2B.5030206@timgolden.me.uk> <5229C8CF.2050308@timgolden.me.uk> Message-ID: On 06/09/2013 1:55pm, Paul Moore wrote: > ... If you rename the > file to anywhere but the same directory, you potentially have > permission issues. Using the root directory avoids permission issues -- users always have write access there. -- Richard From rdmurray at bitdance.com Fri Sep 6 15:26:52 2013 From: rdmurray at bitdance.com (R. David Murray) Date: Fri, 06 Sep 2013 09:26:52 -0400 Subject: [Python-Dev] windows file closing race condition? In-Reply-To: <5229C8CF.2050308@timgolden.me.uk> References: <52296D0F.2030400@simplistix.co.uk> <52298B0E.7090508@timgolden.me.uk> <20130906121436.7db391f2@pitrou.net> <5229AD2B.5030206@timgolden.me.uk> <5229C8CF.2050308@timgolden.me.uk> Message-ID: <20130906132652.D566A2507F5@webabinitio.net> On Fri, 06 Sep 2013 13:21:35 +0100, Tim Golden wrote: > On 06/09/2013 12:50, Richard Oudkerk wrote: > > On 06/09/2013 11:23am, Tim Golden wrote: > >> On 06/09/2013 11:14, Antoine Pitrou wrote: > >>> Le Fri, 06 Sep 2013 08:58:06 +0100, > >>> Tim Golden a ??crit : > >>>> > >>>> What should Python do? > >>> > >>> Maybe using FILE_SHARE_DELETE could help? > >>> http://bugs.python.org/issue15244 > >> > >> I don't think so. It's the use of FILE_SHARE_DELETE (by other programs, > >> eg Virus Checkers) that typically causes the problem. IOW, the > >> sequence is: > >> > >> * [Some Other Prog] takes FILE_SHARE_DELETE handle, allowing other > >> programs to delete the file even while this handle is still open > >> > >> * Python calls DeleteFile -- succeeds if the only open handles are > >> FILE_SHARE_DELETE; carries on > >> > >> * File has apparently disappeared but still has open handles > >> > >> * Any attempt to create a file of the same name or to delete a > >> containing directory fail because the file is still open, even though > >> it's successfully been deleted. > >> > >> * (Some time later) [Some Other Prog] closes its handle and the file is > >> now completely gone > >> > >> > >> Unless I'm missing something, there's nothing Python can do to help here > >> apart from the sort of delay-retry dance which test.support uses and > >> which I'm advocating against as a core feature. > > > > Instead of deleting, the file could be moved to a temporary name in the > > root directory (or some other permanent directory on the same drive) and > > then deleted. That would allow the directory to be closed even if a > > FILE_SHARE_DELETE handle is still open for the file. > > > > True, but then you're into determining a temporary name somewhere on the > same volume if possible and avoiding collisions etc. Again, I don't > think this is something we need to be doing by default in core Python. What about moving the test.support delete helper to somewhere in unittest, since this will come up in pretty much every test suite that runs on Windows? --David From ethan at stoneleaf.us Fri Sep 6 15:32:46 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Fri, 06 Sep 2013 06:32:46 -0700 Subject: [Python-Dev] inspect and metaclasses Message-ID: <5229D97E.9080103@stoneleaf.us> Part of the fix for issue #18693 is to fix inspect to look in the metaclass for class attributes (http://bugs.python.org/issue18929). In inspect.py in function get_mro() we can either add the metaclass unconditionally, or only if it is not 'type'. If we add unconditionally, then help() adds the following: class A(builtins.object) | Hello and goodbye + | + | Method resolution order: + | A + | builtins.object + | builtins.type | | Methods defined here: Do we want that, or should we just add the metaclass if it is not 'type'? -- ~Ethan~ From p.f.moore at gmail.com Fri Sep 6 16:01:44 2013 From: p.f.moore at gmail.com (Paul Moore) Date: Fri, 6 Sep 2013 15:01:44 +0100 Subject: [Python-Dev] windows file closing race condition? In-Reply-To: References: <52296D0F.2030400@simplistix.co.uk> <52298B0E.7090508@timgolden.me.uk> <20130906121436.7db391f2@pitrou.net> <5229AD2B.5030206@timgolden.me.uk> <5229C8CF.2050308@timgolden.me.uk> Message-ID: On 6 September 2013 14:16, Richard Oudkerk wrote: > On 06/09/2013 1:55pm, Paul Moore wrote: >> >> ... If you rename the >> >> file to anywhere but the same directory, you potentially have >> permission issues. > > > Using the root directory avoids permission issues -- users always have write > access there. I don't believe that's true. IIRC, some Windows versions protect the root of the system drive from non-admin users. And I *know* I have had problems with NTFS-formatted removable drives plugged into systems they were not originally formatted on, where the owner of the drive no longer exists. They are rare corner cases, for sure, but they do happen and frankly are probably harder to explain when they come up than saying "your virus checker is interfering". Everyone expects their virus checker to screw up their system (cure worse than disease syndrome :-)) Paul From eliben at gmail.com Fri Sep 6 16:14:11 2013 From: eliben at gmail.com (Eli Bendersky) Date: Fri, 6 Sep 2013 07:14:11 -0700 Subject: [Python-Dev] SEEK_* constants in io and os In-Reply-To: References: <20130902102437.197c1708@pitrou.net> <20130902154522.495b1697@pitrou.net> <20130902155109.7da869bd@pitrou.net> Message-ID: > On Mon, Sep 2, 2013 at 8:48 AM, Victor Stinner wrote: > >> 2013/9/2 Eli Bendersky : >> > Yes, now I see a 500 usec difference timed within the Python script. >> When >> > timing the whole execution of Python: (...) >> >> Can you please provide the list of imported modules by: >> python -c 'import sys; print(sys.modules)' >> >> For python with default options and for python with -S (no site >> module) options? And also with your patch? >> >> Python should be fast to write "hello world" (or "python -c pass), >> it's a dummy but common benchmark (to compare Python to other VM / >> other programming languages). >> > > The sorted list for both default and -S (they're identical) is > http://pastebin.com/4vzSMCu7 - there are 55 entries there, including > things like itertools, heapq, functools and collections. With my patch, > enum is also added (which makes sense since os is in the list). So the > 0.5ms increase for the 34ms runtime kind-of makes sense. > This question is still kind-of open. I haven't received additional feedback - only Antoine's and Victor's concerns wrt. runtime cost, which I believe I addressed. Note that the runtime cost is globally one-time in the sense that if additional modules (whether used at start-up or not) use enum, this is a price only paid once. So, is it worth it the extra 0.5ms of start-up time, or not? Eli -------------- next part -------------- An HTML attachment was scrubbed... URL: From ethan at stoneleaf.us Fri Sep 6 16:23:46 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Fri, 06 Sep 2013 07:23:46 -0700 Subject: [Python-Dev] SEEK_* constants in io and os In-Reply-To: References: Message-ID: <5229E572.5090509@stoneleaf.us> On 09/01/2013 06:02 PM, Eli Bendersky wrote: > > os seems to import io in some functions; can this be done always? If yes, we can just define the constants once and > os.SEEK_* will alias io.SEEK_*? The other way (io taking from os) is also a possibility (maybe the preferred one because > io already refers to os.SEEK_HOLE/DATA, at least in the documentation). > > Any ideas and suggestions are welcome, Ideally we should only define them once. If these are values that could change per O/S then they should be in the os module. Since they /can/ change per O/S (even if they don't currently), we should put them in os. I'd say it's worth the extra 0.5ms startup time. -- ~Ethan~ From arigo at tunes.org Fri Sep 6 16:47:15 2013 From: arigo at tunes.org (Armin Rigo) Date: Fri, 6 Sep 2013 16:47:15 +0200 Subject: [Python-Dev] inspect and metaclasses In-Reply-To: <5229D97E.9080103@stoneleaf.us> References: <5229D97E.9080103@stoneleaf.us> Message-ID: Hi Ethan, Are you suggesting that inspect.get_mro(A) would return (A, object, type)? That seems very wrong to me. If the goal is to fix `inspect.classify_class_attrs()`, then this function only needs a specific fix, along the lines of looking in `get_mro(A) + get_mro(type(A))`. (A more minor issue is that the bug report suggests `... + (type(A),)` only, but that's wrong: Python will also look in all the base classes of type(A).) "Fixing" inspect.get_mro() as suggested would break a lot of other usages of it. A bient?t, Armin. From jcea at jcea.es Fri Sep 6 17:08:23 2013 From: jcea at jcea.es (Jesus Cea) Date: Fri, 06 Sep 2013 17:08:23 +0200 Subject: [Python-Dev] DTRACE support Message-ID: <5229EFE7.8040702@jcea.es> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 As far as I know, Erlang, Ruby, PHP, Perl, etc., support Dtrace. Python is embarrasingly missing from this list. Some examples: I have spend a very long time on a patch for Dtrace support in most platforms with dtrace available. Currently working under Solaris and derivatives, and MacOS X. Last time I checked, it would crash FreeBSD because bugs in the dtrace port, but that was a long time ago. I would like to push this to Python 3.4, and the window is going to be closed soon, so I think this is the time to ask for opinions and support here. Does Python-Dev have any opinion or interest in this project?. Should I push for it? Some (not current) details: http://bugs.python.org/issue13405 DTrace is amazing: http://dtrace.org/blogs/ PS: I can't release this code as a PyPI project, because it mess with the inner core of Python. - -- Jes?s Cea Avi?n _/_/ _/_/_/ _/_/_/ jcea at jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/ Twitter: @jcea _/_/ _/_/ _/_/_/_/_/ jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/ _/_/ _/_/ "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ "El amor es poner tu felicidad en la felicidad de otro" - Leibniz -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQCVAwUBUinv55lgi5GaxT1NAQIK7gP8DeaWxNVwNFa5PnfZe00Aay5l1rWzgj8d CY0D3W+PAdPkBci9SYPmfv7ajXrQWo/ccANYIRaUdI/U9Zjq/od7eNemOFqyL7U6 BrQpAUMySI6tMlL+gYEfQ8O47SManvTqoyNvOFAz9mVJute8IxKsbCIK/jiRHDXz vWyG7YrYN1A= =4E7+ -----END PGP SIGNATURE----- From jcea at jcea.es Fri Sep 6 17:08:28 2013 From: jcea at jcea.es (Jesus Cea) Date: Fri, 06 Sep 2013 17:08:28 +0200 Subject: [Python-Dev] Details of "import lock" in 3.3 Message-ID: <5229EFEC.1010503@jcea.es> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 With importlib and other recent changes, what are the current details of "import lock"?. That is, the lock/locks held when Python code does "import", specially in the case of multithreading. Is that documented anywhere? Thanks! - -- Jes?s Cea Avi?n _/_/ _/_/_/ _/_/_/ jcea at jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/ Twitter: @jcea _/_/ _/_/ _/_/_/_/_/ jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/ _/_/ _/_/ "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ "El amor es poner tu felicidad en la felicidad de otro" - Leibniz -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQCVAwUBUinv7Jlgi5GaxT1NAQLX7QP/SBNuy869xSKRVNlWmAiDLpZOR9IHm77K fy+AG/aJDpk4BMcm+KNoHZyUtJJs2kndfz+OVTeU/mmlr+aXu/wA1yNB1HAjAwWO 4ZWyaN9WLrhv8xXomUlT8iqikc/9pEspgQbJAljUvMLVouixIdxga3IqtaT3FQZh wkV9v04G4OA= =P3PI -----END PGP SIGNATURE----- From ethan at stoneleaf.us Fri Sep 6 16:51:06 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Fri, 06 Sep 2013 07:51:06 -0700 Subject: [Python-Dev] when to fix cross-version bugs? Message-ID: <5229EBDA.1030902@stoneleaf.us> I recently committed a fix for unicodeobject.c so that the %d, %i, and %u format specifiers always output values (otherwise, in subclasses, the str() was used instead). Should this be fixed in 3.3 as well? What guidelines determine when a bug is fixed in previous versions? -- ~Ethan~ From guido at python.org Fri Sep 6 17:14:04 2013 From: guido at python.org (Guido van Rossum) Date: Fri, 6 Sep 2013 08:14:04 -0700 Subject: [Python-Dev] DTRACE support In-Reply-To: <5229EFE7.8040702@jcea.es> References: <5229EFE7.8040702@jcea.es> Message-ID: I've heard good things about DTRACE but never used it myself. Do I understand correctly that you have to build a separate Python executable with it turned on? I noticed one odd thing in the patch: apparently the dtrace module only exists to have a flag that tells whether it is enabled. Can't that flag be added to the sys module? On Fri, Sep 6, 2013 at 8:08 AM, Jesus Cea wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > As far as I know, Erlang, Ruby, PHP, Perl, etc., support Dtrace. > Python is embarrasingly missing from this list. > > Some examples: > > > > > > I have spend a very long time on a patch for Dtrace support in most > platforms with dtrace available. Currently working under Solaris and > derivatives, and MacOS X. Last time I checked, it would crash FreeBSD > because bugs in the dtrace port, but that was a long time ago. > > I would like to push this to Python 3.4, and the window is going to be > closed soon, so I think this is the time to ask for opinions and > support here. > > Does Python-Dev have any opinion or interest in this project?. Should > I push for it? > > Some (not current) details: http://bugs.python.org/issue13405 > > DTrace is amazing: http://dtrace.org/blogs/ > > PS: I can't release this code as a PyPI project, because it mess with > the inner core of Python. > > - -- > Jes?s Cea Avi?n _/_/ _/_/_/ _/_/_/ > jcea at jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/ > Twitter: @jcea _/_/ _/_/ _/_/_/_/_/ > jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/ _/_/ _/_/ > "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ > "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ > "El amor es poner tu felicidad en la felicidad de otro" - Leibniz > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.10 (GNU/Linux) > Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ > > iQCVAwUBUinv55lgi5GaxT1NAQIK7gP8DeaWxNVwNFa5PnfZe00Aay5l1rWzgj8d > CY0D3W+PAdPkBci9SYPmfv7ajXrQWo/ccANYIRaUdI/U9Zjq/od7eNemOFqyL7U6 > BrQpAUMySI6tMlL+gYEfQ8O47SManvTqoyNvOFAz9mVJute8IxKsbCIK/jiRHDXz > vWyG7YrYN1A= > =4E7+ > -----END PGP SIGNATURE----- > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/guido%40python.org -- --Guido van Rossum (python.org/~guido) From A.J.Miller at bcs.org.uk Fri Sep 6 11:54:45 2013 From: A.J.Miller at bcs.org.uk (Andrew Miller) Date: Fri, 6 Sep 2013 10:54:45 +0100 Subject: [Python-Dev] unicodedata module is out of date Message-ID: The unicodedata module only contains data up to Unicode 5.2 (October 2009), so attempting to reference any character from a later version e.g: unicodedata.lookup("TURKISH LIRA SIGN") results in a KeyError. Also, it seems to be limited to properties in the UnicodeData.txt file and does not contain any data from the other files from the Unicode Character Database (the perl library Unicode::UCD is far more complete). Are there any plans to update this module to the latest Unicode version (6.2, with 6.3 being released shortly), or is there another module that provides more up to date information? Thanks, Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: From skip at pobox.com Fri Sep 6 17:18:49 2013 From: skip at pobox.com (Skip Montanaro) Date: Fri, 6 Sep 2013 10:18:49 -0500 Subject: [Python-Dev] DTRACE support In-Reply-To: <5229EFE7.8040702@jcea.es> References: <5229EFE7.8040702@jcea.es> Message-ID: > I have spend a very long time on a patch for Dtrace support in most > platforms with dtrace available. Currently working under Solaris and > derivatives, and MacOS X. Last time I checked, it would crash FreeBSD > because bugs in the dtrace port, but that was a long time ago. I looked at this several years ago. As I recall, the problem at the time was that the Apple and Sun DTrace implementations were incompatible, or that the probes they had inserted into their own /usr/bin/python instances were incompatible. (Don't remember which off the top of my head.) Of course, the DTrace folks at Apple and Sun weren't really interested in holding hands... Skip From jcea at jcea.es Fri Sep 6 17:21:06 2013 From: jcea at jcea.es (Jesus Cea) Date: Fri, 06 Sep 2013 17:21:06 +0200 Subject: [Python-Dev] DTRACE support In-Reply-To: References: <5229EFE7.8040702@jcea.es> Message-ID: <5229F2E2.6090301@jcea.es> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 06/09/13 17:14, Guido van Rossum wrote: > I've heard good things about DTRACE but never used it myself. > > Do I understand correctly that you have to build a separate Python > executable with it turned on? It is a patch you apply on stock Python and you get a new configure option: "--with-dtrace". If you compile Python with that flag, you get a python interpreter with dtrace probes on it. > I noticed one odd thing in the patch: apparently the dtrace module > only exists to have a flag that tells whether it is enabled. Can't > that flag be added to the sys module? My plan is to (in the future) use that module to create new probes on the fly, like , and to export functions to communicate data to dtrace scripts, if running. That is, this module is currently a shell I plan to fill. - -- Jes?s Cea Avi?n _/_/ _/_/_/ _/_/_/ jcea at jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/ Twitter: @jcea _/_/ _/_/ _/_/_/_/_/ jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/ _/_/ _/_/ "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ "El amor es poner tu felicidad en la felicidad de otro" - Leibniz -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQCVAwUBUiny4plgi5GaxT1NAQLngQP/eFoQ3rdPy12nmw8pPPO/+/RYjlhIi67+ T0n1xBJbxIvpFpIRufB+tkCfLWdb7YZKcf3Nb4V6pVsOPdbd9s6RcVWNA9Ds5mNx ISrO644CAIqRF5XgeeS5uhsODL1DrZTEfX0QBhGsU6lcqyOzSfRX2t9hRBMh3f5y 2dPMHNznJhs= =dV5g -----END PGP SIGNATURE----- From jcea at jcea.es Fri Sep 6 17:24:08 2013 From: jcea at jcea.es (Jesus Cea) Date: Fri, 06 Sep 2013 17:24:08 +0200 Subject: [Python-Dev] DTRACE support In-Reply-To: References: <5229EFE7.8040702@jcea.es> Message-ID: <5229F398.3040802@jcea.es> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 06/09/13 17:18, Skip Montanaro wrote: > I looked at this several years ago. As I recall, the problem at the > time was that the Apple and Sun DTrace implementations were > incompatible, or that the probes they had inserted into their own > /usr/bin/python instances were incompatible. (Don't remember which > off the top of my head.) Of course, the DTrace folks at Apple and > Sun weren't really interested in holding hands... Right. They use two different set of probes because Python doesn't provide "official" probes :-). If I recall correctly, they were basically identical, with an extra parameter somewhere. I think my patch provides a superset. Anyway, I don't think neither of them support Python 3. Time to step in and liderate. - -- Jes?s Cea Avi?n _/_/ _/_/_/ _/_/_/ jcea at jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/ Twitter: @jcea _/_/ _/_/ _/_/_/_/_/ jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/ _/_/ _/_/ "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ "El amor es poner tu felicidad en la felicidad de otro" - Leibniz -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQCVAwUBUinzmJlgi5GaxT1NAQLxwQP/cTq90CCfZhiUVLsutP0dQk4Br62kvCyn mmMV9E/ZPJEO3LYYQT+CSiIRnG5panqdZulMDAGBBvgIbJP/E8spuyoFZkspWtPM fk5n2etHq8JMZs36mbxnhw++W3/jlZ4osdVWZZKoKdwVBRFz2YvpLa24q+Y06gU/ 5YEXHuNDP/4= =YFm2 -----END PGP SIGNATURE----- From jcea at jcea.es Fri Sep 6 17:28:56 2013 From: jcea at jcea.es (Jesus Cea) Date: Fri, 06 Sep 2013 17:28:56 +0200 Subject: [Python-Dev] DTRACE support In-Reply-To: <5229EFE7.8040702@jcea.es> References: <5229EFE7.8040702@jcea.es> Message-ID: <5229F4B8.7070200@jcea.es> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 06/09/13 17:08, Jesus Cea wrote: > Does Python-Dev have any opinion or interest in this project?. > Should I push for it? I have using this code for ages on my Solaris machines: Python 2.7.5 (dtrace-issue13405_2.7:f96ea83cd766, Aug 19 2013, 02:55:15) Python 3.3.2 (dtrace-issue13405_3.3:23dafaf73d29, Aug 19 2013, 05:52:34) Python 3.4.0a1+ (dtrace-issue13405:d7be45bb06a3, Aug 19 2013, 07:03:24) - -- Jes?s Cea Avi?n _/_/ _/_/_/ _/_/_/ jcea at jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/ Twitter: @jcea _/_/ _/_/ _/_/_/_/_/ jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/ _/_/ _/_/ "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ "El amor es poner tu felicidad en la felicidad de otro" - Leibniz -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQCVAwUBUin0uJlgi5GaxT1NAQJP/wQAmkxZ5UJk9L+wTZb94icd3vqUGdo+mgR6 CNs0/oyemd7fL2DSaHGycqDwVPqyqNVFE+aD/ziEmWOwmiFQebudX0Z7md4ZSF89 LU4ddBPMj1bI5E/EYtlqgZg4TqwbUP3XPy9IrCEeiiSKcIk2TJxYiZ12IlcFyXU+ ff3E+DyDkBY= =svJD -----END PGP SIGNATURE----- From brian at python.org Fri Sep 6 17:29:00 2013 From: brian at python.org (Brian Curtin) Date: Fri, 6 Sep 2013 10:29:00 -0500 Subject: [Python-Dev] when to fix cross-version bugs? In-Reply-To: <5229EBDA.1030902@stoneleaf.us> References: <5229EBDA.1030902@stoneleaf.us> Message-ID: On Fri, Sep 6, 2013 at 9:51 AM, Ethan Furman wrote: > I recently committed a fix for unicodeobject.c so that the %d, %i, and %u > format specifiers always output values (otherwise, in subclasses, the str() > was used instead). > > Should this be fixed in 3.3 as well? > > What guidelines determine when a bug is fixed in previous versions? If it's a bug in that version and the version is accepting bug fixes, i.e., not in security mode, go for it. This includes crossing the 2/3 boundary if applicable. From cf.natali at gmail.com Fri Sep 6 17:29:12 2013 From: cf.natali at gmail.com (=?ISO-8859-1?Q?Charles=2DFran=E7ois_Natali?=) Date: Fri, 6 Sep 2013 17:29:12 +0200 Subject: [Python-Dev] DTRACE support In-Reply-To: <5229EFE7.8040702@jcea.es> References: <5229EFE7.8040702@jcea.es> Message-ID: > As far as I know, Erlang, Ruby, PHP, Perl, etc., support Dtrace. > Python is embarrasingly missing from this list. > > Some examples: > > > > > > I have spend a very long time on a patch for Dtrace support in most > platforms with dtrace available. Currently working under Solaris and > derivatives, and MacOS X. Last time I checked, it would crash FreeBSD > because bugs in the dtrace port, but that was a long time ago. > > I would like to push this to Python 3.4, and the window is going to be > closed soon, so I think this is the time to ask for opinions and > support here. > > Does Python-Dev have any opinion or interest in this project?. Should > I push for it? IMO, that's a large, intrusive patch, which distracts the reader from the main code and logic. Here's an extract from Modules/gcmodule.c: static void dtrace_gc_done(Py_ssize_t value) { PYTHON_GC_DONE((long) value); /* * Currently a USDT tail-call will not receive the correct arguments. * Disable the tail call here. */ #if defined(__sparc) asm("nop"); #endif } Also have a look at cevalc.c: http://bugs.python.org/review/13405/diff/6152/Python/ceval.c IMO it's not worth it (personally strace/gdb/valgrind are more than enough for me, and we''re about to gain memory tracing with Victor's tracemalloc). cf From rdmurray at bitdance.com Fri Sep 6 17:31:53 2013 From: rdmurray at bitdance.com (R. David Murray) Date: Fri, 06 Sep 2013 11:31:53 -0400 Subject: [Python-Dev] when to fix cross-version bugs? In-Reply-To: <5229EBDA.1030902@stoneleaf.us> References: <5229EBDA.1030902@stoneleaf.us> Message-ID: <20130906153153.D5DDF250845@webabinitio.net> On Fri, 06 Sep 2013 07:51:06 -0700, Ethan Furman wrote: > I recently committed a fix for unicodeobject.c so that the %d, %i, and %u format specifiers always output values > (otherwise, in subclasses, the str() was used instead). > > Should this be fixed in 3.3 as well? > > What guidelines determine when a bug is fixed in previous versions? The basic guideline is: we try very hard not to break currently working code in a maintenance release. Making that decision very much depends on the details of each individual case. I'd say this one is borderline...it would probably be OK to backport it, since programs depending on the str of number subclasses (that is what we are talking about here, right? Even though you say the fix is in unicodeobject.c...) are likely to be rare, or already have a workaround that won't get broken by the change, but by the same token it probably doesn't have much positive impact if it does get backported, so is it worth the (small) chance of breaking someone's code? --David From stefan_ml at behnel.de Fri Sep 6 17:33:47 2013 From: stefan_ml at behnel.de (Stefan Behnel) Date: Fri, 06 Sep 2013 17:33:47 +0200 Subject: [Python-Dev] unicodedata module is out of date In-Reply-To: References: Message-ID: Andrew Miller, 06.09.2013 11:54: > The unicodedata module only contains data up to Unicode 5.2 (October 2009), > so attempting to reference any character from a later version e.g: > > unicodedata.lookup("TURKISH LIRA SIGN") > > results in a KeyError. > > Also, it seems to be limited to properties in the UnicodeData.txt file and > does not contain any data from the other files from the Unicode Character > Database (the perl library Unicode::UCD is far more complete). > > Are there any plans to update this module to the latest Unicode version > (6.2, with 6.3 being released shortly) It's been updated to 6.2 almost a year ago, so Python 3.3 should have that. I don't think 6.3 support will be added before Python 3.4, assuming it's final by then. You should open a ticket so that it won't be forgotten before the release. http://bugs.python.org/ That being said, the module is (mostly) generated, so you might be able to fix it up yourself if you need it sooner in a local installation. Stefan From rdmurray at bitdance.com Fri Sep 6 17:35:06 2013 From: rdmurray at bitdance.com (R. David Murray) Date: Fri, 06 Sep 2013 11:35:06 -0400 Subject: [Python-Dev] unicodedata module is out of date In-Reply-To: References: Message-ID: <20130906153510.6CCB0250833@webabinitio.net> On Fri, 06 Sep 2013 10:54:45 +0100, Andrew Miller wrote: > Are there any plans to update this module to the latest Unicode version > (6.2, with 6.3 being released shortly), or is there another module that > provides more up to date information? Python 3.4 currently has 6.2. If 6.3 gets released before the first RC, I'm guessing we will probably upgrade to it. --David From python at mrabarnett.plus.com Fri Sep 6 17:38:03 2013 From: python at mrabarnett.plus.com (MRAB) Date: Fri, 06 Sep 2013 16:38:03 +0100 Subject: [Python-Dev] unicodedata module is out of date In-Reply-To: References: Message-ID: <5229F6DB.40000@mrabarnett.plus.com> On 06/09/2013 10:54, Andrew Miller wrote: > The unicodedata module only contains data up to Unicode 5.2 (October > 2009), so attempting to reference any character from a later version e.g: > > unicodedata.lookup("TURKISH LIRA SIGN") > > results in a KeyError. > > Also, it seems to be limited to properties in the UnicodeData.txt file > and does not contain any data from the other files from the Unicode > Character Database (the perl library Unicode::UCD is far more complete). > > Are there any plans to update this module to the latest Unicode version > (6.2, with 6.3 being released shortly), or is there another module that > provides more up to date information? > Which version of Python are you talking about? Python 3.3 uses Unicode version 6.1. From ethan at stoneleaf.us Fri Sep 6 17:14:09 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Fri, 06 Sep 2013 08:14:09 -0700 Subject: [Python-Dev] inspect and metaclasses In-Reply-To: References: <5229D97E.9080103@stoneleaf.us> Message-ID: <5229F141.2050007@stoneleaf.us> On 09/06/2013 07:47 AM, Armin Rigo wrote: > > Are you suggesting that inspect.getmro(A) would return (A, object, > type)? That seems very wrong to me. Currently, `inspect.getmro(A)` returns `(A, object)`. Considering that Python actually will look in A's metaclass to find a class attribute, I think returning `(A, object, type(A)` is appropriate: ================================================================================= Python 3.4.0a1+ (default:61ca4732399b+, Sep 4 2013, 22:28:04) [GCC 4.7.3] on linux Type "help", "copyright", "credits" or "license" for more information. --> class Meta(type): ... meta_attr = 42 ... --> class Class(metaclass=Meta): ... cls_attr = 'Vitamin-soaked towel' ... def __init__(self): ... self.inst_attr = 'dolphins' ... --> test = Class() --> test.inst_attr 'dolphins' --> test.cls_attr 'Vitamin-soaked towel' --> test.meta_attr Traceback (most recent call last): File "", line 1, in AttributeError: 'Class' object has no attribute 'meta_attr' --> Class.cls_attr 'Vitamin-soaked towel' --> Class.meta_attr 42 --> import inspect --> inspect.getmro(Class) # with patch in place (, , ) ================================================================================= > If the goal is to fix `inspect.classify_class_attrs()`, then this > function only needs a specific fix, along the lines of looking in > `getmro(A) + getmro(type(A))`. (A more minor issue is that the bug > report suggests `... + (type(A),)` only, but that's wrong: Python will > also look in all the base classes of type(A).) Good point. Will incorporate that into the final fix, whichever way it ends up. > "Fixing" inspect.getmro() as suggested would break a lot of other usages of it. Any examples? -- ~Ethan~ From rdmurray at bitdance.com Fri Sep 6 17:39:01 2013 From: rdmurray at bitdance.com (R. David Murray) Date: Fri, 06 Sep 2013 11:39:01 -0400 Subject: [Python-Dev] unicodedata module is out of date In-Reply-To: References: Message-ID: <20130906153901.9ED57250845@webabinitio.net> On Fri, 06 Sep 2013 17:33:47 +0200, Stefan Behnel wrote: > Andrew Miller, 06.09.2013 11:54: > > The unicodedata module only contains data up to Unicode 5.2 (October 2009), > > so attempting to reference any character from a later version e.g: > > > > unicodedata.lookup("TURKISH LIRA SIGN") > > > > results in a KeyError. > > > > Also, it seems to be limited to properties in the UnicodeData.txt file and > > does not contain any data from the other files from the Unicode Character > > Database (the perl library Unicode::UCD is far more complete). > > > > Are there any plans to update this module to the latest Unicode version > > (6.2, with 6.3 being released shortly) > > It's been updated to 6.2 almost a year ago, so Python 3.3 should have that. 3.3 shipped with 6.1. --David From solipsis at pitrou.net Fri Sep 6 17:41:11 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Fri, 6 Sep 2013 17:41:11 +0200 Subject: [Python-Dev] DTRACE support References: <5229EFE7.8040702@jcea.es> Message-ID: <20130906174111.446ea2c4@pitrou.net> Le Fri, 06 Sep 2013 17:08:23 +0200, Jesus Cea a ?crit : > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > As far as I know, Erlang, Ruby, PHP, Perl, etc., support Dtrace. > Python is embarrasingly missing from this list. > > Some examples: > > > > > > I have spend a very long time on a patch for Dtrace support in most > platforms with dtrace available. Currently working under Solaris and > derivatives, and MacOS X. Last time I checked, it would crash FreeBSD > because bugs in the dtrace port, but that was a long time ago. > > I would like to push this to Python 3.4, and the window is going to be > closed soon, so I think this is the time to ask for opinions and > support here. You should start by addressing review comments: http://bugs.python.org/issue13405#msg151751 Right now, I agree with Charles-Fran?ois: your patch is too intrusive. Regards Antoine. From rdmurray at bitdance.com Fri Sep 6 17:44:08 2013 From: rdmurray at bitdance.com (R. David Murray) Date: Fri, 06 Sep 2013 11:44:08 -0400 Subject: [Python-Dev] inspect and metaclasses In-Reply-To: <5229F141.2050007@stoneleaf.us> References: <5229D97E.9080103@stoneleaf.us> <5229F141.2050007@stoneleaf.us> Message-ID: <20130906154408.BFAAD250845@webabinitio.net> On Fri, 06 Sep 2013 08:14:09 -0700, Ethan Furman wrote: > On 09/06/2013 07:47 AM, Armin Rigo wrote: > > > > Are you suggesting that inspect.getmro(A) would return (A, object, > > type)? That seems very wrong to me. > > Currently, `inspect.getmro(A)` returns `(A, object)`. Which matches A.__mro__. EOD, I think. --David From solipsis at pitrou.net Fri Sep 6 17:43:13 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Fri, 6 Sep 2013 17:43:13 +0200 Subject: [Python-Dev] Details of "import lock" in 3.3 References: <5229EFEC.1010503@jcea.es> Message-ID: <20130906174313.63e37ac3@pitrou.net> Le Fri, 06 Sep 2013 17:08:28 +0200, Jesus Cea a ?crit : > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > With importlib and other recent changes, what are the current details > of "import lock"?. That is, the lock/locks held when Python code does > "import", specially in the case of multithreading. Is that documented > anywhere? Quick summary here: http://docs.python.org/3/whatsnew/3.3.html#a-finer-grained-import-lock Otherwise, I'm afraid the source code has the most information, e.g.: http://hg.python.org/cpython/file/1d88d04aade2/Lib/importlib/_bootstrap.py#l124 Regards Antoine. From benjamin at python.org Fri Sep 6 17:45:14 2013 From: benjamin at python.org (Benjamin Peterson) Date: Fri, 6 Sep 2013 11:45:14 -0400 Subject: [Python-Dev] unicodedata module is out of date In-Reply-To: References: Message-ID: 2013/9/6 Andrew Miller : > The unicodedata module only contains data up to Unicode 5.2 (October 2009), > so attempting to reference any character from a later version e.g: > > unicodedata.lookup("TURKISH LIRA SIGN") > > results in a KeyError. > > Also, it seems to be limited to properties in the UnicodeData.txt file and > does not contain any data from the other files from the Unicode Character > Database (the perl library Unicode::UCD is far more complete). > > Are there any plans to update this module to the latest Unicode version > (6.2, with 6.3 being released shortly), or is there another module that > provides more up to date information? I usually keep the latest Python version up to date with the latest Unicode version, so 3.4 will have Unicode 6.2. -- Regards, Benjamin From jcea at jcea.es Fri Sep 6 17:55:52 2013 From: jcea at jcea.es (Jesus Cea) Date: Fri, 06 Sep 2013 17:55:52 +0200 Subject: [Python-Dev] DTRACE support In-Reply-To: References: <5229EFE7.8040702@jcea.es> Message-ID: <5229FB08.20603@jcea.es> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 06/09/13 17:29, Charles-Fran?ois Natali wrote: > IMO, that's a large, intrusive patch, which distracts the reader > from the main code and logic. Yes, the patch is intrusive. It must be, to get its goals. Could be improved, nevertheless. Help and suggestions welcome. I want to write a probe for the GIL, but I didn't because I know adding the cost of an extra single machine code branch would be anathema here :-) (lets do baby steps), but I would love to be able to watch with detail all interaction between the GIL, threads, and OS scheduling on my Solaris :). That is very valuable information to have, for instance, to guide future improvements of the GIL. How can you get that kind of information with any other tool? > IMO it's not worth it (personally strace/gdb/valgrind are more > than enough for me, and we''re about to gain memory tracing with > Victor's tracemalloc). The main value of DTrace is systemwide observability. You can see something "strange" at kernel level and trace it to a particular line of code in a random Python script. There is no other tool that can do that. You have complete transversal observability of ALL the code running in your computer, kernel or usermode, clean reports with threads, etc. Valgrind doesn't work on Solaris and *BSD support is unclean. You can run a dtrace script in a long running python process if you need it, after launching it, at runtime, and when the dtrace script is done, the python program keeps running without any penalty. Just poking around, for instance. I do it constantly for, for instance, profiling covering both Python as any C code/libraries called from it. Maybe the biggest objection would be that most python-devs are running Linux, and you don't have dtrace support on linux unless you are running Oracle distribution. But world is larger than linux, and there are some efforts to port DTrace to Linux itself. DTrace is available on Solaris and derivatives, MacOS X and FreeBSD. - -- Jes?s Cea Avi?n _/_/ _/_/_/ _/_/_/ jcea at jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/ Twitter: @jcea _/_/ _/_/ _/_/_/_/_/ jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/ _/_/ _/_/ "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ "El amor es poner tu felicidad en la felicidad de otro" - Leibniz -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQCVAwUBUin7CJlgi5GaxT1NAQKbfwP+PjOqf3pjlHHq78ggA8qyNkjPFXEoRVj9 9PKslZ7FiU+JWxzXY52k1GNspHhIox+PAcvdBL/gWU3rOiqjEm5fU8FX61Lh6FMj bB+QRyZLpLfmANrLX43sBvwDbG9gTuq8FVUvqmtSme615vX2ygITwNZysQ7xPoD/ jXbeOAF0LZU= =asEC -----END PGP SIGNATURE----- From A.J.Miller at bcs.org.uk Fri Sep 6 17:29:32 2013 From: A.J.Miller at bcs.org.uk (Andrew Miller) Date: Fri, 6 Sep 2013 16:29:32 +0100 Subject: [Python-Dev] Fwd: unicodedata module is out of date In-Reply-To: References: Message-ID: The unicodedata module only contains data up to Unicode 5.2 (October 2009), so attempting to reference any character from a later version e.g: unicodedata.lookup("TURKISH LIRA SIGN") results in a KeyError. Also, it seems to be limited to properties in the UnicodeData.txt file and does not contain any data from the other files from the Unicode Character Database (the perl library Unicode::UCD is far more complete). Are there any plans to update this module to the latest Unicode version (6.2, with 6.3 being released shortly), or is there another module that provides more up to date information? Thanks, Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: From A.J.Miller at bcs.org.uk Fri Sep 6 17:55:22 2013 From: A.J.Miller at bcs.org.uk (Andrew Miller) Date: Fri, 6 Sep 2013 16:55:22 +0100 Subject: [Python-Dev] unicodedata module is out of date In-Reply-To: <5229F6DB.40000@mrabarnett.plus.com> References: <5229F6DB.40000@mrabarnett.plus.com> Message-ID: I've just checked on Python 2.7.5 and Python 3.3.2 (Win32 versions). In Python 3.3.2 unicodedata.unidata_version is set to '6.1.0'. In Python 2.7.5 it is set to '5.2.0' so it looks as though this version is no longer being updated. Since my initial post I've downloaded the Python 2.7.5 source and have found the makeunicodedata.py script which creates this module. Are there plans to add the extra data from the other UCD files to this module? At the moment I am using a module from https://gist.github.com/anonymous/2204527 to obtain the script of a character but it would be nice if this was available from the standard library. On 6 September 2013 16:38, MRAB wrote: > On 06/09/2013 10:54, Andrew Miller wrote: > >> The unicodedata module only contains data up to Unicode 5.2 (October >> 2009), so attempting to reference any character from a later version e.g: >> >> unicodedata.lookup("TURKISH LIRA SIGN") >> >> results in a KeyError. >> >> Also, it seems to be limited to properties in the UnicodeData.txt file >> and does not contain any data from the other files from the Unicode >> Character Database (the perl library Unicode::UCD is far more complete). >> >> Are there any plans to update this module to the latest Unicode version >> (6.2, with 6.3 being released shortly), or is there another module that >> provides more up to date information? >> >> Which version of Python are you talking about? Python 3.3 uses Unicode > version 6.1. > > ______________________________**_________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/**mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/**mailman/options/python-dev/a.** > j.miller%40bcs.org.uk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jcea at jcea.es Fri Sep 6 18:02:32 2013 From: jcea at jcea.es (Jesus Cea) Date: Fri, 06 Sep 2013 18:02:32 +0200 Subject: [Python-Dev] Details of "import lock" in 3.3 In-Reply-To: <20130906174313.63e37ac3@pitrou.net> References: <5229EFEC.1010503@jcea.es> <20130906174313.63e37ac3@pitrou.net> Message-ID: <5229FC98.9080106@jcea.es> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 06/09/13 17:43, Antoine Pitrou wrote: > Quick summary here: > http://docs.python.org/3/whatsnew/3.3.html#a-finer-grained-import-lock > > Otherwise, I'm afraid the source code has the most information, > e.g.: > http://hg.python.org/cpython/file/1d88d04aade2/Lib/importlib/_bootstrap.py#l124 Yes, > I was depending of the global import lock in my code. I am evaluating impact under Python 3.3. Under Python 3.3, metafinder/loader MUST BE reentrant?. Can they count on the fact that they could be called concurrently by multiple threads but NOT for importing the SAME module?. - -- Jes?s Cea Avi?n _/_/ _/_/_/ _/_/_/ jcea at jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/ Twitter: @jcea _/_/ _/_/ _/_/_/_/_/ jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/ _/_/ _/_/ "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ "El amor es poner tu felicidad en la felicidad de otro" - Leibniz -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQCVAwUBUin8mJlgi5GaxT1NAQKQugP+N0VI/BhqKvcaUicu7YMR09VhFweoAE6h c48ltOrhlWhrauYc9XYeoEPZ2ksl9/SDnMt83cE+qLunSBltkSbYv3j/0LXWyHwk ZGjzh5vQGTgCu3/2iCkFWq/tSAsgUfk8YfbwPQK82L1gs7LbC5vt2jWlRwNQs0nl 2Sr1Nlbf7og= =GL0o -----END PGP SIGNATURE----- From status at bugs.python.org Fri Sep 6 18:07:41 2013 From: status at bugs.python.org (Python tracker) Date: Fri, 6 Sep 2013 18:07:41 +0200 (CEST) Subject: [Python-Dev] Summary of Python tracker Issues Message-ID: <20130906160741.06F3F56A17@psf.upfronthosting.co.za> ACTIVITY SUMMARY (2013-08-30 - 2013-09-06) Python tracker at http://bugs.python.org/ To view or respond to any of the issues listed below, click on the issue. Do NOT respond to this message. Issues counts and deltas: open 4195 (+13) closed 26523 (+47) total 30718 (+60) Open issues with patches: 1915 Issues opened (43) ================== #16826: Don't check for PYTHONCASEOK if interpreter started with -E http://bugs.python.org/issue16826 reopened by meador.inge #18709: SSL module fails to handle NULL bytes inside subjectAltNames g http://bugs.python.org/issue18709 reopened by neologix #18886: BytesGenerator does not handle 'binary' CTE correctly http://bugs.python.org/issue18886 opened by r.david.murray #18887: test_multiprocessing.test_connection failure http://bugs.python.org/issue18887 opened by neologix #18890: Add a raw_data_manager content manager to the email package. http://bugs.python.org/issue18890 opened by r.david.murray #18891: Master patch for content manager addtion to email package. http://bugs.python.org/issue18891 opened by r.david.murray #18893: invalid exception handling in Lib/ctypes/macholib/dyld.py http://bugs.python.org/issue18893 opened by scoder #18894: In unittest.TestResult.failures remove deprecated fail* method http://bugs.python.org/issue18894 opened by py.user #18895: In unittest.TestResult.addError split the sentence http://bugs.python.org/issue18895 opened by py.user #18896: Remove namedtuple 255 arguments restriction http://bugs.python.org/issue18896 opened by valorien #18898: Apply the setobject optimizations to dictionaries http://bugs.python.org/issue18898 opened by rhettinger #18899: make pystone.py Py3 compatible in benchmark suite http://bugs.python.org/issue18899 opened by scoder #18900: Add the random.distrib module http://bugs.python.org/issue18900 opened by serhiy.storchaka #18902: Make ElementTree event handling more modular to allow custom t http://bugs.python.org/issue18902 opened by eli.bendersky #18903: IDLE file-completion is case-sensitive in Windows http://bugs.python.org/issue18903 opened by anikom15 #18904: Unnecessary test in file descriptor inheritance test http://bugs.python.org/issue18904 opened by vajrasky #18905: pydoc -p 0 says the server is available at localhost:0 http://bugs.python.org/issue18905 opened by Wieland.Hoffmann #18906: Create a way to always run tests in subprocesses within regrte http://bugs.python.org/issue18906 opened by eli.bendersky #18907: urllib2.open FTP open times out at 20 secs despite timeout par http://bugs.python.org/issue18907 opened by nagle #18908: Enum docs: sections leak out http://bugs.python.org/issue18908 opened by elazar #18910: IDLE: Unit test for textView.py http://bugs.python.org/issue18910 opened by philwebster #18911: minidom does not encode correctly when calling Document.writex http://bugs.python.org/issue18911 opened by brianvanderburg2 #18913: ssl._ssl._test_decode_cert seems to leak memory with certain c http://bugs.python.org/issue18913 opened by sYnfo #18915: ssl.wrap_socket, pass in certfile and keyfile as PEM strings http://bugs.python.org/issue18915 opened by mpb #18916: Various out-of-date Lock text in 3.2+ http://bugs.python.org/issue18916 opened by tim.peters #18917: python won't display greek characters in apache under windows http://bugs.python.org/issue18917 opened by nickl1 #18918: help('FILES') finds no documentation http://bugs.python.org/issue18918 opened by st.sempert at gmail.com #18919: Unify audio modules tests http://bugs.python.org/issue18919 opened by serhiy.storchaka #18921: In imaplib, cached capabilities may be out of date after login http://bugs.python.org/issue18921 opened by sjmurdoch #18923: Use the new selectors module in the subprocess module http://bugs.python.org/issue18923 opened by haypo #18925: select.poll.modify is not documented http://bugs.python.org/issue18925 opened by giampaolo.rodola #18927: Lock.acquire() docs incorrect about negative timeout http://bugs.python.org/issue18927 opened by tim.peters #18929: inspect.classify_class_attrs ignores metaclass http://bugs.python.org/issue18929 opened by ethan.furman #18930: os.spawnXX functions terminates process if second argument is http://bugs.python.org/issue18930 opened by SSchukat #18931: new selectors module should support devpoll on Solaris http://bugs.python.org/issue18931 opened by giampaolo.rodola #18932: selectors and modify() http://bugs.python.org/issue18932 opened by giampaolo.rodola #18934: multiprocessing: use selectors module http://bugs.python.org/issue18934 opened by neologix #18935: test_regrtest.test_timeout failure http://bugs.python.org/issue18935 opened by neologix #18936: getopt chokes on unicode option names http://bugs.python.org/issue18936 opened by jason.coombs #18937: add unittest assertion for logging http://bugs.python.org/issue18937 opened by pitrou #18943: argparse: default args in mutually exclusive groups http://bugs.python.org/issue18943 opened by arigo #18944: Minor mistake in test_set.py http://bugs.python.org/issue18944 opened by arigo #18945: Name collision handling in tempfile is not covered by tests http://bugs.python.org/issue18945 opened by vlad Most recent 15 issues with no replies (15) ========================================== #18945: Name collision handling in tempfile is not covered by tests http://bugs.python.org/issue18945 #18944: Minor mistake in test_set.py http://bugs.python.org/issue18944 #18943: argparse: default args in mutually exclusive groups http://bugs.python.org/issue18943 #18936: getopt chokes on unicode option names http://bugs.python.org/issue18936 #18935: test_regrtest.test_timeout failure http://bugs.python.org/issue18935 #18932: selectors and modify() http://bugs.python.org/issue18932 #18930: os.spawnXX functions terminates process if second argument is http://bugs.python.org/issue18930 #18927: Lock.acquire() docs incorrect about negative timeout http://bugs.python.org/issue18927 #18915: ssl.wrap_socket, pass in certfile and keyfile as PEM strings http://bugs.python.org/issue18915 #18910: IDLE: Unit test for textView.py http://bugs.python.org/issue18910 #18905: pydoc -p 0 says the server is available at localhost:0 http://bugs.python.org/issue18905 #18904: Unnecessary test in file descriptor inheritance test http://bugs.python.org/issue18904 #18903: IDLE file-completion is case-sensitive in Windows http://bugs.python.org/issue18903 #18895: In unittest.TestResult.addError split the sentence http://bugs.python.org/issue18895 #18894: In unittest.TestResult.failures remove deprecated fail* method http://bugs.python.org/issue18894 Most recent 15 issues waiting for review (15) ============================================= #18944: Minor mistake in test_set.py http://bugs.python.org/issue18944 #18935: test_regrtest.test_timeout failure http://bugs.python.org/issue18935 #18934: multiprocessing: use selectors module http://bugs.python.org/issue18934 #18931: new selectors module should support devpoll on Solaris http://bugs.python.org/issue18931 #18919: Unify audio modules tests http://bugs.python.org/issue18919 #18910: IDLE: Unit test for textView.py http://bugs.python.org/issue18910 #18908: Enum docs: sections leak out http://bugs.python.org/issue18908 #18905: pydoc -p 0 says the server is available at localhost:0 http://bugs.python.org/issue18905 #18904: Unnecessary test in file descriptor inheritance test http://bugs.python.org/issue18904 #18899: make pystone.py Py3 compatible in benchmark suite http://bugs.python.org/issue18899 #18898: Apply the setobject optimizations to dictionaries http://bugs.python.org/issue18898 #18895: In unittest.TestResult.addError split the sentence http://bugs.python.org/issue18895 #18894: In unittest.TestResult.failures remove deprecated fail* method http://bugs.python.org/issue18894 #18893: invalid exception handling in Lib/ctypes/macholib/dyld.py http://bugs.python.org/issue18893 #18891: Master patch for content manager addtion to email package. http://bugs.python.org/issue18891 Top 10 most discussed issues (10) ================================= #18808: Thread.join returns before PyThreadState is destroyed http://bugs.python.org/issue18808 11 msgs #18844: allow weights in random.choice http://bugs.python.org/issue18844 11 msgs #18843: Py_FatalError (msg=0x7f0e3b373232 "bad leading pad byte") at P http://bugs.python.org/issue18843 10 msgs #18693: help() not helpful with enum http://bugs.python.org/issue18693 9 msgs #18726: json functions have too many positional parameters http://bugs.python.org/issue18726 9 msgs #18913: ssl._ssl._test_decode_cert seems to leak memory with certain c http://bugs.python.org/issue18913 8 msgs #18831: importlib.import_module() bypasses builtins.__import__ http://bugs.python.org/issue18831 7 msgs #18709: SSL module fails to handle NULL bytes inside subjectAltNames g http://bugs.python.org/issue18709 6 msgs #18840: Tutorial recommends pickle module without any warning of insec http://bugs.python.org/issue18840 6 msgs #18876: Problems with files opened in append mode with io module http://bugs.python.org/issue18876 6 msgs Issues closed (43) ================== #12037: test_email failures under desktop Windows http://bugs.python.org/issue12037 closed by terry.reedy #15350: {urllib,urllib.parse}.urlencode.__doc__ is unclear http://bugs.python.org/issue15350 closed by orsenthil #16853: add a Selector to the select module http://bugs.python.org/issue16853 closed by pitrou #17224: can not open idle in python 2.7.3 http://bugs.python.org/issue17224 closed by terry.reedy #17930: Search not needed in combinations_with_replacement http://bugs.python.org/issue17930 closed by tim.peters #18105: ElementTree writes invalid files when UTF-16 encoding is speci http://bugs.python.org/issue18105 closed by eli.bendersky #18418: Thread.isAlive() sometimes True after fork http://bugs.python.org/issue18418 closed by neologix #18489: IDLE Unit test for SearchEngine.py http://bugs.python.org/issue18489 closed by terry.reedy #18672: Fix format specifiers for debug output in _sre.c http://bugs.python.org/issue18672 closed by serhiy.storchaka #18720: Switch suitable constants in the socket module to IntEnum http://bugs.python.org/issue18720 closed by python-dev #18738: String formatting (% and str.format) issues with Enum http://bugs.python.org/issue18738 closed by python-dev #18745: Test enum in test_json is ignorant of infinity value http://bugs.python.org/issue18745 closed by python-dev #18750: '' % [1] doesn't fail http://bugs.python.org/issue18750 closed by asvetlov #18756: os.urandom() fails under high load http://bugs.python.org/issue18756 closed by pitrou #18780: SystemError when formatting int subclass http://bugs.python.org/issue18780 closed by python-dev #18826: reversed() requires a sequence - Could work on any iterator? http://bugs.python.org/issue18826 closed by rhettinger #18830: Remove duplicates from a result of getclasstree() http://bugs.python.org/issue18830 closed by serhiy.storchaka #18845: 2.7.5-r2: Fatal Python error: Segmentation fault http://bugs.python.org/issue18845 closed by tim.peters #18849: Failure to try another name for tempfile when directory with c http://bugs.python.org/issue18849 closed by python-dev #18850: xml.etree.ElementTree accepts control chars. http://bugs.python.org/issue18850 closed by eli.bendersky #18851: subprocess's Popen closes stdout/stderr filedescriptors used i http://bugs.python.org/issue18851 closed by pitrou #18870: eval() uses latin-1 to decode str http://bugs.python.org/issue18870 closed by python-dev #18878: Add support of the 'with' statement to sunau.open. http://bugs.python.org/issue18878 closed by serhiy.storchaka #18882: Add threading.main_thread() function http://bugs.python.org/issue18882 closed by asvetlov #18888: Add stdlib support for random sampling with replacement http://bugs.python.org/issue18888 closed by mark.dickinson #18889: test_sax: multiple failures on Windows desktop http://bugs.python.org/issue18889 closed by tim.peters #18892: sqlite3, valued records not persisted, default ones are http://bugs.python.org/issue18892 closed by debewerker #18897: Illegal instruction at Python-2.7.5/Modules/_sre.c:1173 http://bugs.python.org/issue18897 closed by pitrou #18901: sunau.getparams should return a namedtuple http://bugs.python.org/issue18901 closed by serhiy.storchaka #18909: Segfaults on win-amd64 due to corrupt pointer to Tkapp_Interp http://bugs.python.org/issue18909 closed by haypo #18912: Intendation issue in example code in itertools.count documenta http://bugs.python.org/issue18912 closed by python-dev #18914: Confusing documentation in the urllib2 HOWTO http://bugs.python.org/issue18914 closed by michael.foord #18920: argparse module version action http://bugs.python.org/issue18920 closed by eli.bendersky #18922: Output versions of scripts to stdout http://bugs.python.org/issue18922 closed by serhiy.storchaka #18924: Enum members are easily replaced http://bugs.python.org/issue18924 closed by python-dev #18926: plistlib - str converted to bool http://bugs.python.org/issue18926 closed by VertigoRay #18928: Remove misleading documentation for random.shuffle http://bugs.python.org/issue18928 closed by dbenbenn #18933: Add link to source code in logging documentation http://bugs.python.org/issue18933 closed by python-dev #18938: Prepend Is Not A Word http://bugs.python.org/issue18938 closed by benjamin.peterson #18939: Venv docs regarding original python install http://bugs.python.org/issue18939 closed by python-dev #18940: TimedRotatingFileHandler and RotatingFileHandler fail to doRol http://bugs.python.org/issue18940 closed by python-dev #18941: RotatingFileHandler and TimedRotatingFileHandler do not respec http://bugs.python.org/issue18941 closed by python-dev #18942: _debugmallocstats() gibberish output on Windows http://bugs.python.org/issue18942 closed by tim.peters From jcea at jcea.es Fri Sep 6 18:14:26 2013 From: jcea at jcea.es (Jesus Cea) Date: Fri, 06 Sep 2013 18:14:26 +0200 Subject: [Python-Dev] DTRACE support In-Reply-To: <20130906174111.446ea2c4@pitrou.net> References: <5229EFE7.8040702@jcea.es> <20130906174111.446ea2c4@pitrou.net> Message-ID: <5229FF62.9020702@jcea.es> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 06/09/13 17:41, Antoine Pitrou wrote: > You should start by addressing review comments: > http://bugs.python.org/issue13405#msg151751 Antoine, my first step now is to poke Python-DEV about this subject. If the consensus is "DON'T" I will probably maintain this patch by myself. I saw big "BUTs" with this work in the bug tracker, so I rather prefer to ask for actual interest before investing in iron out patch implementation details. If devs actually want it, then next step is to improve current work to make it acceptable in mainline. There are quite a few ugly corners I would love to file out, beside your (really valuable) feedback. That is how I see it. > Right now, I agree with Charles-Fran?ois: your patch is too > intrusive. It is intrusive. Yes. I think it must be, by its own nature. Probably room for improvement and code transparency. But... are Python-DEVs interested in the project?. That is the point :) - -- Jes?s Cea Avi?n _/_/ _/_/_/ _/_/_/ jcea at jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/ Twitter: @jcea _/_/ _/_/ _/_/_/_/_/ jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/ _/_/ _/_/ "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ "El amor es poner tu felicidad en la felicidad de otro" - Leibniz -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQCVAwUBUin/Yplgi5GaxT1NAQI6tAP+MaGbSm8j3xPBjMui9tePg2engB+G/ckh TzVac8Gz5yhWhixOFLk3cXYySieB6ttjsAG1NZYKxIwyLSLrxcL8pTh4c8oHB8zu /wYfIdXt6leH6HECXJquPLxLM39Z6KIOTt2QgKYSWy6ZHGzVaaeTFvrMhW0N/5rp SCHSJQc7Vn4= =65h4 -----END PGP SIGNATURE----- From ethan at stoneleaf.us Fri Sep 6 17:59:02 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Fri, 06 Sep 2013 08:59:02 -0700 Subject: [Python-Dev] inspect and metaclasses In-Reply-To: <20130906154408.BFAAD250845@webabinitio.net> References: <5229D97E.9080103@stoneleaf.us> <5229F141.2050007@stoneleaf.us> <20130906154408.BFAAD250845@webabinitio.net> Message-ID: <5229FBC6.1020708@stoneleaf.us> On 09/06/2013 08:44 AM, R. David Murray wrote: > On Fri, 06 Sep 2013 08:14:09 -0700, Ethan Furman wrote: >> On 09/06/2013 07:47 AM, Armin Rigo wrote: >>> >>> Are you suggesting that inspect.getmro(A) would return (A, object, >>> type)? That seems very wrong to me. >> >> Currently, `inspect.getmro(A)` returns `(A, object)`. > > Which matches A.__mro__. EOD, I think. I hope not, because currently this leaves a hole in the introspection of class attributes. Is __mro__ aimed primarily at instances and not classes? That seems to be how it works. In which case, do we need another __mmro__ (or __cmro__ or ...) to handle the mro of classes themselves? For the short term I can restrict the change to inspect.classify_class_attrs(). -- ~Ethan~ From rdmurray at bitdance.com Fri Sep 6 18:37:28 2013 From: rdmurray at bitdance.com (R. David Murray) Date: Fri, 06 Sep 2013 12:37:28 -0400 Subject: [Python-Dev] inspect and metaclasses In-Reply-To: <5229FBC6.1020708@stoneleaf.us> References: <5229D97E.9080103@stoneleaf.us> <5229F141.2050007@stoneleaf.us> <20130906154408.BFAAD250845@webabinitio.net> <5229FBC6.1020708@stoneleaf.us> Message-ID: <20130906163728.ACFAD2507F1@webabinitio.net> On Fri, 06 Sep 2013 08:59:02 -0700, Ethan Furman wrote: > On 09/06/2013 08:44 AM, R. David Murray wrote: > > On Fri, 06 Sep 2013 08:14:09 -0700, Ethan Furman wrote: > >> On 09/06/2013 07:47 AM, Armin Rigo wrote: > >>> > >>> Are you suggesting that inspect.getmro(A) would return (A, object, > >>> type)? That seems very wrong to me. > >> > >> Currently, `inspect.getmro(A)` returns `(A, object)`. > > > > Which matches A.__mro__. EOD, I think. > > I hope not, because currently this leaves a hole in the introspection of class attributes. > > Is __mro__ aimed primarily at instances and not classes? That seems to be how it works. In which case, do we need > another __mmro__ (or __cmro__ or ...) to handle the mro of classes themselves? Or maybe just a new inspect function? > For the short term I can restrict the change to inspect.classify_class_attrs(). Sounds like the best course. --David From ethan at stoneleaf.us Fri Sep 6 18:18:12 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Fri, 06 Sep 2013 09:18:12 -0700 Subject: [Python-Dev] when to fix cross-version bugs? In-Reply-To: <5229EBDA.1030902@stoneleaf.us> References: <5229EBDA.1030902@stoneleaf.us> Message-ID: <522A0044.10302@stoneleaf.us> On 09/06/2013 07:51 AM, Ethan Furman wrote: > > What guidelines determine when a bug is fixed in previous versions? On 09/06/2013 08:29 AM, Brian Curtin wrote: > > If it's a bug in that version and the version is accepting bug fixes, > i.e., not in security mode, go for it. This includes crossing the 2/3 > boundary if applicable. On 09/06/2013 08:31 AM, R. David Murray wrote: > > The basic guideline is: we try very hard not to break currently working > code in a maintenance release. Making that decision very much depends on > the details of each individual case. > > [so] it probably doesn't have much positive impact if it does get > backported, so is it worth the (small) chance of breaking someone's code? And they say never go to the elves for advice! ;) -- ~Ethan~ From solipsis at pitrou.net Fri Sep 6 19:02:47 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Fri, 6 Sep 2013 19:02:47 +0200 Subject: [Python-Dev] inspect and metaclasses References: <5229D97E.9080103@stoneleaf.us> <5229F141.2050007@stoneleaf.us> Message-ID: <20130906190247.61d5db99@fsol> On Fri, 06 Sep 2013 08:14:09 -0700 Ethan Furman wrote: > On 09/06/2013 07:47 AM, Armin Rigo wrote: > > > > Are you suggesting that inspect.getmro(A) would return (A, object, > > type)? That seems very wrong to me. > > Currently, `inspect.getmro(A)` returns `(A, object)`. > > Considering that Python actually will look in A's metaclass to find a class attribute, I think returning `(A, object, > type(A)` is appropriate: No, I don't think it's appropriate at all. You are conflating two things: - the instance lookup of an attribute (on A, here) - the class lookup when the instance lookup fails (on type, here) Both lookups obey the same MRO rules, it just happens that the second lookup uses a trivial MRO: >>> type.__mro__ (, ) Regards Antoine. From solipsis at pitrou.net Fri Sep 6 19:05:16 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Fri, 6 Sep 2013 19:05:16 +0200 Subject: [Python-Dev] DTRACE support References: <5229EFE7.8040702@jcea.es> <20130906174111.446ea2c4@pitrou.net> <5229FF62.9020702@jcea.es> Message-ID: <20130906190516.471028ba@fsol> On Fri, 06 Sep 2013 18:14:26 +0200 Jesus Cea wrote: > > > Right now, I agree with Charles-Fran?ois: your patch is too > > intrusive. > > It is intrusive. Yes. I think it must be, by its own nature. Probably > room for improvement and code transparency. But... are Python-DEVs > interested in the project?. That is the point :) Well, I'm not *personally* interested in anything that only addresses Solaris, OS X and the like :) And, no, it doesn't have to be *that* intrusive. Take a look at Dave Malcolm's systemtap patch, which IIRC takes a much more sensible approach. Regards Antoine. From solipsis at pitrou.net Fri Sep 6 19:06:21 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Fri, 6 Sep 2013 19:06:21 +0200 Subject: [Python-Dev] Details of "import lock" in 3.3 References: <5229EFEC.1010503@jcea.es> <20130906174313.63e37ac3@pitrou.net> <5229FC98.9080106@jcea.es> Message-ID: <20130906190621.6b1b8a01@fsol> On Fri, 06 Sep 2013 18:02:32 +0200 Jesus Cea wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 06/09/13 17:43, Antoine Pitrou wrote: > > Quick summary here: > > http://docs.python.org/3/whatsnew/3.3.html#a-finer-grained-import-lock > > > > Otherwise, I'm afraid the source code has the most information, > > e.g.: > > http://hg.python.org/cpython/file/1d88d04aade2/Lib/importlib/_bootstrap.py#l124 > > Yes, > > > I was depending of the global import lock in my code. I am > evaluating impact under Python 3.3. > > Under Python 3.3, metafinder/loader MUST BE reentrant?. No, they shouldn't have to. Normally, the global import lock is still held at this point. However, it is best to check the code if you want to be sure. Regards Antoine. From cf.natali at gmail.com Fri Sep 6 19:12:46 2013 From: cf.natali at gmail.com (=?ISO-8859-1?Q?Charles=2DFran=E7ois_Natali?=) Date: Fri, 6 Sep 2013 19:12:46 +0200 Subject: [Python-Dev] DTRACE support In-Reply-To: <5229FB08.20603@jcea.es> References: <5229EFE7.8040702@jcea.es> <5229FB08.20603@jcea.es> Message-ID: > The main value of DTrace is systemwide observability. You can see > something "strange" at kernel level and trace it to a particular line > of code in a random Python script. There is no other tool that can do > that. You have complete transversal observability of ALL the code > running in your computer, kernel or usermode, clean reports with > threads, etc. Don't get me wrong, I'm not saying DTrace is useless. I'm just saying that, as far as I'm concerned, I've never had any trouble debugging/tunning a Python script with non-intrusive tools (strace, gdb, valgrind, and oprofile for profiling). Of course, this includes analysing bug reports. > Maybe the biggest objection would be that most python-devs are running > Linux, and you don't have dtrace support on linux unless you are > running Oracle distribution. But world is larger than linux, and there > are some efforts to port DTrace to Linux itself. DTrace is available > on Solaris and derivatives, MacOS X and FreeBSD. That's true, I might have a different opinion if I used Solaris. But that's not the case, so te me, the cognitive overhead incurred by this large patch isn't worth it. So I'm -1, but that's a personal opinion :-) cf From dcallahan at mozilla.com Fri Sep 6 19:22:49 2013 From: dcallahan at mozilla.com (Dan Callahan) Date: Fri, 06 Sep 2013 12:22:49 -0500 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <5228C00F.7000209@jcea.es> References: <5228C00F.7000209@jcea.es> Message-ID: On 9/5/13 12:31 PM, Jesus Cea wrote: > I have big hopes for Mozilla Persona, looking forward > Python infrastructure support :). Hi, I'm the project lead on Persona signin, and I spoke at PyCon earlier this year regarding why and how Mozilla is building Persona. If you'd like some more background, that video [0] is worth a look. Let's pull this discussion up a level: It sounds like many people (Jesus, Donald, Toshio, Barry, Tres, Dirkjan, etc.) are interested in seeing Persona on Python.org properties, and most of the objections coming from a place of "Persona hasn't gone viral, what if this is wasted effort?" We can tackle that from two angles: 1. Dirkjan and I are willing to do the work to make this happen if someone from python-devel is willing to guide us through the contributor process for these systems. 2. There's a seamless migration path away from Persona if we fail: fall back to the pre-existing traditional email/password system using the same email addresses that Persona had previously been in charge of verifying. So let's do this. The open web deserves better than just Google+, Facebook, or Passwords, and visible support from the Python community would be a huge step toward answering the chicken-and-egg objections raised in this thread. At your service, -Callahad PS: Freeform OpenID has utterly failed as a user-empowering authentication system, and the protocol itself is rapidly being supplanted by vendor-specific OAuth[1] systems. If we want to ensure that "you *can* (not *must*) use free and open services to access our resources," then we must provide an option to use something akin to Persona. [0]: http://pyvideo.org/video/1764 [1]: "Google's OpenID service is being replaced by Login with OAuth 2.0." https://developers.google.com/accounts/docs/GettingStarted From ethan at stoneleaf.us Fri Sep 6 19:01:32 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Fri, 06 Sep 2013 10:01:32 -0700 Subject: [Python-Dev] inspect and metaclasses In-Reply-To: <20130906163728.ACFAD2507F1@webabinitio.net> References: <5229D97E.9080103@stoneleaf.us> <5229F141.2050007@stoneleaf.us> <20130906154408.BFAAD250845@webabinitio.net> <5229FBC6.1020708@stoneleaf.us> <20130906163728.ACFAD2507F1@webabinitio.net> Message-ID: <522A0A6C.9040401@stoneleaf.us> On 09/06/2013 09:37 AM, R. David Murray wrote: > On Fri, 06 Sep 2013 08:59:02 -0700, Ethan Furman wrote: >> >> For the short term I can restrict the change to inspect.classify_class_attrs(). > > Sounds like the best course. There is one other function in inspect that calls getmro(): def getmembers(object, predicate=None): """Return all members of an object as (name, value) pairs sorted by name. Optionally, only return members that satisfy a given predicate.""" if isclass(object): mro = (object,) + getmro(object) Should I add `+ getmro(type(object))` here as well? -- ~Ethan~ From guido at python.org Fri Sep 6 20:01:39 2013 From: guido at python.org (Guido van Rossum) Date: Fri, 6 Sep 2013 11:01:39 -0700 Subject: [Python-Dev] DTRACE support In-Reply-To: References: <5229EFE7.8040702@jcea.es> <5229FB08.20603@jcea.es> Message-ID: I think there are a couple of issues. - In order for the patch to be acceptable, we'd need someone to take responsibility for owning and maintaining it for at least several years. Jesus, are you willing to commit to this? - I think it's not all that important whether any core developer would want to use this for themselves; it's enough if it's useful for others to have this, and it's clear that at least *some* users really like this. Different people like different tools, and that's fine. - There are good reasons (e.g. standardizing a set of probes) for having a somewhat supported version around. - Since this *has* to be done in the form of a patch plus a new configure option, an externally-maintained patch is awkward at least, and likely to be continually out of date -- this is not something that you can just as easily put on PyPI as the recommended 3rd party solution. - So I'm personally inclined to say "yes, Jesus, if you are willing to maintain this code (while it is in the core) for several more years, please invest more of your time, and, assuming you can satisfy the code reviewers' feedback, we want to accept this in the core, hopefully in 3.4 if you get it in an acceptable state before 3.4 beta 1 is released." On Fri, Sep 6, 2013 at 10:12 AM, Charles-Fran?ois Natali wrote: >> The main value of DTrace is systemwide observability. You can see >> something "strange" at kernel level and trace it to a particular line >> of code in a random Python script. There is no other tool that can do >> that. You have complete transversal observability of ALL the code >> running in your computer, kernel or usermode, clean reports with >> threads, etc. > > Don't get me wrong, I'm not saying DTrace is useless. > I'm just saying that, as far as I'm concerned, I've never had any > trouble debugging/tunning a Python script with non-intrusive tools > (strace, gdb, valgrind, and oprofile for profiling). Of course, this > includes analysing bug reports. > >> Maybe the biggest objection would be that most python-devs are running >> Linux, and you don't have dtrace support on linux unless you are >> running Oracle distribution. But world is larger than linux, and there >> are some efforts to port DTrace to Linux itself. DTrace is available >> on Solaris and derivatives, MacOS X and FreeBSD. > > That's true, I might have a different opinion if I used Solaris. But > that's not the case, so te me, the cognitive overhead incurred by this > large patch isn't worth it. > > So I'm -1, but that's a personal opinion :-) > > cf > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/guido%40python.org -- --Guido van Rossum (python.org/~guido) From tjreedy at udel.edu Fri Sep 6 20:24:57 2013 From: tjreedy at udel.edu (Terry Reedy) Date: Fri, 06 Sep 2013 14:24:57 -0400 Subject: [Python-Dev] unicodedata module is out of date In-Reply-To: References: <5229F6DB.40000@mrabarnett.plus.com> Message-ID: On 9/6/2013 11:55 AM, Andrew Miller wrote: > I've just checked on Python 2.7.5 and Python 3.3.2 (Win32 versions). > > In Python 3.3.2 unicodedata.unidata_version is set to '6.1.0'. > > In Python 2.7.5 it is set to '5.2.0' so it looks as though this version > is no longer being updated. In general, new features do not go into bugfix releases (x.y.z, where z >= 1). Updating the unidate_version add new features to the unicodedata module. -- Terry Jan Reedy From solipsis at pitrou.net Fri Sep 6 20:33:34 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Fri, 6 Sep 2013 20:33:34 +0200 Subject: [Python-Dev] DTRACE support References: <5229EFE7.8040702@jcea.es> <20130906174111.446ea2c4@pitrou.net> <5229FF62.9020702@jcea.es> Message-ID: <20130906203334.1a99c99d@fsol> On Fri, 06 Sep 2013 18:14:26 +0200 Jesus Cea wrote: > > It is intrusive. Yes. I think it must be, by its own nature. Probably > room for improvement and code transparency. But... are Python-DEVs > interested in the project?. That is the point :) As a concrete data point: - here are Dave's modifications to ceval.c for systemtap: http://bugs.python.org/review/14776/diff/5177/Python/ceval.c - here are your modifications to ceval.c for dtrace: http://bugs.python.org/review/13405/diff/6151/Python/ceval.c Regards Antoine. From rdmurray at bitdance.com Fri Sep 6 20:34:54 2013 From: rdmurray at bitdance.com (R. David Murray) Date: Fri, 06 Sep 2013 14:34:54 -0400 Subject: [Python-Dev] inspect and metaclasses In-Reply-To: <522A0A6C.9040401@stoneleaf.us> References: <5229D97E.9080103@stoneleaf.us> <5229F141.2050007@stoneleaf.us> <20130906154408.BFAAD250845@webabinitio.net> <5229FBC6.1020708@stoneleaf.us> <20130906163728.ACFAD2507F1@webabinitio.net> <522A0A6C.9040401@stoneleaf.us> Message-ID: <20130906183455.28546250816@webabinitio.net> On Fri, 06 Sep 2013 10:01:32 -0700, Ethan Furman wrote: > On 09/06/2013 09:37 AM, R. David Murray wrote: > > On Fri, 06 Sep 2013 08:59:02 -0700, Ethan Furman wrote: > >> > >> For the short term I can restrict the change to inspect.classify_class_attrs(). > > > > Sounds like the best course. > > There is one other function in inspect that calls getmro(): > > def getmembers(object, predicate=None): > """Return all members of an object as (name, value) pairs sorted by name. > Optionally, only return members that satisfy a given predicate.""" > if isclass(object): > mro = (object,) + getmro(object) > > Should I add `+ getmro(type(object))` here as well? Not unless you want to void the warranty on the docs :) Note getmembers() does not return metaclass attributes when the argument is a class (this behavior is inherited from the dir() function). --David From donald at stufft.io Fri Sep 6 20:53:00 2013 From: donald at stufft.io (Donald Stufft) Date: Fri, 6 Sep 2013 14:53:00 -0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: References: <5228C00F.7000209@jcea.es> Message-ID: <6DB0A7E3-FADD-4E35-A983-02A7C0D4CAE3@stufft.io> On Sep 6, 2013, at 1:22 PM, Dan Callahan wrote: > On 9/5/13 12:31 PM, Jesus Cea wrote: >> I have big hopes for Mozilla Persona, looking forward >> Python infrastructure support :). > > Hi, I'm the project lead on Persona signin, and I spoke at PyCon earlier this year regarding why and how Mozilla is building Persona. If you'd like some more background, that video [0] is worth a look. > > Let's pull this discussion up a level: > > It sounds like many people (Jesus, Donald, Toshio, Barry, Tres, Dirkjan, etc.) are interested in seeing Persona on Python.org properties, and most of the objections coming from a place of "Persona hasn't gone viral, what if this is wasted effort?" > > We can tackle that from two angles: > > 1. Dirkjan and I are willing to do the work to make this happen if someone from python-devel is willing to guide us through the contributor process for these systems. FWIW I'm a maintainer of PyPI and I do plan on enabling Persona there. Mostly blocked because I want to focus my PyPI efforts on the "next gen" code base instead. > > 2. There's a seamless migration path away from Persona if we fail: fall back to the pre-existing traditional email/password system using the same email addresses that Persona had previously been in charge of verifying. > > So let's do this. The open web deserves better than just Google+, Facebook, or Passwords, and visible support from the Python community would be a huge step toward answering the chicken-and-egg objections raised in this thread. > > At your service, > -Callahad > > PS: Freeform OpenID has utterly failed as a user-empowering authentication system, and the protocol itself is rapidly being supplanted by vendor-specific OAuth[1] systems. If we want to ensure that "you *can* (not *must*) use free and open services to access our resources," then we must provide an option to use something akin to Persona. > > [0]: http://pyvideo.org/video/1764 > > [1]: "Google's OpenID service is being replaced by Login with OAuth 2.0." https://developers.google.com/accounts/docs/GettingStarted > > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/donald%40stufft.io ----------------- Donald Stufft PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: Message signed with OpenPGP using GPGMail URL: From rdmurray at bitdance.com Fri Sep 6 21:11:29 2013 From: rdmurray at bitdance.com (R. David Murray) Date: Fri, 06 Sep 2013 15:11:29 -0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <6DB0A7E3-FADD-4E35-A983-02A7C0D4CAE3@stufft.io> References: <5228C00F.7000209@jcea.es> <6DB0A7E3-FADD-4E35-A983-02A7C0D4CAE3@stufft.io> Message-ID: <20130906191130.B6511250816@webabinitio.net> On Fri, 06 Sep 2013 14:53:00 -0400, Donald Stufft wrote: > > On Sep 6, 2013, at 1:22 PM, Dan Callahan wrote: > > > On 9/5/13 12:31 PM, Jesus Cea wrote: > >> I have big hopes for Mozilla Persona, looking forward > >> Python infrastructure support :). > > > > Hi, I'm the project lead on Persona signin, and I spoke at PyCon > > earlier this year regarding why and how Mozilla is building Persona. > > If you'd like some more background, that video [0] is worth a look. > > > > Let's pull this discussion up a level: > > > > It sounds like many people (Jesus, Donald, Toshio, Barry, Tres, > > Dirkjan, etc.) are interested in seeing Persona on Python.org > > properties, and most of the objections coming from a place of > > "Persona hasn't gone viral, what if this is wasted effort?" > > > > We can tackle that from two angles: > > > > 1. Dirkjan and I are willing to do the work to make this happen if > > someone from python-devel is willing to guide us through the > > contributor process for these systems. Thanks. I'm one of the people with admin access to the bug tracker (I haven't done much maint lately, though, Ezio has done the most). There is information on setting up a replica of our production system here: https://wiki.python.org/moin/TrackerDevelopment If you want to start hacking on a solution, the first step would be to spin up a test setup. If you propose a patch, either I or Ezio should be able to find the time to review and apply it, if you also commit to maintaining it ;) Tracker specific discussion happens on the tracker-discuss mailing list, by the way (very low traffic). > > 2. There's a seamless migration path away from Persona if we fail: > > fall back to the pre-existing traditional email/password system > > using the same email addresses that Persona had previously been in > > charge of verifying. Roundup uses database-derived numeric IDs. An email is associated with each account, but does not participate in authentication or authorization after initial signup. (Except for the email interface...but that is a separate story and you shouldn't need to address that). > > So let's do this. The open web deserves better than just Google+, > > Facebook, or Passwords, and visible support from the Python > > community would be a huge step toward answering the chicken-and-egg > > objections raised in this thread. > > > > At your service, > > -Callahad > > > > PS: Freeform OpenID has utterly failed as a user-empowering > > authentication system, and the protocol itself is rapidly being > > supplanted by vendor-specific OAuth[1] systems. If we want to ensure > > that "you *can* (not *must*) use free and open services to access > > our resources," then we must provide an option to use something akin > > to Persona. IMO, single signon is overrated. Especially if one prefers not to make it easy for various accounts to be automatically associated with one another by various entities who shall remain nameless but have been in the news a lot lately :) --David From donald at stufft.io Fri Sep 6 21:17:12 2013 From: donald at stufft.io (Donald Stufft) Date: Fri, 6 Sep 2013 15:17:12 -0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130906191130.B6511250816@webabinitio.net> References: <5228C00F.7000209@jcea.es> <6DB0A7E3-FADD-4E35-A983-02A7C0D4CAE3@stufft.io> <20130906191130.B6511250816@webabinitio.net> Message-ID: <7087E6B8-1CD4-4002-AD3F-5578B045A3CB@stufft.io> On Sep 6, 2013, at 3:11 PM, "R. David Murray" wrote: > IMO, single signon is overrated. Especially if one prefers not to make > it easy for various accounts to be automatically associated with one > another by various entities who shall remain nameless but have been in > the news a lot lately :) If I recall Persona doesn't leak this data like OpenID does, but perhaps Dan can speak to that better than I can. ----------------- Donald Stufft PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: Message signed with OpenPGP using GPGMail URL: From rdmurray at bitdance.com Fri Sep 6 21:34:30 2013 From: rdmurray at bitdance.com (R. David Murray) Date: Fri, 06 Sep 2013 15:34:30 -0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <7087E6B8-1CD4-4002-AD3F-5578B045A3CB@stufft.io> References: <5228C00F.7000209@jcea.es> <6DB0A7E3-FADD-4E35-A983-02A7C0D4CAE3@stufft.io> <20130906191130.B6511250816@webabinitio.net> <7087E6B8-1CD4-4002-AD3F-5578B045A3CB@stufft.io> Message-ID: <20130906193430.AFA14250816@webabinitio.net> On Fri, 06 Sep 2013 15:17:12 -0400, Donald Stufft wrote: > On Sep 6, 2013, at 3:11 PM, "R. David Murray" wrote: > > > IMO, single signon is overrated. Especially if one prefers not to make > > it easy for various accounts to be automatically associated with one > > another by various entities who shall remain nameless but have been in > > the news a lot lately :) > > If I recall Persona doesn't leak this data like OpenID does, but > perhaps Dan can speak to that better than I can. Note that I said that single signon *itself* was overrated. If you use the same token to authenticate to multiple sites (and here the 'token' is the email address) then your identities on those sites are ipso facto associated with each other. *If* that email address is also never leaked (never displayed, even to other signed on users, all communication with the site encrypted), then you only have to worry if the sites exchange information about their accounts, or if the government comes knocking on their doors.... Yes, I'm paranoid. That doesn't mean they aren't listening. That said, sometimes you *want* identities to be associated, so I'm not saying Persona is a bad thing. Just that single signon is overrated. --David From donald at stufft.io Fri Sep 6 21:40:33 2013 From: donald at stufft.io (Donald Stufft) Date: Fri, 6 Sep 2013 15:40:33 -0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130906193430.AFA14250816@webabinitio.net> References: <5228C00F.7000209@jcea.es> <6DB0A7E3-FADD-4E35-A983-02A7C0D4CAE3@stufft.io> <20130906191130.B6511250816@webabinitio.net> <7087E6B8-1CD4-4002-AD3F-5578B045A3CB@stufft.io> <20130906193430.AFA14250816@webabinitio.net> Message-ID: On Sep 6, 2013, at 3:34 PM, "R. David Murray" wrote: > On Fri, 06 Sep 2013 15:17:12 -0400, Donald Stufft wrote: >> On Sep 6, 2013, at 3:11 PM, "R. David Murray" wrote: >> >>> IMO, single signon is overrated. Especially if one prefers not to make >>> it easy for various accounts to be automatically associated with one >>> another by various entities who shall remain nameless but have been in >>> the news a lot lately :) >> >> If I recall Persona doesn't leak this data like OpenID does, but >> perhaps Dan can speak to that better than I can. > > Note that I said that single signon *itself* was overrated. If you use > the same token to authenticate to multiple sites (and here the 'token' > is the email address) then your identities on those sites are ipso facto > associated with each other. *If* that email address is also never > leaked (never displayed, even to other signed on users, all communication > with the site encrypted), then you only have to worry if the > sites exchange information about their accounts, or if the government > comes knocking on their doors.... > > Yes, I'm paranoid. That doesn't mean they aren't listening. > > That said, sometimes you *want* identities to be associated, so I'm not > saying Persona is a bad thing. Just that single signon is overrated. Well that's fine to have that opinion but I think you're under estimating just how easy it is to link two disparate accounts especially if you have the cooperation (willing or otherwise) of the site operators. I've personally seen Google do some particularly amazing connections between accounts that I don't believe using the same authentication token is going to make that any easier or harder for them. ----------------- Donald Stufft PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: Message signed with OpenPGP using GPGMail URL: From catch-all at masklinn.net Fri Sep 6 21:50:38 2013 From: catch-all at masklinn.net (Xavier Morel) Date: Fri, 6 Sep 2013 21:50:38 +0200 Subject: [Python-Dev] DTRACE support In-Reply-To: <20130906190516.471028ba@fsol> References: <5229EFE7.8040702@jcea.es> <20130906174111.446ea2c4@pitrou.net> <5229FF62.9020702@jcea.es> <20130906190516.471028ba@fsol> Message-ID: <8E3B67D3-367C-440E-9268-87845E44BB15@masklinn.net> On 2013-09-06, at 19:05 , Antoine Pitrou wrote: > On Fri, 06 Sep 2013 18:14:26 +0200 > Jesus Cea wrote: >> >>> Right now, I agree with Charles-Fran?ois: your patch is too >>> intrusive. >> >> It is intrusive. Yes. I think it must be, by its own nature. Probably >> room for improvement and code transparency. But... are Python-DEVs >> interested in the project?. That is the point :) > > Well, I'm not *personally* interested in anything that only addresses > Solaris, OS X and the like :) For what it's worth, there's also a linux port and oracle's distro has dtrace support. > And, no, it doesn't have to be *that* intrusive. Take a look at Dave > Malcolm's systemtap patch, which IIRC takes a much more sensible > approach. Is there a possibility of compatibility there, using the same placeholders for a --with-dtrace and --with-systemtap build? Jesus seems to instrument more points than Dave, but the extra points could just be defined to nothing in the systemtap implementation. From jcea at jcea.es Sat Sep 7 05:40:04 2013 From: jcea at jcea.es (Jesus Cea) Date: Sat, 07 Sep 2013 05:40:04 +0200 Subject: [Python-Dev] DTRACE support In-Reply-To: <20130906203334.1a99c99d@fsol> References: <5229EFE7.8040702@jcea.es> <20130906174111.446ea2c4@pitrou.net> <5229FF62.9020702@jcea.es> <20130906203334.1a99c99d@fsol> Message-ID: <522AA014.4060801@jcea.es> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 06/09/13 20:33, Antoine Pitrou wrote: > On Fri, 06 Sep 2013 18:14:26 +0200 Jesus Cea wrote: >> >> It is intrusive. Yes. I think it must be, by its own nature. >> Probably room for improvement and code transparency. But... are >> Python-DEVs interested in the project?. That is the point :) > > As a concrete data point: - here are Dave's modifications to > ceval.c for systemtap: > http://bugs.python.org/review/14776/diff/5177/Python/ceval.c - here > are your modifications to ceval.c for dtrace: > http://bugs.python.org/review/13405/diff/6151/Python/ceval.c Unfair, because that code is not doing the same thing. Most of the extra complexity is there to deal with DTRACE ability to provide meaningful stackframes, with Python code instead of CPython evaluation loop. This is kind of magical. Look at this: "" [root at stargate-host /]# ps -lAf|grep -i correo 0 S correo 1371 1 0 40 20 ? 277063 ? Jul 29 ? 90:43 /usr/local/bin/python /export/home/ 0 S root 20397 20373 0 40 20 ? 1294 ? 05:18:16 pts/12 0:00 grep -i correo [root at stargate-host /]# dtrace -n 'python1371:::function-entry {jstack();}' 5 3164 PyEval_EvalFrameEx:function-entry libpython2.7.so.1.0`PyEval_EvalFrameEx+0x89a [ /usr/local/lib/python2.7/logging/__init__.py:1332 (isEnabledFor) ] libpython2.7.so.1.0`PyEval_EvalFrameEx+0x6231 [ /usr/local/lib/python2.7/logging/__init__.py:1202 (log) ] libpython2.7.so.1.0`PyEval_EvalCodeEx+0x7b4 libpython2.7.so.1.0`PyEval_EvalFrameEx+0x59ae [ /home/correo/durus/connection.py:483 (shrink) ] libpython2.7.so.1.0`PyEval_EvalFrameEx+0x6231 [ /home/correo/durus/connection.py:225 (shrink_cache) ] libpython2.7.so.1.0`PyEval_EvalFrameEx+0x6231 [ /home/correo/durus/connection.py:303 (commit2) ] libpython2.7.so.1.0`PyEval_EvalFrameEx+0x6231 [ /home/correo/durus/connection.py:261 (commit) ] libpython2.7.so.1.0`PyEval_EvalFrameEx+0x6231 [ /export/home/correo/lmtp.py:191 (_monitor) ] libpython2.7.so.1.0`PyEval_EvalCodeEx+0x7b4 libpython2.7.so.1.0`PyEval_EvalFrameEx+0x59ae [ /export/home/correo/lmtp.py:125 (process_vacation2) ] libpython2.7.so.1.0`PyEval_EvalCodeEx+0x7b4 libpython2.7.so.1.0`PyEval_EvalFrameEx+0x59ae [ /export/home/correo/lmtp.py:138 (process_vacation) ] libpython2.7.so.1.0`PyEval_EvalCodeEx+0x7b4 libpython2.7.so.1.0`function_call+0x192 libpython2.7.so.1.0`PyObject_Call+0x5c libpython2.7.so.1.0`PyEval_EvalFrameEx+0x2b94 [ /usr/local/lib/python2.7/threading.py: ] libpython2.7.so.1.0`PyEval_EvalFrameEx+0x6231 libpython2.7.so.1.0`PyEval_EvalFrameEx+0x6231 libpython2.7.so.1.0`PyEval_EvalCodeEx+0x7b4 libpython2.7.so.1.0`function_call+0xa4 libpython2.7.so.1.0`PyObject_Call+0x5c libpython2.7.so.1.0`instancemethod_call+0xa1 libpython2.7.so.1.0`PyObject_Call+0x5c libpython2.7.so.1.0`PyEval_CallObjectWithKeywords+0x58 libpython2.7.so.1.0`t_bootstrap+0x52 libc.so.1`_thr_setup+0x4e libc.so.1`_lwp_start ^C """ Lets say I want to know about what codepaths are hitting the OS "sync" features, so I do this: """ [root at stargate-host /]# dtrace -n 'syscall::fdsync:entry/pid==1371/{jstack();}' dtrace: description 'syscall::fdsync:entry' matched 1 probe CPU ID FUNCTION:NAME 3 58344 fdsync:entry libc.so.1`__fdsync+0x15 libdb-6.0.so`__os_fsync+0x91 libdb-6.0.so`__log_flush_int+0x685 libdb-6.0.so`__log_flush+0x6a libdb-6.0.so`__log_flush_pp+0x121 _pybsddb.so`DBEnv_log_flush+0x39 libpython2.7.so.1.0`PyEval_EvalFrameEx+0x6992 [ /export/home/correo/durus-berkeleydbstorage/berkeleydb_storage.py:918 (flush) ] libpython2.7.so.1.0`PyEval_EvalFrameEx+0x6231 [ /export/home/correo/lmtp.py:1005 (lmtp2) ] libpython2.7.so.1.0`PyEval_EvalFrameEx+0x6231 [ /export/home/correo/lmtp.py:763 (lmtp) ] libpython2.7.so.1.0`PyEval_EvalCodeEx+0x7b4 libpython2.7.so.1.0`function_call+0x192 libpython2.7.so.1.0`PyObject_Call+0x5c libpython2.7.so.1.0`PyEval_EvalFrameEx+0x2b94 [ /export/home/correo/lmtp.py:214 (_ignore_socket_errors) ] libpython2.7.so.1.0`PyEval_EvalCodeEx+0x7b4 libpython2.7.so.1.0`function_call+0x192 libpython2.7.so.1.0`PyObject_Call+0x5c libpython2.7.so.1.0`PyEval_EvalFrameEx+0x2b94 [ /usr/local/lib/python2.7/threading.py:504 (run) ] libpython2.7.so.1.0`PyEval_EvalFrameEx+0x6231 [ /usr/local/lib/python2.7/threading.py:551 (__bootstrap_inner) ] libpython2.7.so.1.0`PyEval_EvalFrameEx+0x6231 [ /usr/local/lib/python2.7/threading.py:524 (__bootstrap) ] libpython2.7.so.1.0`PyEval_EvalCodeEx+0x7b4 libpython2.7.so.1.0`function_call+0xa4 libpython2.7.so.1.0`PyObject_Call+0x5c libpython2.7.so.1.0`instancemethod_call+0xa1 libpython2.7.so.1.0`PyObject_Call+0x5c libpython2.7.so.1.0`PyEval_CallObjectWithKeywords+0x58 libpython2.7.so.1.0`t_bootstrap+0x52 libc.so.1`_thr_setup+0x4e libc.so.1`_lwp_start """ I could even aggregate stacktraces and print them by frequency, cost, whatever. Be aware that to provide this information I am not even using the probes I have integrated in Python. The program is in production and I don't need to stop it to make those measurements. They are 100% "live", not interrupting the service and without any kind of support in that Python program. I can even plug to TCP Dtrace providers in kernel and know what exact line of Python code is sending those bytes that are being delayed because the Nagle algorithm . I actually digged this five years ago. what I hunt it was! :-) PS: And it is supporting Unicode :-), another big complexity in the code. - -- Jes?s Cea Avi?n _/_/ _/_/_/ _/_/_/ jcea at jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/ Twitter: @jcea _/_/ _/_/ _/_/_/_/_/ jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/ _/_/ _/_/ "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ "El amor es poner tu felicidad en la felicidad de otro" - Leibniz -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQCUAwUBUiqgFJlgi5GaxT1NAQLezQP2PRkvn6+9Zev6GlGu14hfYTpwAMie9gcn tEieelaQniisLy22oj/MO2d2j78qlH4RoU3U/vzOTPru6uzt3OKy0UBivnBFqTcc fD/dPUCcfkigZO4nBzcqjAP4lz93wcDkx1Y8RcL3ygxeI6fSe8JKdyZKyXvyRf/9 f+3MfWJVDA== =29tQ -----END PGP SIGNATURE----- From python-dev at masklinn.net Sat Sep 7 08:57:07 2013 From: python-dev at masklinn.net (Xavier Morel) Date: Sat, 7 Sep 2013 08:57:07 +0200 Subject: [Python-Dev] DTRACE support In-Reply-To: <522AA014.4060801@jcea.es> References: <5229EFE7.8040702@jcea.es> <20130906174111.446ea2c4@pitrou.net> <5229FF62.9020702@jcea.es> <20130906203334.1a99c99d@fsol> <522AA014.4060801@jcea.es> Message-ID: <557641DC-8E6B-450C-88A0-A3E2941678C7@masklinn.net> On 2013-09-07, at 05:40 , Jesus Cea wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 06/09/13 20:33, Antoine Pitrou wrote: >> On Fri, 06 Sep 2013 18:14:26 +0200 Jesus Cea wrote: >>> >>> It is intrusive. Yes. I think it must be, by its own nature. >>> Probably room for improvement and code transparency. But... are >>> Python-DEVs interested in the project?. That is the point :) >> >> As a concrete data point: - here are Dave's modifications to >> ceval.c for systemtap: >> http://bugs.python.org/review/14776/diff/5177/Python/ceval.c - here >> are your modifications to ceval.c for dtrace: >> http://bugs.python.org/review/13405/diff/6151/Python/ceval.c > > Unfair, because that code is not doing the same thing. > > Most of the extra complexity is there to deal with DTRACE ability to > provide meaningful stackframes, with Python code instead of CPython > evaluation loop. This is kind of magical. Antoine will correct me if I'm wrong, but I believe his point is less about the complexity of dtrace provision and more about how much of it lives in ceval.c: the systemtap provision also takes quite a bit of code, but almost all of that code is extracted into a separate file and only a pair of calls live in ceval.c You patch, because it adds quite a bit of complexity to ceval.c, makes reading it significantly more difficult (especially for people who don't care for probe implementations). Dave's more or less doesn't change the complexity of that file (people who don't care for probes don't have to follow the macros to know what they do). From solipsis at pitrou.net Sat Sep 7 11:06:13 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Sat, 7 Sep 2013 11:06:13 +0200 Subject: [Python-Dev] DTRACE support References: <5229EFE7.8040702@jcea.es> <20130906174111.446ea2c4@pitrou.net> <5229FF62.9020702@jcea.es> <20130906203334.1a99c99d@fsol> <522AA014.4060801@jcea.es> <557641DC-8E6B-450C-88A0-A3E2941678C7@masklinn.net> Message-ID: <20130907110613.71a9a98d@fsol> On Sat, 7 Sep 2013 08:57:07 +0200 Xavier Morel wrote: > > On 2013-09-07, at 05:40 , Jesus Cea wrote: > > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > On 06/09/13 20:33, Antoine Pitrou wrote: > >> On Fri, 06 Sep 2013 18:14:26 +0200 Jesus Cea wrote: > >>> > >>> It is intrusive. Yes. I think it must be, by its own nature. > >>> Probably room for improvement and code transparency. But... are > >>> Python-DEVs interested in the project?. That is the point :) > >> > >> As a concrete data point: - here are Dave's modifications to > >> ceval.c for systemtap: > >> http://bugs.python.org/review/14776/diff/5177/Python/ceval.c - here > >> are your modifications to ceval.c for dtrace: > >> http://bugs.python.org/review/13405/diff/6151/Python/ceval.c > > > > Unfair, because that code is not doing the same thing. > > > > Most of the extra complexity is there to deal with DTRACE ability to > > provide meaningful stackframes, with Python code instead of CPython > > evaluation loop. This is kind of magical. > > Antoine will correct me if I'm wrong, but I believe his point is less > about the complexity of dtrace provision and more about how much of it > lives in ceval.c: the systemtap provision also takes quite a bit of > code, but almost all of that code is extracted into a separate file and > only a pair of calls live in ceval.c Yes, that's exactly my point. There can be an arbitrarily complex ceval-dtrace.h for all I care :-) Thanks for the examples, by the way. Regards Antoine. From ncoghlan at gmail.com Sat Sep 7 13:01:36 2013 From: ncoghlan at gmail.com (Nick Coghlan) Date: Sat, 7 Sep 2013 21:01:36 +1000 Subject: [Python-Dev] when to fix cross-version bugs? In-Reply-To: <522A0044.10302@stoneleaf.us> References: <5229EBDA.1030902@stoneleaf.us> <522A0044.10302@stoneleaf.us> Message-ID: On 7 Sep 2013 02:43, "Ethan Furman" wrote: > > On 09/06/2013 07:51 AM, Ethan Furman wrote: >> >> >> What guidelines determine when a bug is fixed in previous versions? > > > On 09/06/2013 08:29 AM, Brian Curtin wrote: >> >> >> If it's a bug in that version and the version is accepting bug fixes, >> i.e., not in security mode, go for it. This includes crossing the 2/3 >> boundary if applicable. > > > On 09/06/2013 08:31 AM, R. David Murray wrote: >> >> >> The basic guideline is: we try very hard not to break currently working >> code in a maintenance release. Making that decision very much depends on >> the details of each individual case. >> >> [so] it probably doesn't have much positive impact if it does get >> >> backported, so is it worth the (small) chance of breaking someone's code? > > > And they say never go to the elves for advice! ;) Fixes that risk breaking current doctests are rarely worth backporting, so in this case, I'd say only fixing it in 3.4 is the better option. Definitely the kind of borderline case worth asking about, though :) Cheers, Nick. > > > -- > ~Ethan~ > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From ncoghlan at gmail.com Sat Sep 7 16:14:01 2013 From: ncoghlan at gmail.com (Nick Coghlan) Date: Sun, 8 Sep 2013 00:14:01 +1000 Subject: [Python-Dev] DTRACE support In-Reply-To: <20130907110613.71a9a98d@fsol> References: <5229EFE7.8040702@jcea.es> <20130906174111.446ea2c4@pitrou.net> <5229FF62.9020702@jcea.es> <20130906203334.1a99c99d@fsol> <522AA014.4060801@jcea.es> <557641DC-8E6B-450C-88A0-A3E2941678C7@masklinn.net> <20130907110613.71a9a98d@fsol> Message-ID: On 7 September 2013 19:06, Antoine Pitrou wrote: > On Sat, 7 Sep 2013 08:57:07 +0200 > Xavier Morel wrote: >> >> On 2013-09-07, at 05:40 , Jesus Cea wrote: >> >> > -----BEGIN PGP SIGNED MESSAGE----- >> > Hash: SHA1 >> > >> > On 06/09/13 20:33, Antoine Pitrou wrote: >> >> On Fri, 06 Sep 2013 18:14:26 +0200 Jesus Cea wrote: >> >>> >> >>> It is intrusive. Yes. I think it must be, by its own nature. >> >>> Probably room for improvement and code transparency. But... are >> >>> Python-DEVs interested in the project?. That is the point :) >> >> >> >> As a concrete data point: - here are Dave's modifications to >> >> ceval.c for systemtap: >> >> http://bugs.python.org/review/14776/diff/5177/Python/ceval.c - here >> >> are your modifications to ceval.c for dtrace: >> >> http://bugs.python.org/review/13405/diff/6151/Python/ceval.c >> > >> > Unfair, because that code is not doing the same thing. >> > >> > Most of the extra complexity is there to deal with DTRACE ability to >> > provide meaningful stackframes, with Python code instead of CPython >> > evaluation loop. This is kind of magical. >> >> Antoine will correct me if I'm wrong, but I believe his point is less >> about the complexity of dtrace provision and more about how much of it >> lives in ceval.c: the systemtap provision also takes quite a bit of >> code, but almost all of that code is extracted into a separate file and >> only a pair of calls live in ceval.c > > Yes, that's exactly my point. There can be an arbitrarily complex > ceval-dtrace.h for all I care :-) > > Thanks for the examples, by the way. Yep, complex stuff inline should be abstracted out so it doesn't affect the code flow for those of us that don't care :) Between Jesus, the Mac OS X using core devs and the Solaris and Mac OS X buildbots it should be a maintainable addition. However, it seems worthwhile to write up a short PEP (akin to the tracemalloc PEP) to scope out the suggestion. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia From ericsnowcurrently at gmail.com Sun Sep 8 00:22:36 2013 From: ericsnowcurrently at gmail.com (Eric Snow) Date: Sat, 7 Sep 2013 16:22:36 -0600 Subject: [Python-Dev] Pre-PEP: Redesigning extension modules In-Reply-To: References: <20130902101642.04b69588@pitrou.net> Message-ID: On Mon, Sep 2, 2013 at 7:02 AM, Nick Coghlan wrote: > The hook API I currently have in mind is a two step initialisation: > > PyImport_PrepareNAME (optional) > PyImport_ExecNAME > Should we also look at an API change for the initfunc() of PyImport_Inittab entries? Currently the function takes a module name, which doesn't jive with loader.exec_module() taking a module. I noticed this while adding an exec_module() to BuiltinImporter. I suppose the same thing goes for PyImport_ImportFrozenModuleObject(). -eric -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan_ml at behnel.de Sun Sep 8 09:09:05 2013 From: stefan_ml at behnel.de (Stefan Behnel) Date: Sun, 08 Sep 2013 09:09:05 +0200 Subject: [Python-Dev] Pre-PEP: Redesigning extension modules In-Reply-To: References: <20130902101642.04b69588@pitrou.net> Message-ID: Eric Snow, 08.09.2013 00:22: > On Mon, Sep 2, 2013 at 7:02 AM, Nick Coghlan wrote: > >> The hook API I currently have in mind is a two step initialisation: >> >> PyImport_PrepareNAME (optional) >> PyImport_ExecNAME >> > > Should we also look at an API change for the initfunc() of PyImport_Inittab > entries? Currently the function takes a module name, which doesn't jive > with loader.exec_module() taking a module. I noticed this while adding an > exec_module() to BuiltinImporter. I suppose the same thing goes > for PyImport_ImportFrozenModuleObject(). Is it still the case that the inittab mechanism only works for the embedding case? It would be nice to have a declarative mechanism for registering a set of modules from a running module init function. Stefan From ethan at stoneleaf.us Sun Sep 8 09:42:20 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Sun, 08 Sep 2013 00:42:20 -0700 Subject: [Python-Dev] metaclasses, classes, instances, and proper nomenclature Message-ID: <522C2A5C.4030708@stoneleaf.us> I've run across two different ways to think about this: 1) the type of the first argument 2) where the method/attribute lives Since attributes don't take a first argument they default to 2: an instance attribute lives in the instance, a class attribute lives in the class, and a metaclass attribute lives in the metaclass. Methods, on the other hand, do take a first argument: an instance method takes itself, a class method takes the class, and a metaclass method takes the metaclass. Going by option 1 above there is only one way to get an instance method, and only one way to get a metaclass method -- calling with the instance (either directly or indirectly via the class), or calling a metaclass method that has been marked as a @classmethod. Therein lies my confusion. class Meta(type): @classmethod def meta_method(mcls): print("I'm a metaclass method!") def cls_method1(cls): print("I'm a class method! Aren't I?") class Class(metaclass=Meta): @classmethod def cls_method2(cls): print("I'm a class method for sure!") def instance_method(self): print("And I'm a regular ol' instance method") So, is Meta.cls_method1 a class method? On the one hand, it takes the class as it's first parameter, on the other hand it lives in the metaclass. And on the third hand you can't get to it from the instance Class(). If you're wondering why this is posted to PyDev, the related question is this: What is the proper role of a metaclass? Should it basically fiddle with the class creation process and then get out of the way? The case in point is, of course, Enum. Currently it has a custom __getattr__, but it lives in the metaclass, EnumMeta. Now this is handy, because it means that Color.red.blue raises an AttributeError, where if __getattr__ lived in Enum itself that would work. It also has the __members__ attribute living in EnumMeta, which means it's not accessible from Color.red. In other words, EnumMeta is not getting out the way, it is still very much involved. On the one hand, that's cool; on the other hand, I hand to think hard to figure out why Color.red.blue was not getting routed through EnumMeta's __getattr__, but was instead getting routed through object.__getattr__. -- ~Ethan~ From ncoghlan at gmail.com Sun Sep 8 12:06:17 2013 From: ncoghlan at gmail.com (Nick Coghlan) Date: Sun, 8 Sep 2013 20:06:17 +1000 Subject: [Python-Dev] metaclasses, classes, instances, and proper nomenclature In-Reply-To: <522C2A5C.4030708@stoneleaf.us> References: <522C2A5C.4030708@stoneleaf.us> Message-ID: On 8 Sep 2013 18:38, "Ethan Furman" wrote: > > I've run across two different ways to think about this: > > 1) the type of the first argument > > 2) where the method/attribute lives > > Since attributes don't take a first argument they default to 2: an instance attribute lives in the instance, a class attribute lives in the class, and a metaclass attribute lives in the metaclass. > > Methods, on the other hand, do take a first argument: an instance method takes itself, a class method takes the class, and a metaclass method takes the metaclass. No, there's no such thing as a "metaclass method". Metaclass instance methods are equivalent to hidden class methods - they don't appear in dir() and can't be accessed through instances of the class. It's only class methods on the metaclass that receive that rather than the class object (__new__ is technically a static method, but still accepts the metaclass as the first argument). > Going by option 1 above there is only one way to get an instance method, and only one way to get a metaclass method -- calling with the instance (either directly or indirectly via the class), or calling a metaclass method that has been marked as a @classmethod. > > Therein lies my confusion. > > class Meta(type): > > @classmethod > def meta_method(mcls): > print("I'm a metaclass method!") > > def cls_method1(cls): > print("I'm a class method! Aren't I?") > > class Class(metaclass=Meta): > > @classmethod > def cls_method2(cls): > print("I'm a class method for sure!") > > def instance_method(self): > print("And I'm a regular ol' instance method") > > > So, is Meta.cls_method1 a class method? On the one hand, it takes the class as it's first parameter, on the other hand it lives in the metaclass. And on the third hand you can't get to it from the instance Class(). It's a hidden class method. > If you're wondering why this is posted to PyDev, the related question is this: What is the proper role of a metaclass? Should it basically fiddle with the class creation process and then get out of the way? The case in point is, of course, Enum. Currently it has a custom __getattr__, but it lives in the metaclass, EnumMeta. Now this is handy, because it means that Color.red.blue raises an AttributeError, where if __getattr__ lived in Enum itself that would work. It also has the __members__ attribute living in EnumMeta, which means it's not accessible from Color.red. In other words, EnumMeta is not getting out the way, it is still very much involved. On the one hand, that's cool; on the other hand, I hand to think hard to figure out why Color.red.blue was not getting routed through EnumMeta's __getattr__, but was instead getting routed through object.__getattr__. This is exactly how a metaclass is intended to be used - to affect the behaviour of the class without affecting the behaviour of instances. And yes, introspection does get a little interesting when a non-trivial metaclass is in play :) Cheers, Nick. > > -- > ~Ethan~ > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From solipsis at pitrou.net Sun Sep 8 13:23:37 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Sun, 8 Sep 2013 13:23:37 +0200 Subject: [Python-Dev] cpython: Issue #18904: test_socket: add inheritance tests using fcntl and FD_CLOEXEC References: <3cXns46D3sz7LjR@mail.python.org> Message-ID: <20130908132337.69634518@fsol> On Sun, 8 Sep 2013 11:54:00 +0200 (CEST) victor.stinner wrote: > http://hg.python.org/cpython/rev/b7f6f6f59e91 > changeset: 85619:b7f6f6f59e91 > user: Victor Stinner > date: Sun Sep 08 11:53:09 2013 +0200 > summary: > Issue #18904: test_socket: add inheritance tests using fcntl and FD_CLOEXEC > [...] > > + if fcntl: > + def test_get_inheritable_cloexec(self): The right way to do this would be to skip the test if fcntl doesn't exist. Regards Antoine. From steve at pearwood.info Sun Sep 8 14:37:06 2013 From: steve at pearwood.info (Steven D'Aprano) Date: Sun, 8 Sep 2013 22:37:06 +1000 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: <52215BDF.2090109@pearwood.info> References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> Message-ID: <20130908123706.GG26319@ando> I'd like to get some attention for this please. On Sat, Aug 31, 2013 at 12:58:39PM +1000, Steven D'Aprano wrote: > Hi all, > > > I think that PEP 450 is now ready for a PEP dictator. There have been a > number of code reviews, and feedback has been taken into account. The test > suite passes. I'm not aware of any unanswered issues with the code. At > least two people other than myself think that the implementation is ready > for a dictator, and nobody has objected. > > There is still on-going work on speeding up the implementation for the > statistics.sum function, but that will not effect the interface or the > substantially change the test suite. > > http://bugs.python.org/issue18606 > http://www.python.org/dev/peps/pep-0450/ > > > > > -- > Steven > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/steve%40pearwood.info > From victor.stinner at gmail.com Sun Sep 8 15:38:01 2013 From: victor.stinner at gmail.com (Victor Stinner) Date: Sun, 8 Sep 2013 15:38:01 +0200 Subject: [Python-Dev] cpython: Issue #18904: test_socket: add inheritance tests using fcntl and FD_CLOEXEC In-Reply-To: <20130908132337.69634518@fsol> References: <3cXns46D3sz7LjR@mail.python.org> <20130908132337.69634518@fsol> Message-ID: 2013/9/8 Antoine Pitrou : > On Sun, 8 Sep 2013 11:54:00 +0200 (CEST) > victor.stinner wrote: >> http://hg.python.org/cpython/rev/b7f6f6f59e91 >> changeset: 85619:b7f6f6f59e91 >> user: Victor Stinner >> date: Sun Sep 08 11:53:09 2013 +0200 >> summary: >> Issue #18904: test_socket: add inheritance tests using fcntl and FD_CLOEXEC >> > [...] >> >> + if fcntl: >> + def test_get_inheritable_cloexec(self): > > The right way to do this would be to skip the test if fcntl doesn't > exist. Ok. First, I added two methods to get and set the FD_CLOXEC flag. Later, I inlined these methods because it makes the code more readable. I modified the tests to use @unittest.skipIf decorator: New changeset aea58e1cae75 by Victor Stinner in branch 'default': Issue #18904: test_os and test_socket use unittest.skipIf() to check if fcntl http://hg.python.org/cpython/rev/aea58e1cae75 Victor From victor.stinner at gmail.com Sun Sep 8 16:03:43 2013 From: victor.stinner at gmail.com (Victor Stinner) Date: Sun, 8 Sep 2013 16:03:43 +0200 Subject: [Python-Dev] RFC: PEP 454: Add a new tracemalloc module In-Reply-To: References: Message-ID: 2013/9/4 Victor Stinner : > http://www.python.org/dev/peps/pep-0454/ > > PEP: 454 > Title: Add a new tracemalloc module to trace Python memory allocations > Version: $Revision$ > Last-Modified: $Date$ > Author: Victor Stinner > Status: Draft > Type: Standards Track > Content-Type: text/x-rst > Created: 3-September-2013 > Python-Version: 3.4 I added a function get_tracemalloc_size() to see how much memory is used by the tracemalloc module itself. Result on the Python test suite: * 1 frame: +52% (+%68%) Python=34 MiB; _tracemalloc=18 MiB, tracemalloc.py=5 MiB * 10 frames: +155% (+170%) Python=34 MiB, _tracemalloc=53 MiB, tracemalloc.py=5 MiB * 100 frames: +1273% (+1283%) Python=30 MiB, _tracemalloc=382 MiB, tracemalloc.py=6 MiB On a small application and a computer with GB of memory, it may not matter. In a big application on an embedded device, it can be a blocker point to use tracemalloc. So I added filters (on the filename and line number) directly in the C module: ``add_filter(include: bool, filename: str, lineno: int=None)`` function: Add a filter. If *include* is ``True``, only trace memory blocks allocated in a file with a name matching *filename*. If *include* is ``False``, don't trace memory blocks allocated in a file with a name matching *filename*. The match is done using *filename* as a prefix. For example, ``'/usr/bin/'`` only matchs files the ``/usr/bin`` directories. The ``.pyc`` and ``.pyo`` suffixes are automatically replaced with ``.py`` when matching the filename. *lineno* is a line number. If *lineno* is ``None`` or lesser than ``1``, it matches any line number. ``clear_filters()`` function: Reset the filter list. ``get_filters()`` function: Get the filters as list of ``(include: bool, filename: str, lineno: int)`` tuples. If *lineno* is ``None``, a filter matchs any line number. By default, the filename of the Python tracemalloc module (``tracemalloc.py``) is excluded. Right now, the match is done using a PyUnicode_Tailmatch(). It is not convinient. I will see if it is possible to implement the joker character "*" matching any string, so the API would be closer to Snapshot.filter_filenames() (which uses fnmatch.fnmatch). Victor From rymg19 at gmail.com Sun Sep 8 15:52:32 2013 From: rymg19 at gmail.com (Ryan) Date: Sun, 08 Sep 2013 08:52:32 -0500 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: <20130908123706.GG26319@ando> References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> Message-ID: <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> ...what's a PEP dictator? Steven D'Aprano wrote: > > >I'd like to get some attention for this please. > > >On Sat, Aug 31, 2013 at 12:58:39PM +1000, Steven D'Aprano wrote: >> Hi all, >> >> >> I think that PEP 450 is now ready for a PEP dictator. There have been >a >> number of code reviews, and feedback has been taken into account. The >test >> suite passes. I'm not aware of any unanswered issues with the code. >At >> least two people other than myself think that the implementation is >ready >> for a dictator, and nobody has objected. >> >> There is still on-going work on speeding up the implementation for >the >> statistics.sum function, but that will not effect the interface or >the >> substantially change the test suite. >> >> http://bugs.python.org/issue18606 >> http://www.python.org/dev/peps/pep-0450/ >> >> >> >> >> -- >> Steven >> _______________________________________________ >> Python-Dev mailing list >> Python-Dev at python.org >> http://mail.python.org/mailman/listinfo/python-dev >> Unsubscribe: >> >http://mail.python.org/mailman/options/python-dev/steve%40pearwood.info >> >_______________________________________________ >Python-Dev mailing list >Python-Dev at python.org >https://mail.python.org/mailman/listinfo/python-dev >Unsubscribe: >https://mail.python.org/mailman/options/python-dev/rymg19%40gmail.com -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. -------------- next part -------------- An HTML attachment was scrubbed... URL: From solipsis at pitrou.net Sun Sep 8 17:20:11 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Sun, 8 Sep 2013 17:20:11 +0200 Subject: [Python-Dev] PEP 450 adding statistics module References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> Message-ID: <20130908172011.276c19af@fsol> On Sat, 31 Aug 2013 12:58:39 +1000 Steven D'Aprano wrote: > Hi all, > > > I think that PEP 450 is now ready for a PEP dictator. Perhaps Mark would like to apply? Regards Antoine. From ethan at stoneleaf.us Sun Sep 8 18:06:29 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Sun, 08 Sep 2013 09:06:29 -0700 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> Message-ID: <522CA085.6000601@stoneleaf.us> On 09/08/2013 06:52 AM, Ryan wrote: > > ...what's a PEP dictator? The person tasked with deciding on the fate of an individual PEP. -- ~Ethan~ From guido at python.org Sun Sep 8 19:32:34 2013 From: guido at python.org (Guido van Rossum) Date: Sun, 8 Sep 2013 10:32:34 -0700 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: <522CA085.6000601@stoneleaf.us> References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> <522CA085.6000601@stoneleaf.us> Message-ID: Going over the open issues: - Parallel arrays or arrays of tuples? I think the API should require an array of tuples. It is trivial to zip up parallel arrays to the required format, while if you have an array of tuples, extracting the parallel arrays is slightly more cumbersome. Also for manipulating of the raw data, an array of tuples makes it easier to do insertions or removals without worrying about losing the correspondence between the arrays. - Requiring concrete sequences as opposed to iterators sounds fine. I'm guessing that good algorithms for doing certain calculations in a single pass, assuming the full input doesn't fit in memory, are quite different from good algorithms for doing the same calculations without having that worry. (Just like you can't expect to use the same code to do a good job of sorting in-memory and on-disk data.) - Postponing some algorithms to Python 3.5 sounds fine. On Sun, Sep 8, 2013 at 9:06 AM, Ethan Furman wrote: > On 09/08/2013 06:52 AM, Ryan wrote: >> >> >> ...what's a PEP dictator? > > > The person tasked with deciding on the fate of an individual PEP. > > -- > ~Ethan~ > _______________________________________________ > > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/guido%40python.org -- --Guido van Rossum (python.org/~guido) From guido at python.org Sun Sep 8 19:25:22 2013 From: guido at python.org (Guido van Rossum) Date: Sun, 8 Sep 2013 10:25:22 -0700 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: <20130908123706.GG26319@ando> References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> Message-ID: Steven, I'd like to just approve the PEP, given the amount of discussion that's happened already (though I didn't follow much of it). I quickly glanced through the PEP and didn't find anything I'd personally object to, but then I found your section of open issues, and I realized that you don't actually specify the proposed API in the PEP itself. It's highly unusual to approve a PEP that doesn't contain a specification. What did I miss? On Sun, Sep 8, 2013 at 5:37 AM, Steven D'Aprano wrote: > > > I'd like to get some attention for this please. > > > On Sat, Aug 31, 2013 at 12:58:39PM +1000, Steven D'Aprano wrote: >> Hi all, >> >> >> I think that PEP 450 is now ready for a PEP dictator. There have been a >> number of code reviews, and feedback has been taken into account. The test >> suite passes. I'm not aware of any unanswered issues with the code. At >> least two people other than myself think that the implementation is ready >> for a dictator, and nobody has objected. >> >> There is still on-going work on speeding up the implementation for the >> statistics.sum function, but that will not effect the interface or the >> substantially change the test suite. >> >> http://bugs.python.org/issue18606 >> http://www.python.org/dev/peps/pep-0450/ >> >> >> >> >> -- >> Steven >> _______________________________________________ >> Python-Dev mailing list >> Python-Dev at python.org >> http://mail.python.org/mailman/listinfo/python-dev >> Unsubscribe: >> http://mail.python.org/mailman/options/python-dev/steve%40pearwood.info >> > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/guido%40python.org -- --Guido van Rossum (python.org/~guido) From alexander.belopolsky at gmail.com Sun Sep 8 19:45:32 2013 From: alexander.belopolsky at gmail.com (Alexander Belopolsky) Date: Sun, 8 Sep 2013 21:45:32 +0400 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> <522CA085.6000601@stoneleaf.us> Message-ID: On Sun, Sep 8, 2013 at 9:32 PM, Guido van Rossum wrote: > - Parallel arrays or arrays of tuples? I think the API should require > an array of tuples. It is trivial to zip up parallel arrays to the > required format, while if you have an array of tuples, extracting the > parallel arrays is slightly more cumbersome. > I agree with your conclusion but not with the rationale: converting between array of tuples and parallel arrays is trivial both ways: >>> at = [(1,2,3), (4,5,6), (7,8,9), (10, 11, 12)] >>> zip(*at) [(1, 4, 7, 10), (2, 5, 8, 11), (3, 6, 9, 12)] >>> zip(*_) [(1, 2, 3), (4, 5, 6), (7, 8, 9), (10, 11, 12)] (Note that zip(*x) is basically transpose(x).) -------------- next part -------------- An HTML attachment was scrubbed... URL: From guido at python.org Sun Sep 8 19:51:57 2013 From: guido at python.org (Guido van Rossum) Date: Sun, 8 Sep 2013 10:51:57 -0700 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> <522CA085.6000601@stoneleaf.us> Message-ID: Never mind, I found the patch and the issue. I really think that the *PEP* is ready for inclusion after the open issues are changed into something like Discussion or Future Work, and after adding a more prominent link to the issue with the patch. Then the *patch* can be reviewed some more until it is ready -- it looks very close already. On Sun, Sep 8, 2013 at 10:32 AM, Guido van Rossum wrote: > Going over the open issues: > > - Parallel arrays or arrays of tuples? I think the API should require > an array of tuples. It is trivial to zip up parallel arrays to the > required format, while if you have an array of tuples, extracting the > parallel arrays is slightly more cumbersome. Also for manipulating of > the raw data, an array of tuples makes it easier to do insertions or > removals without worrying about losing the correspondence between the > arrays. > > - Requiring concrete sequences as opposed to iterators sounds fine. > I'm guessing that good algorithms for doing certain calculations in a > single pass, assuming the full input doesn't fit in memory, are quite > different from good algorithms for doing the same calculations without > having that worry. (Just like you can't expect to use the same code to > do a good job of sorting in-memory and on-disk data.) > > - Postponing some algorithms to Python 3.5 sounds fine. > > On Sun, Sep 8, 2013 at 9:06 AM, Ethan Furman wrote: >> On 09/08/2013 06:52 AM, Ryan wrote: >>> >>> >>> ...what's a PEP dictator? >> >> >> The person tasked with deciding on the fate of an individual PEP. >> >> -- >> ~Ethan~ >> _______________________________________________ >> >> Python-Dev mailing list >> Python-Dev at python.org >> https://mail.python.org/mailman/listinfo/python-dev >> Unsubscribe: >> https://mail.python.org/mailman/options/python-dev/guido%40python.org > > > > -- > --Guido van Rossum (python.org/~guido) -- --Guido van Rossum (python.org/~guido) From guido at python.org Sun Sep 8 19:52:28 2013 From: guido at python.org (Guido van Rossum) Date: Sun, 8 Sep 2013 10:52:28 -0700 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> <522CA085.6000601@stoneleaf.us> Message-ID: Well, to me zip(*x) is unnatural, and it's inefficient when the arrays are long. On Sun, Sep 8, 2013 at 10:45 AM, Alexander Belopolsky wrote: > > On Sun, Sep 8, 2013 at 9:32 PM, Guido van Rossum wrote: >> >> - Parallel arrays or arrays of tuples? I think the API should require >> an array of tuples. It is trivial to zip up parallel arrays to the >> required format, while if you have an array of tuples, extracting the >> parallel arrays is slightly more cumbersome. > > > I agree with your conclusion but not with the rationale: converting between > array of tuples and parallel arrays is trivial both ways: > >>>> at = [(1,2,3), (4,5,6), (7,8,9), (10, 11, 12)] >>>> zip(*at) > [(1, 4, 7, 10), (2, 5, 8, 11), (3, 6, 9, 12)] >>>> zip(*_) > [(1, 2, 3), (4, 5, 6), (7, 8, 9), (10, 11, 12)] > > (Note that zip(*x) is basically transpose(x).) -- --Guido van Rossum (python.org/~guido) From steve at pearwood.info Sun Sep 8 21:19:54 2013 From: steve at pearwood.info (Steven D'Aprano) Date: Mon, 9 Sep 2013 05:19:54 +1000 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> Message-ID: <20130908191954.GJ26319@ando> On Sun, Sep 08, 2013 at 10:25:22AM -0700, Guido van Rossum wrote: > Steven, I'd like to just approve the PEP, given the amount of > discussion that's happened already (though I didn't follow much of > it). I quickly glanced through the PEP and didn't find anything I'd > personally object to, but then I found your section of open issues, > and I realized that you don't actually specify the proposed API in the > PEP itself. It's highly unusual to approve a PEP that doesn't contain > a specification. What did I miss? You didn't miss anything, but I may have. Should the PEP go through each public function in the module (there are only 11)? That may be a little repetitive, since most have the same, or almost the same, signatures. Or is it acceptable to just include an overview? I've come up with this: API The initial version of the library will provide univariate (single variable) statistics functions. The general API will be based on a functional model ``function(data, ...) -> result``, where ``data`` is a mandatory iterable of (usually) numeric data. The author expects that lists will be the most common data type used, but any iterable type should be acceptable. Where necessary, functions may convert to lists internally. Where possible, functions are expected to conserve the type of the data values, for example, the mean of a list of Decimals should be a Decimal rather than float. Calculating the mean, median and mode The ``mean``, ``median`` and ``mode`` functions take a single mandatory argument and return the appropriate statistic, e.g.: >>> mean([1, 2, 3]) 2.0 ``mode`` is the sole exception to the rule that the data argument must be numeric. It will also accept an iterable of nominal data, such as strings. Calculating variance and standard deviation In order to be similar to scientific calculators, the statistics module will include separate functions for population and sample variance and standard deviation. All four functions have similar signatures, with a single mandatory argument, an iterable of numeric data, e.g.: >>> variance([1, 2, 2, 2, 3]) 0.5 All four functions also accept a second, optional, argument, the mean of the data. This is modelled on a similar API provided by the GNU Scientific Library[18]. There are three use-cases for using this argument, in no particular order: 1) The value of the mean is known *a priori*. 2) You have already calculated the mean, and wish to avoid calculating it again. 3) You wish to (ab)use the variance functions to calculate the second moment about some given point other than the mean. In each case, it is the caller's responsibility to ensure that given argument is meaningful. Is this satisfactory or do I need to go into more detail? -- Steven From p.f.moore at gmail.com Sun Sep 8 22:14:39 2013 From: p.f.moore at gmail.com (Paul Moore) Date: Sun, 8 Sep 2013 21:14:39 +0100 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: <20130908191954.GJ26319@ando> References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <20130908191954.GJ26319@ando> Message-ID: On 8 September 2013 20:19, Steven D'Aprano wrote: [...] > Is this satisfactory or do I need to go into more detail? It describes only 7 functions, and yet you state there are 11. I'd suggest you add a 1-line summary of each function, something like: mean - calculate the (arithmetic) mean of the data median - calculate the median value of the data etc. Paul From oscar.j.benjamin at gmail.com Sun Sep 8 22:48:26 2013 From: oscar.j.benjamin at gmail.com (Oscar Benjamin) Date: Sun, 8 Sep 2013 21:48:26 +0100 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> <522CA085.6000601@stoneleaf.us> Message-ID: On 8 September 2013 18:32, Guido van Rossum wrote: > Going over the open issues: > > - Parallel arrays or arrays of tuples? I think the API should require > an array of tuples. It is trivial to zip up parallel arrays to the > required format, while if you have an array of tuples, extracting the > parallel arrays is slightly more cumbersome. Also for manipulating of > the raw data, an array of tuples makes it easier to do insertions or > removals without worrying about losing the correspondence between the > arrays. For something like this, where there are multiple obvious formats for the input data, I think it's reasonable to just request whatever is convenient for the implementation. Otherwise you're asking at least some of your users to convert data from one format to another just so that you can convert it back again. In any real problem you'll likely have more than two variables, so you'll be writing some code to prepare the data for the function anyway. The most obvious alternative that isn't explicitly mentioned in the PEP is to accept either: def correlation(x, y=None): if y is None: xs = [] ys = [] for x, y in x: xs.append(x) ys.append(y) else: xs = list(x) ys = list(y) assert len(xs) == len(ys) # In reality a helper function does the above. # Now compute stuff This avoids any unnecessary conversions and is as convenient as possible for all users at the expense of having a slightly more complicated API. Oscar From janzert at janzert.com Sun Sep 8 22:52:05 2013 From: janzert at janzert.com (Janzert) Date: Sun, 08 Sep 2013 16:52:05 -0400 Subject: [Python-Dev] RFC: PEP 454: Add a new tracemalloc module In-Reply-To: References: Message-ID: It seems like most of this could live on PyPi for a while so the API can get hashed out in use? If that's not the case is it because the PEP 445 API isn't rich enough? Janzert From guido at python.org Sun Sep 8 23:41:35 2013 From: guido at python.org (Guido van Rossum) Date: Sun, 8 Sep 2013 14:41:35 -0700 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> <522CA085.6000601@stoneleaf.us> Message-ID: On Sun, Sep 8, 2013 at 1:48 PM, Oscar Benjamin wrote: > On 8 September 2013 18:32, Guido van Rossum wrote: >> Going over the open issues: >> >> - Parallel arrays or arrays of tuples? I think the API should require >> an array of tuples. It is trivial to zip up parallel arrays to the >> required format, while if you have an array of tuples, extracting the >> parallel arrays is slightly more cumbersome. Also for manipulating of >> the raw data, an array of tuples makes it easier to do insertions or >> removals without worrying about losing the correspondence between the >> arrays. > > For something like this, where there are multiple obvious formats for > the input data, I think it's reasonable to just request whatever is > convenient for the implementation. Not really. The implementation may change, or its needs may not be obvious to the caller. I would say the right thing to do is request something easy to remember, which often means consistent. In general, Python APIs definitely skew towards lists of tuples rather than parallel arrays, and for good reasons -- that way you benefit most from built-in operations like slices and insert/append. > Otherwise you're asking at least > some of your users to convert data from one format to another just so > that you can convert it back again. In any real problem you'll likely > have more than two variables, so you'll be writing some code to > prepare the data for the function anyway. Yeah, so you might as well prepare it in the form that the API expects. > The most obvious alternative that isn't explicitly mentioned in the > PEP is to accept either: > > def correlation(x, y=None): > if y is None: > xs = [] > ys = [] > for x, y in x: > xs.append(x) > ys.append(y) > else: > xs = list(x) > ys = list(y) > assert len(xs) == len(ys) > # In reality a helper function does the above. > # Now compute stuff > > This avoids any unnecessary conversions and is as convenient as > possible for all users at the expense of having a slightly more > complicated API. I don't think this is really more convenient -- it is more to learn, and can cause surprises (e.g. when a user is only familiar with one format and then sees an example using the other format, they may be unable to understand the example). The one argument I *haven't* heard yet which *might* sway me would be something along the line "every other statistics package that users might be familiar with does it this way" or "all the statistics textbooks do it this way". (Because, frankly, when it comes to statistics I'm a rank amateur and I really want Steven's new module to educate me as much as help me compute specific statistical functions.) -- --Guido van Rossum (python.org/~guido) From victor.stinner at gmail.com Mon Sep 9 01:05:11 2013 From: victor.stinner at gmail.com (Victor Stinner) Date: Mon, 9 Sep 2013 01:05:11 +0200 Subject: [Python-Dev] RFC: PEP 454: Add a new tracemalloc module In-Reply-To: References: Message-ID: 2013/9/8 Janzert : > It seems like most of this could live on PyPi for a while so the API can get > hashed out in use? The pytracemalloc is available on PyPI since 6 months. The only feedback I had was something trying to compile it on Windows (which is complex because of the dependency to glib, I don't think that it succeed to install it on Windows). I guess that I didn't get more feedback because it requires to patch and recompile Python, which is not trivial. I expect more feedback on python-dev with a working implementation (on hg.python.org) and a PEP. The version available on PyPI works and should be enough for most use cases to be able to identify a memory leak. Gregory P. Smith asked me if it would be possible to get more frames (filename and line number) of the Python traceback, instead of just the one frame (the last frame). I implemented it, but now I have new issues (memory usage of the tracemalloc module itself), so I'm working on filters directly implemented in the C module (_tracemalloc). It was already possible to filter traces from a snapshot read from the disk. I still have some tasks in my TODO list to finish the API and the implementation. When I will be done, I will post post a new version of the PEP on python-dev. > If that's not the case is it because the PEP 445 API > isn't rich enough? The PEP 445 API is only designed to allow to develop new tools like failmalloc or tracemalloc, without adding overhead if such debug tool is not used. The tracemalloc module reads the current Python traceback (filename and line number) which is "not directly" accessible from PyMem_Malloc(). I hope that existing tools like Heapy and Melia will benefit directly from tracemalloc instead of having to develop their own memory allocator hooks to get the same information (Python traceback). Victor From steve at pearwood.info Mon Sep 9 03:59:48 2013 From: steve at pearwood.info (Steven D'Aprano) Date: Mon, 9 Sep 2013 11:59:48 +1000 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> <522CA085.6000601@stoneleaf.us> Message-ID: <20130909015948.GK26319@ando> On Sun, Sep 08, 2013 at 02:41:35PM -0700, Guido van Rossum wrote: > On Sun, Sep 8, 2013 at 1:48 PM, Oscar Benjamin > wrote: > > The most obvious alternative that isn't explicitly mentioned in the > > PEP is to accept either: > > > > def correlation(x, y=None): > > if y is None: > > xs = [] > > ys = [] > > for x, y in x: > > xs.append(x) > > ys.append(y) > > else: > > xs = list(x) > > ys = list(y) > > assert len(xs) == len(ys) > > # In reality a helper function does the above. > > # Now compute stuff > > > > This avoids any unnecessary conversions and is as convenient as > > possible for all users at the expense of having a slightly more > > complicated API. The PEP does mention that, as "some combination of the above". The PEP also mentions that the decision of what API to use for multivariate stats is deferred until 3.5, so there's plenty of time for people to bike-shed this :-) > I don't think this is really more convenient -- it is more to learn, > and can cause surprises (e.g. when a user is only familiar with one > format and then sees an example using the other format, they may be > unable to understand the example). > > The one argument I *haven't* heard yet which *might* sway me would be > something along the line "every other statistics package that users > might be familiar with does it this way" or "all the statistics > textbooks do it this way". (Because, frankly, when it comes to > statistics I'm a rank amateur and I really want Steven's new module to > educate me as much as help me compute specific statistical functions.) I don't think that there is one common API for multivariate stats packages. It partially depends on whether the package is aimed at basic use or advanced use. I haven't done a systematic comparison of the most common, but here are a few examples: - The Casio Classpad graphing calculator has a spreadsheet-like interface, which I consider equivalent to func(xdata, ydata). - The HP-48G series of calculators uses a fixed global variable holding a matrix, and a second global variable specifying which columns to use. - The R "cor" (correlation coefficient) function takes either a pair of vectors (lists), and calculates a single value, or a matrix, in which case it calculates the correlation matrix. - numpy.corrcoeff takes one or two array arguments, and a third argument specifying whether to treat rows or columns as variables, and like R returns either a single value or the correlation matrix. - Minitab expects two seperate vector arguments, and returns the correlation coefficient between them. - If I'm reading the below page correctly, the SAS corr procedure takes anything up to 27 arguments. http://support.sas.com/documentation/cdl/en/procstat/63104/HTML/default/procstat_corr_sect004.htm I don't suggest we follow that API :-) Quite frankly, I consider the majority of stats APIs to be confusing with a steep learning curve. -- Steven From stephen at xemacs.org Mon Sep 9 04:57:50 2013 From: stephen at xemacs.org (Stephen J. Turnbull) Date: Mon, 09 Sep 2013 11:57:50 +0900 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> <522CA085.6000601@stoneleaf.us> Message-ID: <87ppsi8zwx.fsf@uwakimon.sk.tsukuba.ac.jp> Guido van Rossum writes: > On Sun, Sep 8, 2013 at 1:48 PM, Oscar Benjamin > wrote: > > On 8 September 2013 18:32, Guido van Rossum wrote: > >> Going over the open issues: > >> > >> - Parallel arrays or arrays of tuples? I think the API should require > >> an array of tuples. It is trivial to zip up parallel arrays to the > >> required format, while if you have an array of tuples, extracting the > >> parallel arrays is slightly more cumbersome. > >> > >> Also for manipulating of the raw data, an array of tuples makes > >> it easier to do insertions or removals without worrying about > >> losing the correspondence between the arrays. I don't necessarily find this persuasive. It's more common when working with existing databases that you add variables than add observations. This is going to require attention to the correspondence in any case. Observations aren't added, and they're "removed" temporarily for statistics on subsets by slicing. If you use the same slice for all variables, you're not going to make a mistake. > Not really. The implementation may change, or its needs may not be > obvious to the caller. I would say the right thing to do is request > something easy to remember, which often means consistent. In general, > Python APIs definitely skew towards lists of tuples rather than > parallel arrays, and for good reasons -- that way you benefit most > from built-in operations like slices and insert/append. However, it's common in economic statistics to have a rectangular array, and extract both certain rows (tuples of observations on variables) and certain columns (variables). For example you might have data on populations of American states from 1900 to 2012, and extract the data on New England states from 1946 to 2012 for analysis. > The one argument I *haven't* heard yet which *might* sway me would be > something along the line "every other statistics package that users > might be familiar with does it this way" or "all the statistics > textbooks do it this way". (Because, frankly, when it comes to > statistics I'm a rank amateur and I really want Steven's new module to > educate me as much as help me compute specific statistical functions.) In economic statistics, most software traditionally inputs variables in column-major order (ie, parallel arrays). That said, most software nowadays allows input as spreadsheet tables. You pays your money and you takes your choice. I think the example above of state population data shows that rows and columns are pretty symmetric here. Many databases will have "too many" of both, and you'll want to "slice" both to get the sample and variables relevant to your analysis. This is all just for consideration; I am quite familiar with economic statistics and software, but not so much for that used in sociology, psychology, and medical applications. In the end, I think it's best to leave it up to Steven's judgment as to what is convenient for him to maintain. From greg.ewing at canterbury.ac.nz Mon Sep 9 02:26:05 2013 From: greg.ewing at canterbury.ac.nz (Greg) Date: Mon, 09 Sep 2013 12:26:05 +1200 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> <522CA085.6000601@stoneleaf.us> Message-ID: <522D159D.90200@canterbury.ac.nz> On 9/09/2013 5:52 a.m., Guido van Rossum wrote: > Well, to me zip(*x) is unnatural, and it's inefficient when the arrays are long. Would it be worth having a transpose() function in the stdlib somewhere, that returns a view instead of copying the data? -- Greg From guido at python.org Mon Sep 9 05:16:19 2013 From: guido at python.org (Guido van Rossum) Date: Sun, 8 Sep 2013 20:16:19 -0700 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: <87ppsi8zwx.fsf@uwakimon.sk.tsukuba.ac.jp> References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> <522CA085.6000601@stoneleaf.us> <87ppsi8zwx.fsf@uwakimon.sk.tsukuba.ac.jp> Message-ID: Yeah, so this and Steven's review of various other APIs suggests that the field of statistics hasn't really reached the object-oriented age (or perhaps the OO view isn't suitable for the field), and people really think of their data as a matrix of some sort. We should respect that. Now, if this was NumPy, it would *still* make sense to require a single argument, to be interpreted in the usual fashion. So I'm using that as a kind of leverage to still recommend taking a list of pairs instead of a pair of lists. Also, it's quite likely that at least *some* of the users of the new statistics module will be more familiar with OO programming (e.g. the Python DB API , PEP 249) than they are with other statistics packages. On Sun, Sep 8, 2013 at 7:57 PM, Stephen J. Turnbull wrote: > Guido van Rossum writes: > > On Sun, Sep 8, 2013 at 1:48 PM, Oscar Benjamin > > wrote: > > > On 8 September 2013 18:32, Guido van Rossum wrote: > > >> Going over the open issues: > > >> > > >> - Parallel arrays or arrays of tuples? I think the API should require > > >> an array of tuples. It is trivial to zip up parallel arrays to the > > >> required format, while if you have an array of tuples, extracting the > > >> parallel arrays is slightly more cumbersome. > > >> > > >> Also for manipulating of the raw data, an array of tuples makes > > >> it easier to do insertions or removals without worrying about > > >> losing the correspondence between the arrays. > > I don't necessarily find this persuasive. It's more common when > working with existing databases that you add variables than add > observations. This is going to require attention to the > correspondence in any case. Observations aren't added, and they're > "removed" temporarily for statistics on subsets by slicing. If you > use the same slice for all variables, you're not going to make a > mistake. > > > Not really. The implementation may change, or its needs may not be > > obvious to the caller. I would say the right thing to do is request > > something easy to remember, which often means consistent. In general, > > Python APIs definitely skew towards lists of tuples rather than > > parallel arrays, and for good reasons -- that way you benefit most > > from built-in operations like slices and insert/append. > > However, it's common in economic statistics to have a rectangular > array, and extract both certain rows (tuples of observations on > variables) and certain columns (variables). For example you might > have data on populations of American states from 1900 to 2012, and > extract the data on New England states from 1946 to 2012 for analysis. > > > The one argument I *haven't* heard yet which *might* sway me would be > > something along the line "every other statistics package that users > > might be familiar with does it this way" or "all the statistics > > textbooks do it this way". (Because, frankly, when it comes to > > statistics I'm a rank amateur and I really want Steven's new module to > > educate me as much as help me compute specific statistical functions.) > > In economic statistics, most software traditionally inputs variables > in column-major order (ie, parallel arrays). That said, most software > nowadays allows input as spreadsheet tables. You pays your money and > you takes your choice. > > I think the example above of state population data shows that rows and > columns are pretty symmetric here. Many databases will have "too many" > of both, and you'll want to "slice" both to get the sample and > variables relevant to your analysis. > > This is all just for consideration; I am quite familiar with economic > statistics and software, but not so much for that used in sociology, > psychology, and medical applications. In the end, I think it's best > to leave it up to Steven's judgment as to what is convenient for him > to maintain. > -- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: From guido at python.org Mon Sep 9 05:18:46 2013 From: guido at python.org (Guido van Rossum) Date: Sun, 8 Sep 2013 20:18:46 -0700 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: <522D159D.90200@canterbury.ac.nz> References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> <522CA085.6000601@stoneleaf.us> <522D159D.90200@canterbury.ac.nz> Message-ID: On Sun, Sep 8, 2013 at 5:26 PM, Greg wrote: > On 9/09/2013 5:52 a.m., Guido van Rossum wrote: > >> Well, to me zip(*x) is unnatural, and it's inefficient when the arrays >> are long. >> > > Would it be worth having a transpose() function in the stdlib > somewhere, that returns a view instead of copying the data? I'd be hesitant to add just that one function, given that there's hardly any support for multi-dimensional arrays in the stdlib. (NumPy of course has a transpose(), and that's where it arguably belongs.) -- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: From steve at pearwood.info Mon Sep 9 05:27:22 2013 From: steve at pearwood.info (Steven D'Aprano) Date: Mon, 9 Sep 2013 13:27:22 +1000 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <20130908191954.GJ26319@ando> Message-ID: <20130909032722.GL26319@ando> On Sun, Sep 08, 2013 at 09:14:39PM +0100, Paul Moore wrote: > On 8 September 2013 20:19, Steven D'Aprano wrote: > [...] > > Is this satisfactory or do I need to go into more detail? > > It describes only 7 functions, and yet you state there are 11. I'd > suggest you add a 1-line summary of each function, something like: > > mean - calculate the (arithmetic) mean of the data > median - calculate the median value of the data > etc. Thanks Paul, will do. I think PEP 1 needs to be a bit clearer about this part of the process. For instance, if I had a module with 100 functions and methods, would I need to document all of them in the PEP? I expect not, but then I didn't expect I needed to document all 11 either :-) -- Steven From steve at pearwood.info Mon Sep 9 05:43:59 2013 From: steve at pearwood.info (Steven D'Aprano) Date: Mon, 9 Sep 2013 13:43:59 +1000 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: <522D159D.90200@canterbury.ac.nz> References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> <522CA085.6000601@stoneleaf.us> <522D159D.90200@canterbury.ac.nz> Message-ID: <20130909034359.GM26319@ando> On Mon, Sep 09, 2013 at 12:26:05PM +1200, Greg wrote: > On 9/09/2013 5:52 a.m., Guido van Rossum wrote: > >Well, to me zip(*x) is unnatural, and it's inefficient when the arrays are > >long. > > Would it be worth having a transpose() function in the stdlib > somewhere, that returns a view instead of copying the data? I've intentionally left out multivariate statistics from the initial version of statistics.py so there will be plenty of time to get feedback from users before deciding on an API before 3.5. If there was a transpose function in the std lib, the obvious place would be the statistics module itself. There is precedent: R includes a transpose function, and presumably the creators of R expect it to be used frequently because they've given it a single-letter name. http://stat.ethz.ch/R-manual/R-devel/library/base/html/t.html -- Steven From tjreedy at udel.edu Mon Sep 9 09:06:24 2013 From: tjreedy at udel.edu (Terry Reedy) Date: Mon, 09 Sep 2013 03:06:24 -0400 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> <522CA085.6000601@stoneleaf.us> Message-ID: On 9/8/2013 5:41 PM, Guido van Rossum wrote: > On Sun, Sep 8, 2013 at 1:48 PM, Oscar Benjamin > wrote: >> On 8 September 2013 18:32, Guido van Rossum wrote: >>> Going over the open issues: >>> >>> - Parallel arrays or arrays of tuples? I think the API should require >>> an array of tuples. It is trivial to zip up parallel arrays to the >>> required format, while if you have an array of tuples, extracting the >>> parallel arrays is slightly more cumbersome. Also for manipulating of >>> the raw data, an array of tuples makes it easier to do insertions or >>> removals without worrying about losing the correspondence between the >>> arrays. >> >> For something like this, where there are multiple obvious formats for >> the input data, I think it's reasonable to just request whatever is >> convenient for the implementation. > > Not really. The implementation may change, or its needs may not be > obvious to the caller. I would say the right thing to do is request > something easy to remember, which often means consistent. In general, > Python APIs definitely skew towards lists of tuples rather than > parallel arrays, and for good reasons -- that way you benefit most > from built-in operations like slices and insert/append. This question has been discussed in the statistical software community for decades, going back to when storage was on magnetic tape, where contiguity was even more important than cache locality. In my experience with multiple packages, the most common format for input is tables where rows represent cases, samples, or whatever, which translates as lists of records (or tuples), just as with relational databases. Columns then represent a 'variable'. So I think we should go with that. Some packages might transpose the data internally, but that is an internal matter. The tradeoff is that storing by cases makes adding a new case easier, while storing by variables makes adding a new variable easier. -- Terry Jan Reedy From tjreedy at udel.edu Mon Sep 9 09:30:15 2013 From: tjreedy at udel.edu (Terry Reedy) Date: Mon, 09 Sep 2013 03:30:15 -0400 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: <87ppsi8zwx.fsf@uwakimon.sk.tsukuba.ac.jp> References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> <522CA085.6000601@stoneleaf.us> <87ppsi8zwx.fsf@uwakimon.sk.tsukuba.ac.jp> Message-ID: On 9/8/2013 10:57 PM, Stephen J. Turnbull wrote: > I don't necessarily find this persuasive. It's more common when > working with existing databases that you add variables than add > observations. My experience with general scientific research is the opposite. One decides on the variables to measure and then adds rows (records) of data as you measure each experimental or observational subject. New calculated variables may be added (and often are) after the data collection is complete (at least for the moment). Time series analysis is a distinct and specialized subfield of statistics. The corresponding data collections is often different: one may start with a fixed set of subjects (50 US states for instance) and add 'variables' (population in year X) indefinitely. Much economic statistics is in this category. A third category is interaction analysis, where the data form a true matrix where both rows and columns represent subjects and entries represent interaction (how many times John emailed Joe, for instance). -- Terry Jan Reedy From paul at colomiets.name Mon Sep 9 09:51:31 2013 From: paul at colomiets.name (Paul Colomiets) Date: Mon, 9 Sep 2013 10:51:31 +0300 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> <522CA085.6000601@stoneleaf.us> Message-ID: Hi Guido, On Sun, Sep 8, 2013 at 8:32 PM, Guido van Rossum wrote: > Going over the open issues: > > - Parallel arrays or arrays of tuples? I think the API should require > an array of tuples. It is trivial to zip up parallel arrays to the > required format, while if you have an array of tuples, extracting the > parallel arrays is slightly more cumbersome. Also for manipulating of > the raw data, an array of tuples makes it easier to do insertions or > removals without worrying about losing the correspondence between the > arrays. I think there is a big reason to use parallel arrays that might be overlooked. You can feed an array.array('f') to the function, which may save a lot of memory. -- Paul From storchaka at gmail.com Mon Sep 9 10:02:05 2013 From: storchaka at gmail.com (Serhiy Storchaka) Date: Mon, 09 Sep 2013 11:02:05 +0300 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> <522CA085.6000601@stoneleaf.us> Message-ID: 08.09.13 20:52, Guido van Rossum ???????(??): > Well, to me zip(*x) is unnatural, and it's inefficient when the arrays are long. Perhaps we need zip.from_iterable()? From oscar.j.benjamin at gmail.com Mon Sep 9 10:36:23 2013 From: oscar.j.benjamin at gmail.com (Oscar Benjamin) Date: Mon, 9 Sep 2013 09:36:23 +0100 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> <522CA085.6000601@stoneleaf.us> Message-ID: On 9 September 2013 09:02, Serhiy Storchaka wrote: > 08.09.13 20:52, Guido van Rossum ???????(??): > >> Well, to me zip(*x) is unnatural, and it's inefficient when the arrays are >> long. > > Perhaps we need zip.from_iterable()? I would prefer it if chain.from_iterable were named something like flatten (as it is in the itertools recipes). Similarly transpose is a better name than zip.from_iterable. Oscar From oscar.j.benjamin at gmail.com Mon Sep 9 11:00:24 2013 From: oscar.j.benjamin at gmail.com (Oscar Benjamin) Date: Mon, 9 Sep 2013 10:00:24 +0100 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> <522CA085.6000601@stoneleaf.us> <87ppsi8zwx.fsf@uwakimon.sk.tsukuba.ac.jp> Message-ID: On 9 September 2013 04:16, Guido van Rossum wrote: > > Yeah, so this and Steven's review of various other APIs suggests that the > field of statistics hasn't really reached the object-oriented age (or > perhaps the OO view isn't suitable for the field), and people really think > of their data as a matrix of some sort. We should respect that. Now, if this > was NumPy, it would *still* make sense to require a single argument, to be > interpreted in the usual fashion. So I'm using that as a kind of leverage to > still recommend taking a list of pairs instead of a pair of lists. Also, > it's quite likely that at least *some* of the users of the new statistics > module will be more familiar with OO programming (e.g. the Python DB API , > PEP 249) than they are with other statistics packages. I'm not sure if I understand what you mean by this. Numpy has built everything on top of a core ndarray class whose methods make the issues about multivariate stats APIs trivial. The transpose of an array A is simply the attribute A.T which is both convenient and cheap since it's just an alternate view on the underlying buffer. Also numpy provides record arrays that enable you to use names instead of numeric indices: >>> import numpy as np >>> dt = np.dtype([('Year', int), ('Arizona', float), ('Dakota', float)]) >>> a = np.array([(2001, 123., 456.), (2002, 234., 345), (2003, 345., 567)], dt) >>> a array([(2001, 123.0, 456.0), (2002, 234.0, 345.0), (2003, 345.0, 567.0)], dtype=[('Year', '>> a['Year'] array([2001, 2002, 2003]) >>> a['Arizona'] array([ 123., 234., 345.]) >>> np.corrcoef(a['Arizona'], a['Dakota']) array([[ 1. , 0.5], [ 0.5, 1. ]]) >>> included = a[a['Year'] > 2001] >>> included array([(2002, 234.0, 345.0), (2003, 345.0, 567.0)], dtype=[('Year', '>> np.corrcoef(included['Arizona'], included['Dakota']) array([[ 1., 1.], [ 1., 1.]]) So perhaps the statistics module could have a similar NameTupleArray type that can be easily loaded and saved from a csv file and makes it easy to put your data in whatever form is required. Oscar From stuart at stuartbishop.net Mon Sep 9 12:38:50 2013 From: stuart at stuartbishop.net (Stuart Bishop) Date: Mon, 9 Sep 2013 17:38:50 +0700 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <52293667.8030609@jcea.es> References: <5228C00F.7000209@jcea.es> <52293667.8030609@jcea.es> Message-ID: On Fri, Sep 6, 2013 at 8:56 AM, Jesus Cea wrote: > Sorry, Google, Facebook, Twitter, etc., are not acceptable OpenID > providers for me. I should have made that point in my original email. > My excuses. > > Any other suggestion? As Barry mentioned earlier, launchpad.net. Look for the 'lp' icon on pypi, bugs.python.org etc. -- Stuart Bishop http://www.stuartbishop.net/ From skip at pobox.com Mon Sep 9 12:44:43 2013 From: skip at pobox.com (Skip Montanaro) Date: Mon, 9 Sep 2013 05:44:43 -0500 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: <87ppsi8zwx.fsf@uwakimon.sk.tsukuba.ac.jp> References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> <522CA085.6000601@stoneleaf.us> <87ppsi8zwx.fsf@uwakimon.sk.tsukuba.ac.jp> Message-ID: > However, it's common in economic statistics to have a rectangular > array, and extract both certain rows (tuples of observations on > variables) and certain columns (variables). For example you might > have data on populations of American states from 1900 to 2012, and > extract the data on New England states from 1946 to 2012 for analysis. When Steven first brought up this PEP on comp.lang.python, my main concern was basically, "we have SciPy, why do we need this?" Steven's response, which I have come to accept, is that there are uses for basic statistics for which SciPy's stats module would be overkill. However, once you start slicing your data structure along more than one axis, I think you very quickly will find that you need numpy arrays for performance reasons, at which point you might as go "all the way" and install SciPy. I don't think slicing along multiple dimensions should be a significant concern for this package. Alternatively, I thought there was discussion a long time ago about getting numpy's (or even further back, numeric's?) array type into the core. Python has an array type which I don't think gets a lot of use (or love). Might it be worthwhile to make sure the PEP 450 package works with that? Then extend it to multiple dimensions? Or just bite the bullet and get numpy's array type into the Python core once and for all? Sort of Tulip for arrays... Skip From martin at v.loewis.de Mon Sep 9 13:43:08 2013 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Mon, 09 Sep 2013 13:43:08 +0200 Subject: [Python-Dev] unicodedata module is out of date In-Reply-To: References: <5229F6DB.40000@mrabarnett.plus.com> Message-ID: <522DB44C.8050802@v.loewis.de> Am 06.09.13 17:55, schrieb Andrew Miller: > Are there plans to add the extra data from the other UCD files to this > module? At the moment I am using a module from > https://gist.github.com/anonymous/2204527 to obtain the script of a > character but it would be nice if this was available from the standard > library. Well, it is available, and new versions of the UCD are added to new Python releases. Please consider Python 2 as dead wrt. Unicode support. Regards, Martin From martin at v.loewis.de Mon Sep 9 13:41:21 2013 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Mon, 09 Sep 2013 13:41:21 +0200 Subject: [Python-Dev] unicodedata module is out of date In-Reply-To: References: <5229F6DB.40000@mrabarnett.plus.com> Message-ID: <522DB3E1.30105@v.loewis.de> Am 06.09.13 20:24, schrieb Terry Reedy: >> In Python 2.7.5 it is set to '5.2.0' so it looks as though this version >> is no longer being updated. > > In general, new features do not go into bugfix releases (x.y.z, where z >>= 1). Updating the unidate_version add new features to the unicodedata > module. > One might argue that an update of the UCD data is within the scope of 2.7, since it's just data, not code that is being changed. I'd argue against that, since this specific change has a chance of breaking existing tests that people might have. Of course, it is up the the release manager of 2.7 to decide on that if such a change would be proposed. Regards, Martin From martin at v.loewis.de Mon Sep 9 13:38:09 2013 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Mon, 09 Sep 2013 13:38:09 +0200 Subject: [Python-Dev] DTRACE support In-Reply-To: References: <5229EFE7.8040702@jcea.es> Message-ID: <522DB321.1080905@v.loewis.de> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 06.09.13 17:14, schrieb Guido van Rossum: > I've heard good things about DTRACE but never used it myself. > > Do I understand correctly that you have to build a separate Python > executable with it turned on? My understanding is that you would normally have dtrace support built on systems that support it. The claim of the dtrace authors is that there is virtually no overhead in having trace points integrated that are not active; it achieves that by patching trace instructions over the NOPs that have been put there during compile time. Regards, Martin -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.18 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlItsyEACgkQavBT8H2dyNLhNgCfXfgXakq9wgvNGADrYNMvvAJu 05YAn0SxHrOCgoW8k9wjW+ajj+0jtpg9 =E/GT -----END PGP SIGNATURE----- From larry at hastings.org Mon Sep 9 14:02:27 2013 From: larry at hastings.org (Larry Hastings) Date: Mon, 09 Sep 2013 21:02:27 +0900 Subject: [Python-Dev] [RELEASED] Python 3.4.0a2 Message-ID: <522DB8D3.1030803@hastings.org> On behalf of the Python development team, I'm chuffed to announce the second alpha release of Python 3.4. This is a preview release, and its use is not recommended for production settings. Python 3.4 includes a range of improvements of the 3.x series, including hundreds of small improvements and bug fixes. Major new features and changes in the 3.4 release series so far include: * PEP 435, a standardized "enum" module * PEP 442, improved semantics for object finalization * PEP 443, adding single-dispatch generic functions to the standard library * PEP 445, a new C API for implementing custom memory allocators * PEP 446, changing file descriptors to not be inherited by default in subprocesses * PEP 447, a new magic method for metaclasses (``__typelookup__``) * PEP 448, making automatic sequence unpacking more general To download Python 3.4.0a2 visit: http://www.python.org/download/releases/3.4.0/ Please consider trying Python 3.4.0a2 with your code and reporting any issues you notice to: http://bugs.python.org/ Enjoy! -- Larry Hastings, Release Manager larry at hastings.org (on behalf of the entire python-dev team and 3.4's contributors) From steve at pearwood.info Mon Sep 9 14:07:58 2013 From: steve at pearwood.info (Steven D'Aprano) Date: Mon, 9 Sep 2013 22:07:58 +1000 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> <522CA085.6000601@stoneleaf.us> <87ppsi8zwx.fsf@uwakimon.sk.tsukuba.ac.jp> Message-ID: <20130909120758.GO26319@ando> On Mon, Sep 09, 2013 at 05:44:43AM -0500, Skip Montanaro wrote: > > However, it's common in economic statistics to have a rectangular > > array, and extract both certain rows (tuples of observations on > > variables) and certain columns (variables). For example you might > > have data on populations of American states from 1900 to 2012, and > > extract the data on New England states from 1946 to 2012 for analysis. > > When Steven first brought up this PEP on comp.lang.python, my main concern > was basically, "we have SciPy, why do we need this?" Steven's response, which > I have come to accept, is that there are uses for basic statistics for > which SciPy's > stats module would be overkill. > > However, once you start slicing your data structure along more than one axis, I > think you very quickly will find that you need numpy arrays for performance > reasons, at which point you might as go "all the way" and install SciPy. I don't > think slicing along multiple dimensions should be a significant concern for this > package. I agree. I'm not interested in trying to compete with numpy in areas where numpy is best. That's a fight any pure-Python module is going to lose :-) > Alternatively, I thought there was discussion a long time ago about > getting numpy's > (or even further back, numeric's?) array type into the core. Python > has an array type > which I don't think gets a lot of use (or love). Might it be > worthwhile to make sure the > PEP 450 package works with that? Then extend it to multiple dimensions? Or just > bite the bullet and get numpy's array type into the Python core once > and for all? I haven't tested PEP 450 statistics with numpy array, but any sequence type ought to work. While I haven't done extensive testing on the array.array type, basic testing shows that it works as expected: py> import array py> import statistics py> data = array.array('f', range(1, 101)) py> statistics.mean(data) 50.5 py> statistics.variance(data) 841.6666666666666 -- Steven From brett at python.org Mon Sep 9 14:16:06 2013 From: brett at python.org (Brett Cannon) Date: Mon, 9 Sep 2013 08:16:06 -0400 Subject: [Python-Dev] [python-committers] [RELEASED] Python 3.4.0a2 In-Reply-To: <522DB8D3.1030803@hastings.org> References: <522DB8D3.1030803@hastings.org> Message-ID: On Mon, Sep 9, 2013 at 8:02 AM, Larry Hastings wrote: > > On behalf of the Python development team, I'm chuffed to announce the > second alpha release of Python 3.4. > > This is a preview release, and its use is not recommended for > production settings. > > Python 3.4 includes a range of improvements of the 3.x series, including > hundreds of small improvements and bug fixes. Major new features and > changes in the 3.4 release series so far include: > > * PEP 435, a standardized "enum" module > * PEP 442, improved semantics for object finalization > * PEP 443, adding single-dispatch generic functions to the standard library > * PEP 445, a new C API for implementing custom memory allocators > * PEP 446, changing file descriptors to not be inherited by default > in subprocesses > * PEP 447, a new magic method for metaclasses (``__typelookup__``) > * PEP 448, making automatic sequence unpacking more general > Those last two PEPs are still in draft form and not accepted nor have any committed code yet. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ncoghlan at gmail.com Mon Sep 9 13:56:05 2013 From: ncoghlan at gmail.com (Nick Coghlan) Date: Mon, 9 Sep 2013 21:56:05 +1000 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> <522CA085.6000601@stoneleaf.us> <87ppsi8zwx.fsf@uwakimon.sk.tsukuba.ac.jp> Message-ID: On 9 Sep 2013 20:46, "Skip Montanaro" wrote: > > > However, it's common in economic statistics to have a rectangular > > array, and extract both certain rows (tuples of observations on > > variables) and certain columns (variables). For example you might > > have data on populations of American states from 1900 to 2012, and > > extract the data on New England states from 1946 to 2012 for analysis. > > When Steven first brought up this PEP on comp.lang.python, my main concern > was basically, "we have SciPy, why do we need this?" Steven's response, which > I have come to accept, is that there are uses for basic statistics for > which SciPy's > stats module would be overkill. > > However, once you start slicing your data structure along more than one axis, I > think you very quickly will find that you need numpy arrays for performance > reasons, at which point you might as go "all the way" and install SciPy. I don't > think slicing along multiple dimensions should be a significant concern for this > package. > > Alternatively, I thought there was discussion a long time ago about > getting numpy's > (or even further back, numeric's?) array type into the core. Python > has an array type > which I don't think gets a lot of use (or love). Might it be > worthwhile to make sure the > PEP 450 package works with that? Then extend it to multiple dimensions? Or just > bite the bullet and get numpy's array type into the Python core once > and for all? > > Sort of Tulip for arrays... Aka memoryview :) Stefan Krah already fixed most of the multidimensional support issues in 3.3 (including the "cast" method to reinterpret the contents in a different format). The main missing API elements are multidimensional slicing and the ability to export them from types defined in Python. Cheers, Nick. > > Skip > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From victor.stinner at gmail.com Mon Sep 9 14:30:50 2013 From: victor.stinner at gmail.com (Victor Stinner) Date: Mon, 9 Sep 2013 14:30:50 +0200 Subject: [Python-Dev] [python-committers] [RELEASED] Python 3.4.0a2 In-Reply-To: <522DB8D3.1030803@hastings.org> References: <522DB8D3.1030803@hastings.org> Message-ID: 2013/9/9 Larry Hastings : > Python 3.4 includes a range of improvements of the 3.x series, including > hundreds of small improvements and bug fixes. Major new features and > changes in the 3.4 release series so far include: > > * PEP 446, changing file descriptors to not be inherited by default > in subprocesses The title of the PEP is "Make newly created file descriptors non-inheritable". It has an impact on all functions creating files and sockets not only the subprocess module. You can also add a link to the nice What?s New In Python 3.4 document: http://docs.python.org/dev/whatsnew/3.4.html Victor From oscar.j.benjamin at gmail.com Mon Sep 9 14:57:50 2013 From: oscar.j.benjamin at gmail.com (Oscar Benjamin) Date: Mon, 9 Sep 2013 13:57:50 +0100 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> <522CA085.6000601@stoneleaf.us> <87ppsi8zwx.fsf@uwakimon.sk.tsukuba.ac.jp> Message-ID: On 9 September 2013 12:56, Nick Coghlan wrote: >> Alternatively, I thought there was discussion a long time ago about >> getting numpy's >> (or even further back, numeric's?) array type into the core. Python >> has an array type >> which I don't think gets a lot of use (or love). Might it be >> worthwhile to make sure the >> PEP 450 package works with that? Then extend it to multiple dimensions? Or >> just >> bite the bullet and get numpy's array type into the Python core once >> and for all? >> >> Sort of Tulip for arrays... > > Aka memoryview :) > > Stefan Krah already fixed most of the multidimensional support issues in 3.3 > (including the "cast" method to reinterpret the contents in a different > format). The main missing API elements are multidimensional slicing and the > ability to export them from types defined in Python. Being very familiar with numpy's ndarrays and not so much with memoryviews this prompted me to go and have a look at them. How exactly are you supposed to create a multidimensional array using memoryviews? The best I could come up with was something like: $ py -3.3 Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC v.1600 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import array >>> v = memoryview(array.array('b', [1, 2, 3, 4])).cast('b', (2, 2)) >>> v.shape (2, 2) However I don't seem to be able to access the elements: >>> v[0, 1] Traceback (most recent call last): File "", line 1, in TypeError: memoryview: invalid slice key >>> v[0] Traceback (most recent call last): File "", line 1, in NotImplementedError: multi-dimensional sub-views are not implemented >>> v[0:1] >>> v[0:1].shape (1, 2) >>> v[0:1][0] Traceback (most recent call last): File "", line 1, in NotImplementedError: multi-dimensional sub-views are not implemented >>> v[1] Traceback (most recent call last): File "", line 1, in NotImplementedError: multi-dimensional sub-views are not implemented >>> v[:, 1] Traceback (most recent call last): File "", line 1, in TypeError: memoryview: invalid slice key >>> v[1, :] Traceback (most recent call last): File "", line 1, in TypeError: memoryview: invalid slice key And the .cast method bails if you try to use a more useful type code: >>> v = memoryview(array.array('q', [1, 2, 3, 4])).cast('q', (2, 2)) Traceback (most recent call last): File "", line 1, in TypeError: memoryview: cannot cast between two non-byte formats Oscar From ncoghlan at gmail.com Mon Sep 9 16:15:25 2013 From: ncoghlan at gmail.com (Nick Coghlan) Date: Tue, 10 Sep 2013 00:15:25 +1000 Subject: [Python-Dev] PEP 450 adding statistics module In-Reply-To: References: <520C2E23.40405@pearwood.info> <52215BDF.2090109@pearwood.info> <20130908123706.GG26319@ando> <74b03474-ab18-40c5-8ce6-de5159d34903@email.android.com> <522CA085.6000601@stoneleaf.us> <87ppsi8zwx.fsf@uwakimon.sk.tsukuba.ac.jp> Message-ID: On 9 Sep 2013 22:58, "Oscar Benjamin" wrote: > > On 9 September 2013 12:56, Nick Coghlan wrote: > >> Alternatively, I thought there was discussion a long time ago about > >> getting numpy's > >> (or even further back, numeric's?) array type into the core. Python > >> has an array type > >> which I don't think gets a lot of use (or love). Might it be > >> worthwhile to make sure the > >> PEP 450 package works with that? Then extend it to multiple dimensions? Or > >> just > >> bite the bullet and get numpy's array type into the Python core once > >> and for all? > >> > >> Sort of Tulip for arrays... > > > > Aka memoryview :) > > > > Stefan Krah already fixed most of the multidimensional support issues in 3.3 > > (including the "cast" method to reinterpret the contents in a different > > format). The main missing API elements are multidimensional slicing and the > > ability to export them from types defined in Python. > > Being very familiar with numpy's ndarrays and not so much with > memoryviews this prompted me to go and have a look at them. > > How exactly are you supposed to create a multidimensional array using > memoryviews? The best I could come up with was something like: > > $ py -3.3 > Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC v.1600 > 32 bit (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> import array > >>> v = memoryview(array.array('b', [1, 2, 3, 4])).cast('b', (2, 2)) > >>> v.shape > (2, 2) > > However I don't seem to be able to access the elements: > > >>> v[0, 1] > Traceback (most recent call last): > File "", line 1, in > TypeError: memoryview: invalid slice key > >>> v[0] > Traceback (most recent call last): > File "", line 1, in > NotImplementedError: multi-dimensional sub-views are not implemented > >>> v[0:1] > > >>> v[0:1].shape > (1, 2) > >>> v[0:1][0] > Traceback (most recent call last): > File "", line 1, in > NotImplementedError: multi-dimensional sub-views are not implemented > >>> v[1] > Traceback (most recent call last): > File "", line 1, in > NotImplementedError: multi-dimensional sub-views are not implemented > >>> v[:, 1] > Traceback (most recent call last): > File "", line 1, in > TypeError: memoryview: invalid slice key > >>> v[1, :] > Traceback (most recent call last): > File "", line 1, in > TypeError: memoryview: invalid slice key > > And the .cast method bails if you try to use a more useful type code: > > >>> v = memoryview(array.array('q', [1, 2, 3, 4])).cast('q', (2, 2)) > Traceback (most recent call last): > File "", line 1, in > TypeError: memoryview: cannot cast between two non-byte formats Oops, forgot the type casting restrictions, too. My main point was that PEP 3118 is already intended as the tulip equivalent for multi-dimensional arrays, and memoryview is the stdlib API for that. It's just incomplete, since most serious multi-dimensional use cases involve skipping memoryview and go straight to NumPy or one of the image libraries. As far as I am aware, there's no opposition to fixing the multi-dimensional support in memoryview *per se*, just the usual concerns about maintainability and a question of volunteers with the time to actually resolve the relevant open issues on the bug tracker. The fairly extensive 3.3 changes focused on fixing stuff that was previously outright broken, but several limitations remain, often because the best API wasn't clear, or because it reached the point where "just use NumPy" seemed like a justifiable answer. Cheers, Nick. > > > Oscar -------------- next part -------------- An HTML attachment was scrubbed... URL: From ncoghlan at gmail.com Mon Sep 9 16:20:54 2013 From: ncoghlan at gmail.com (Nick Coghlan) Date: Tue, 10 Sep 2013 00:20:54 +1000 Subject: [Python-Dev] [Python-checkins] cpython: Post-3.4.0a2-release fixups. In-Reply-To: <3cYSwh0rHdz7Lkm@mail.python.org> References: <3cYSwh0rHdz7Lkm@mail.python.org> Message-ID: On 9 Sep 2013 22:15, "larry.hastings" wrote: > > http://hg.python.org/cpython/rev/6b211a0c8042 > changeset: 85645:6b211a0c8042 > user: Larry Hastings > date: Mon Sep 09 21:08:52 2013 +0900 > summary: > Post-3.4.0a2-release fixups. > > files: > Include/patchlevel.h | 2 +- > Misc/NEWS | 14 +++++++++++++- > 2 files changed, 14 insertions(+), 2 deletions(-) > > > diff --git a/Include/patchlevel.h b/Include/patchlevel.h > --- a/Include/patchlevel.h > +++ b/Include/patchlevel.h > @@ -23,7 +23,7 @@ > #define PY_RELEASE_SERIAL 2 > > /* Version as a string */ > -#define PY_VERSION "3.4.0a2" > +#define PY_VERSION "3.4.0a2+" > /*--end constants--*/ > > /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. > diff --git a/Misc/NEWS b/Misc/NEWS > --- a/Misc/NEWS > +++ b/Misc/NEWS > @@ -2,10 +2,22 @@ > Python News > +++++++++++ > > +What's New in Python 3.4.0 Alpha 3? > +=================================== > + > +Projected Release date: 2013-09-29 > + > +Core and Builtins > +----------------- > + > +Library > +------- > + > + I had already pushed alpha 3 entries in NEWS, so something seems to have gone wrong here. Perhaps, if RMs are preparing the release out of tree, we could get the NEWS file headings on default updated immediately after the last included commit? Cheers, Nick. > What's New in Python 3.4.0 Alpha 2? > =================================== > > -Projected Release date: 2013-09-08 > +Release date: 2013-09-09 > > Core and Builtins > ----------------- > > -- > Repository URL: http://hg.python.org/cpython > > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > https://mail.python.org/mailman/listinfo/python-checkins > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ethan at stoneleaf.us Mon Sep 9 16:30:12 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Mon, 09 Sep 2013 07:30:12 -0700 Subject: [Python-Dev] PEP 447: add type.__locallookup__ In-Reply-To: <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> Message-ID: <522DDB74.5080609@stoneleaf.us> On 07/30/2013 11:17 PM, Ronald Oussoren wrote: > > And something I forgot to ask: is anyone willing to be the BDFL-Delegate for > PEP 447? *Bump*. It would be nice if this could make into 3.4. -- ~Ethan~ From rdmurray at bitdance.com Mon Sep 9 16:54:22 2013 From: rdmurray at bitdance.com (R. David Murray) Date: Mon, 09 Sep 2013 10:54:22 -0400 Subject: [Python-Dev] [python-committers] [RELEASED] Python 3.4.0a2 In-Reply-To: <20130909144551.76b84640@pitrou.net> References: <522DB8D3.1030803@hastings.org> <20130909144551.76b84640@pitrou.net> Message-ID: <20130909145422.B5689250166@webabinitio.net> On Mon, 09 Sep 2013 14:45:51 +0200, Antoine Pitrou wrote: > Le Mon, 9 Sep 2013 14:30:50 +0200, > Victor Stinner a ??crit : > > 2013/9/9 Larry Hastings : > > > Python 3.4 includes a range of improvements of the 3.x series, > > > including hundreds of small improvements and bug fixes. Major new > > > features and changes in the 3.4 release series so far include: > > > > > > * PEP 446, changing file descriptors to not be inherited by default > > > in subprocesses > > > > The title of the PEP is "Make newly created file descriptors > > non-inheritable". It has an impact on all functions creating files and > > sockets not only the subprocess module. > > I don't think Larry's description is wrong. "Non-inheritable" is a > shorthand for "non-inheritable in subprocesses" with "subprocesses" > taken in the general sense (i.e. not only created with the subprocess > module). Not wrong, but definitely confusing. It is worth clarifying *somehow* that this does not apply only to the subprocess module, which is what a naive (or fast) reader will assume. --David From jcea at jcea.es Mon Sep 9 17:11:21 2013 From: jcea at jcea.es (Jesus Cea) Date: Mon, 09 Sep 2013 17:11:21 +0200 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130906193430.AFA14250816@webabinitio.net> References: <5228C00F.7000209@jcea.es> <6DB0A7E3-FADD-4E35-A983-02A7C0D4CAE3@stufft.io> <20130906191130.B6511250816@webabinitio.net> <7087E6B8-1CD4-4002-AD3F-5578B045A3CB@stufft.io> <20130906193430.AFA14250816@webabinitio.net> Message-ID: <522DE519.7080909@jcea.es> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 06/09/13 21:34, R. David Murray wrote: > Note that I said that single signon *itself* was overrated. If you > use the same token to authenticate to multiple sites (and here the > 'token' is the email address) then your identities on those sites > are ipso facto associated with each other. *If* that email address > is also never leaked (never displayed, even to other signed on > users, all communication with the site encrypted), then you only > have to worry if the sites exchange information about their > accounts, or if the government comes knocking on their doors.... > > Yes, I'm paranoid. That doesn't mean they aren't listening. Being paranoid is good. Fix for this is actually trivial: Use different emails for different "personalities". If you are doing things you really NEED to hide, virtual machines and TOR is the way to go. - -- Jes?s Cea Avi?n _/_/ _/_/_/ _/_/_/ jcea at jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/ Twitter: @jcea _/_/ _/_/ _/_/_/_/_/ jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/ _/_/ _/_/ "Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/ "My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/ "El amor es poner tu felicidad en la felicidad de otro" - Leibniz -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQCVAwUBUi3lGZlgi5GaxT1NAQLykAQAi8WDuWmEAAX7bP1glDT8iLrMRpKlu+Vh WndX9ObB/os2D9RZkL7DZB01EDMRvfjGlWFm3gQV0CbM9smkgGkhJNLuxYzA2fpK PQlbO4KUKCoQG7qm413TA1g0xxOGzG2n9g2kJisFBCNu2Y2PXroUhm6p41CbTd89 ovwZLLUcPZU= =EQu4 -----END PGP SIGNATURE----- From guido at python.org Mon Sep 9 17:27:41 2013 From: guido at python.org (Guido van Rossum) Date: Mon, 9 Sep 2013 08:27:41 -0700 Subject: [Python-Dev] PEP 447: add type.__locallookup__ In-Reply-To: <522DDB74.5080609@stoneleaf.us> References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> Message-ID: Let's just accept this PEP. It looks like a nice addition to the metaclass machinery and I don't think we'll get much more useful feedback by waiting. On Mon, Sep 9, 2013 at 7:30 AM, Ethan Furman wrote: > On 07/30/2013 11:17 PM, Ronald Oussoren wrote: > >> >> And something I forgot to ask: is anyone willing to be the BDFL-Delegate >> for >> PEP 447? >> > > *Bump*. > > It would be nice if this could make into 3.4. > > -- > ~Ethan~ > > ______________________________**_________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/**mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/**mailman/options/python-dev/** > guido%40python.org > -- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: From benjamin at python.org Mon Sep 9 17:32:20 2013 From: benjamin at python.org (Benjamin Peterson) Date: Mon, 9 Sep 2013 11:32:20 -0400 Subject: [Python-Dev] [Python-checkins] cpython: Post-3.4.0a2-release fixups. In-Reply-To: References: <3cYSwh0rHdz7Lkm@mail.python.org> Message-ID: Well, it's important for the release manager to make sure what the script is doing is sane. :) 2013/9/9 Nick Coghlan : > > On 9 Sep 2013 22:15, "larry.hastings" wrote: >> >> http://hg.python.org/cpython/rev/6b211a0c8042 >> changeset: 85645:6b211a0c8042 >> user: Larry Hastings >> date: Mon Sep 09 21:08:52 2013 +0900 >> summary: >> Post-3.4.0a2-release fixups. >> >> files: >> Include/patchlevel.h | 2 +- >> Misc/NEWS | 14 +++++++++++++- >> 2 files changed, 14 insertions(+), 2 deletions(-) >> >> >> diff --git a/Include/patchlevel.h b/Include/patchlevel.h >> --- a/Include/patchlevel.h >> +++ b/Include/patchlevel.h >> @@ -23,7 +23,7 @@ >> #define PY_RELEASE_SERIAL 2 >> >> /* Version as a string */ >> -#define PY_VERSION "3.4.0a2" >> +#define PY_VERSION "3.4.0a2+" >> /*--end constants--*/ >> >> /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. >> diff --git a/Misc/NEWS b/Misc/NEWS >> --- a/Misc/NEWS >> +++ b/Misc/NEWS >> @@ -2,10 +2,22 @@ >> Python News >> +++++++++++ >> >> +What's New in Python 3.4.0 Alpha 3? >> +=================================== >> + >> +Projected Release date: 2013-09-29 >> + >> +Core and Builtins >> +----------------- >> + >> +Library >> +------- >> + >> + > > I had already pushed alpha 3 entries in NEWS, so something seems to have > gone wrong here. > > Perhaps, if RMs are preparing the release out of tree, we could get the NEWS > file headings on default updated immediately after the last included commit? > > Cheers, > Nick. > >> What's New in Python 3.4.0 Alpha 2? >> =================================== >> >> -Projected Release date: 2013-09-08 >> +Release date: 2013-09-09 >> >> Core and Builtins >> ----------------- >> >> -- >> Repository URL: http://hg.python.org/cpython >> >> _______________________________________________ >> Python-checkins mailing list >> Python-checkins at python.org >> https://mail.python.org/mailman/listinfo/python-checkins >> > > > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/benjamin%40python.org > -- Regards, Benjamin From rdmurray at bitdance.com Mon Sep 9 17:36:32 2013 From: rdmurray at bitdance.com (R. David Murray) Date: Mon, 09 Sep 2013 11:36:32 -0400 Subject: [Python-Dev] Offtopic: paranoia In-Reply-To: <522DE519.7080909@jcea.es> References: <5228C00F.7000209@jcea.es> <6DB0A7E3-FADD-4E35-A983-02A7C0D4CAE3@stufft.io> <20130906191130.B6511250816@webabinitio.net> <7087E6B8-1CD4-4002-AD3F-5578B045A3CB@stufft.io> <20130906193430.AFA14250816@webabinitio.net> <522DE519.7080909@jcea.es> Message-ID: <20130909153632.EDACD250166@webabinitio.net> On Mon, 09 Sep 2013 17:11:21 +0200, Jesus Cea wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 06/09/13 21:34, R. David Murray wrote: > > Note that I said that single signon *itself* was overrated. If you > > use the same token to authenticate to multiple sites (and here the > > 'token' is the email address) then your identities on those sites > > are ipso facto associated with each other. *If* that email address > > is also never leaked (never displayed, even to other signed on > > users, all communication with the site encrypted), then you only > > have to worry if the sites exchange information about their > > accounts, or if the government comes knocking on their doors.... > > > > Yes, I'm paranoid. That doesn't mean they aren't listening. > > Being paranoid is good. Fix for this is actually trivial: Use > different emails for different "personalities". Yes, that's exactly my point. > If you are doing things you really NEED to hide, virtual machines and > TOR is the way to go. Well, it would helpful if a lot more people started routing traffic through TOR even when they didn't NEED to. I plan to start doing so soon. --David From mark at hotpy.org Mon Sep 9 17:43:31 2013 From: mark at hotpy.org (Mark Shannon) Date: Mon, 09 Sep 2013 16:43:31 +0100 Subject: [Python-Dev] PEP 447: add type.__locallookup__ In-Reply-To: References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> Message-ID: <522DECA3.2030709@hotpy.org> I would like time to investigate this further, but at the moment I think it will either make attribute lookup poorly defined or slow. Of the top of my head, the problem as a I see it is basically this: Currently, type.__getattribute__() is a fixed point in the lookup of attributes. The proposal means that a fixed point is not reached until the cls parameter of type.__getattribute__() is either object or type, otherwise type.__getattribute__() and type.__locallookup__ must bounce back and forth. This will slow down *every* attribute lookup for what is a fairly obscure use case. Cheers, Mark. On 09/09/13 16:27, Guido van Rossum wrote: > Let's just accept this PEP. It looks like a nice addition to the metaclass machinery and I don't think we'll get much more useful feedback by waiting. > > > On Mon, Sep 9, 2013 at 7:30 AM, Ethan Furman > wrote: > > On 07/30/2013 11:17 PM, Ronald Oussoren wrote: > > > And something I forgot to ask: is anyone willing to be the BDFL-Delegate for > PEP 447? > > > *Bump*. > > It would be nice if this could make into 3.4. > > -- > ~Ethan~ > > _________________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/__mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/__mailman/options/python-dev/__guido%40python.org > > > > > -- > --Guido van Rossum (python.org/~guido ) > > > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/mark%40hotpy.org > From guido at python.org Mon Sep 9 18:03:23 2013 From: guido at python.org (Guido van Rossum) Date: Mon, 9 Sep 2013 09:03:23 -0700 Subject: [Python-Dev] PEP 447: add type.__locallookup__ In-Reply-To: <522DECA3.2030709@hotpy.org> References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> <522DECA3.2030709@hotpy.org> Message-ID: OK, how much time do you need? --Guido van Rossum (sent from Android phone) On Sep 9, 2013 8:44 AM, "Mark Shannon" wrote: > I would like time to investigate this further, but at the moment I think > it will either make attribute lookup poorly defined or slow. > > Of the top of my head, the problem as a I see it is basically this: > Currently, type.__getattribute__() is a fixed point in the lookup of > attributes. > The proposal means that a fixed point is not reached until the cls > parameter of type.__getattribute__() is either object or type, > otherwise type.__getattribute__() and type.__locallookup__ must bounce > back and forth. > > This will slow down *every* attribute lookup for what is a fairly obscure > use case. > > Cheers, > Mark. > > On 09/09/13 16:27, Guido van Rossum wrote: > >> Let's just accept this PEP. It looks like a nice addition to the >> metaclass machinery and I don't think we'll get much more useful feedback >> by waiting. >> >> >> On Mon, Sep 9, 2013 at 7:30 AM, Ethan Furman > ethan at stoneleaf.us>> wrote: >> >> On 07/30/2013 11:17 PM, Ronald Oussoren wrote: >> >> >> And something I forgot to ask: is anyone willing to be the >> BDFL-Delegate for >> PEP 447? >> >> >> *Bump*. >> >> It would be nice if this could make into 3.4. >> >> -- >> ~Ethan~ >> >> ______________________________**___________________ >> Python-Dev mailing list >> Python-Dev at python.org >> https://mail.python.org/__**mailman/listinfo/python-dev< >> https://mail.python.org/**mailman/listinfo/python-dev >> > >> Unsubscribe: https://mail.python.org/__** >> mailman/options/python-dev/__**guido%40python.org< >> https://mail.python.org/**mailman/options/python-dev/**guido%40python.org >> > >> >> >> >> >> -- >> --Guido van Rossum (python.org/~guido ) >> >> >> ______________________________**_________________ >> Python-Dev mailing list >> Python-Dev at python.org >> https://mail.python.org/**mailman/listinfo/python-dev >> Unsubscribe: https://mail.python.org/**mailman/options/python-dev/** >> mark%40hotpy.org >> >> ______________________________**_________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/**mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/**mailman/options/python-dev/** > guido%40python.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mark at hotpy.org Mon Sep 9 18:06:28 2013 From: mark at hotpy.org (Mark Shannon) Date: Mon, 09 Sep 2013 17:06:28 +0100 Subject: [Python-Dev] PEP 447: add type.__locallookup__ In-Reply-To: References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> <522DECA3.2030709@hotpy.org> Message-ID: <522DF204.7040109@hotpy.org> I'll look into it this evening. On 09/09/13 17:03, Guido van Rossum wrote: > OK, how much time do you need? > > --Guido van Rossum (sent from Android phone) > > On Sep 9, 2013 8:44 AM, "Mark Shannon" > wrote: > > I would like time to investigate this further, but at the moment I think it will either make attribute lookup poorly defined or slow. > > Of the top of my head, the problem as a I see it is basically this: > Currently, type.__getattribute__() is a fixed point in the lookup of attributes. > The proposal means that a fixed point is not reached until the cls parameter of type.__getattribute__() is either object or type, > otherwise type.__getattribute__() and type.__locallookup__ must bounce back and forth. > > This will slow down *every* attribute lookup for what is a fairly obscure use case. > > Cheers, > Mark. > > On 09/09/13 16:27, Guido van Rossum wrote: > > Let's just accept this PEP. It looks like a nice addition to the metaclass machinery and I don't think we'll get much more useful feedback by waiting. > > > On Mon, Sep 9, 2013 at 7:30 AM, Ethan Furman >> wrote: > > On 07/30/2013 11:17 PM, Ronald Oussoren wrote: > > > And something I forgot to ask: is anyone willing to be the BDFL-Delegate for > PEP 447? > > > *Bump*. > > It would be nice if this could make into 3.4. > > -- > ~Ethan~ > > ___________________________________________________ > Python-Dev mailing list > Python-Dev at python.org > > https://mail.python.org/____mailman/listinfo/python-dev > > Unsubscribe: https://mail.python.org/____mailman/options/python-dev/____guido%40python.org > > > > > > > -- > --Guido van Rossum (python.org/~guido ) > > > _________________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/__mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/__mailman/options/python-dev/__mark%40hotpy.org > > _________________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/__mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/__mailman/options/python-dev/__guido%40python.org > From ncoghlan at gmail.com Mon Sep 9 18:12:27 2013 From: ncoghlan at gmail.com (Nick Coghlan) Date: Tue, 10 Sep 2013 02:12:27 +1000 Subject: [Python-Dev] [Python-checkins] cpython: Post-3.4.0a2-release fixups. In-Reply-To: References: <3cYSwh0rHdz7Lkm@mail.python.org> Message-ID: On 10 Sep 2013 01:32, "Benjamin Peterson" wrote: > > Well, it's important for the release manager to make sure what the > script is doing is sane. :) Sure, preparing out of tree is fine and sensible. But we should either freeze the tree or update the NEWS headers immediately, otherwise we're going to have updates going into the wrong section. Cheers, Nick. > > 2013/9/9 Nick Coghlan : > > > > On 9 Sep 2013 22:15, "larry.hastings" wrote: > >> > >> http://hg.python.org/cpython/rev/6b211a0c8042 > >> changeset: 85645:6b211a0c8042 > >> user: Larry Hastings > >> date: Mon Sep 09 21:08:52 2013 +0900 > >> summary: > >> Post-3.4.0a2-release fixups. > >> > >> files: > >> Include/patchlevel.h | 2 +- > >> Misc/NEWS | 14 +++++++++++++- > >> 2 files changed, 14 insertions(+), 2 deletions(-) > >> > >> > >> diff --git a/Include/patchlevel.h b/Include/patchlevel.h > >> --- a/Include/patchlevel.h > >> +++ b/Include/patchlevel.h > >> @@ -23,7 +23,7 @@ > >> #define PY_RELEASE_SERIAL 2 > >> > >> /* Version as a string */ > >> -#define PY_VERSION "3.4.0a2" > >> +#define PY_VERSION "3.4.0a2+" > >> /*--end constants--*/ > >> > >> /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. > >> diff --git a/Misc/NEWS b/Misc/NEWS > >> --- a/Misc/NEWS > >> +++ b/Misc/NEWS > >> @@ -2,10 +2,22 @@ > >> Python News > >> +++++++++++ > >> > >> +What's New in Python 3.4.0 Alpha 3? > >> +=================================== > >> + > >> +Projected Release date: 2013-09-29 > >> + > >> +Core and Builtins > >> +----------------- > >> + > >> +Library > >> +------- > >> + > >> + > > > > I had already pushed alpha 3 entries in NEWS, so something seems to have > > gone wrong here. > > > > Perhaps, if RMs are preparing the release out of tree, we could get the NEWS > > file headings on default updated immediately after the last included commit? > > > > Cheers, > > Nick. > > > >> What's New in Python 3.4.0 Alpha 2? > >> =================================== > >> > >> -Projected Release date: 2013-09-08 > >> +Release date: 2013-09-09 > >> > >> Core and Builtins > >> ----------------- > >> > >> -- > >> Repository URL: http://hg.python.org/cpython > >> > >> _______________________________________________ > >> Python-checkins mailing list > >> Python-checkins at python.org > >> https://mail.python.org/mailman/listinfo/python-checkins > >> > > > > > > _______________________________________________ > > Python-Dev mailing list > > Python-Dev at python.org > > https://mail.python.org/mailman/listinfo/python-dev > > Unsubscribe: > > https://mail.python.org/mailman/options/python-dev/benjamin%40python.org > > > > > > -- > Regards, > Benjamin -------------- next part -------------- An HTML attachment was scrubbed... URL: From ethan at stoneleaf.us Mon Sep 9 18:05:57 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Mon, 09 Sep 2013 09:05:57 -0700 Subject: [Python-Dev] PEP 447: add type.__locallookup__ In-Reply-To: <522DECA3.2030709@hotpy.org> References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> <522DECA3.2030709@hotpy.org> Message-ID: <522DF1E5.5050309@stoneleaf.us> On 09/09/2013 08:43 AM, Mark Shannon wrote: > I would like time to investigate this further, but at the moment I think it will either make attribute lookup poorly > defined or slow. > > Of the top of my head, the problem as a I see it is basically this: > Currently, type.__getattribute__() is a fixed point in the lookup of attributes. > The proposal means that a fixed point is not reached until the cls parameter of type.__getattribute__() is either object > or type, > otherwise type.__getattribute__() and type.__locallookup__ must bounce back and forth. > > This will slow down *every* attribute lookup for what is a fairly obscure use case. Looks like there's a patch we can try at http://bugs.python.org/issue18181. Here are Ronald's last timings: ------------------------------------------------------------------------------- PYBENCH 2.1 ------------------------------------------------------------------------------- * using CPython 3.4.0a0 (default, Jul 29 2013, 13:01:34) [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] * disabled garbage collection * system check interval set to maximum: 2147483647 * using timer: time.perf_counter * timer: resolution=1e-09, implementation=clock_gettime(CLOCK_MONOTONIC) ------------------------------------------------------------------------------- Benchmark: pep447.pybench ------------------------------------------------------------------------------- Rounds: 10 Warp: 10 Timer: time.perf_counter Machine Details: Platform ID: Linux-2.6.32-358.114.1.openstack.el6.x86_64-x86_64-with-centos-6.4-Final Processor: x86_64 Python: Implementation: CPython Executable: /tmp/default-pep447/bin/python3 Version: 3.4.0a0 Compiler: GCC 4.4.7 20120313 (Red Hat 4.4.7-3) Bits: 64bit Build: Jul 29 2013 14:09:12 (#default) Unicode: UCS4 ------------------------------------------------------------------------------- Comparing with: default.pybench ------------------------------------------------------------------------------- Rounds: 10 Warp: 10 Timer: time.perf_counter Machine Details: Platform ID: Linux-2.6.32-358.114.1.openstack.el6.x86_64-x86_64-with-centos-6.4-Final Processor: x86_64 Python: Implementation: CPython Executable: /tmp/default/bin/python3 Version: 3.4.0a0 Compiler: GCC 4.4.7 20120313 (Red Hat 4.4.7-3) Bits: 64bit Build: Jul 29 2013 13:01:34 (#default) Unicode: UCS4 Test minimum run-time average run-time this other diff this other diff ------------------------------------------------------------------------------- BuiltinFunctionCalls: 45ms 44ms +1.3% 45ms 44ms +1.3% BuiltinMethodLookup: 26ms 27ms -2.4% 27ms 27ms -2.2% CompareFloats: 33ms 34ms -0.7% 33ms 34ms -1.1% CompareFloatsIntegers: 66ms 67ms -0.9% 66ms 67ms -0.8% CompareIntegers: 51ms 50ms +0.9% 51ms 50ms +0.8% CompareInternedStrings: 34ms 33ms +0.4% 34ms 34ms -0.4% CompareLongs: 29ms 29ms -0.1% 29ms 29ms -0.0% CompareStrings: 43ms 44ms -1.8% 44ms 44ms -1.8% ComplexPythonFunctionCalls: 44ms 42ms +3.9% 44ms 42ms +4.1% ConcatStrings: 33ms 33ms -0.4% 33ms 33ms -1.0% CreateInstances: 47ms 48ms -2.9% 47ms 49ms -3.4% CreateNewInstances: 35ms 36ms -2.5% 36ms 36ms -2.5% CreateStringsWithConcat: 69ms 70ms -0.7% 69ms 70ms -0.9% DictCreation: 52ms 50ms +3.1% 52ms 50ms +3.0% DictWithFloatKeys: 40ms 44ms -10.1% 43ms 45ms -5.8% DictWithIntegerKeys: 32ms 36ms -11.2% 35ms 37ms -4.6% DictWithStringKeys: 29ms 34ms -15.7% 35ms 40ms -11.0% ForLoops: 30ms 29ms +2.2% 30ms 29ms +2.2% IfThenElse: 38ms 41ms -6.7% 38ms 41ms -6.9% ListSlicing: 36ms 36ms -0.7% 36ms 37ms -1.3% NestedForLoops: 43ms 45ms -3.1% 43ms 45ms -3.2% NestedListComprehensions: 39ms 40ms -1.7% 39ms 40ms -2.1% NormalClassAttribute: 86ms 82ms +5.1% 86ms 82ms +5.0% NormalInstanceAttribute: 42ms 42ms +0.3% 42ms 42ms +0.0% PythonFunctionCalls: 39ms 38ms +3.5% 39ms 38ms +2.8% PythonMethodCalls: 51ms 49ms +3.0% 51ms 50ms +2.8% Recursion: 67ms 68ms -1.4% 67ms 68ms -1.4% SecondImport: 41ms 36ms +12.5% 41ms 36ms +12.6% SecondPackageImport: 45ms 40ms +13.1% 45ms 40ms +13.2% SecondSubmoduleImport: 92ms 95ms -2.4% 95ms 98ms -3.6% SimpleComplexArithmetic: 28ms 28ms -0.1% 28ms 28ms -0.2% SimpleDictManipulation: 57ms 57ms -1.0% 57ms 58ms -1.0% SimpleFloatArithmetic: 29ms 28ms +4.7% 29ms 28ms +4.9% SimpleIntFloatArithmetic: 37ms 41ms -8.5% 37ms 41ms -8.7% SimpleIntegerArithmetic: 37ms 41ms -9.4% 37ms 42ms -10.2% SimpleListComprehensions: 33ms 33ms -1.9% 33ms 34ms -2.9% SimpleListManipulation: 28ms 30ms -4.3% 29ms 30ms -4.1% SimpleLongArithmetic: 26ms 26ms +0.5% 26ms 26ms +0.5% SmallLists: 40ms 40ms +0.1% 40ms 40ms +0.1% SmallTuples: 46ms 47ms -2.4% 46ms 48ms -3.0% SpecialClassAttribute: 126ms 120ms +4.7% 126ms 121ms +4.4% SpecialInstanceAttribute: 42ms 42ms +0.6% 42ms 42ms +0.8% StringMappings: 94ms 91ms +3.9% 94ms 91ms +3.8% StringPredicates: 48ms 49ms -1.7% 48ms 49ms -2.1% StringSlicing: 45ms 45ms +1.4% 46ms 45ms +1.5% TryExcept: 23ms 22ms +4.9% 23ms 22ms +4.8% TryFinally: 32ms 32ms -0.1% 32ms 32ms +0.1% TryRaiseExcept: 17ms 17ms +0.9% 17ms 17ms +0.5% TupleSlicing: 49ms 48ms +1.1% 49ms 49ms +1.0% WithFinally: 48ms 47ms +2.3% 48ms 47ms +2.4% WithRaiseExcept: 45ms 44ms +0.8% 45ms 45ms +0.5% ------------------------------------------------------------------------------- Totals: 2284ms 2287ms -0.1% 2306ms 2308ms -0.1% (this=pep447.pybench, other=default.pybench) From a.badger at gmail.com Mon Sep 9 19:39:11 2013 From: a.badger at gmail.com (Toshio Kuratomi) Date: Mon, 9 Sep 2013 10:39:11 -0700 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <87hadyah89.fsf@uwakimon.sk.tsukuba.ac.jp> References: <5228C00F.7000209@jcea.es> <20130905181231.GA25306@iskra.aviel.ru> <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905203651.GB30331@iskra.aviel.ru> <20130905165318.2fa40bab@anarchist> <87hadyah89.fsf@uwakimon.sk.tsukuba.ac.jp> Message-ID: On Thu, Sep 5, 2013 at 6:09 PM, Stephen J. Turnbull wrote: > Barry Warsaw writes: > > We're open source, and I think it benefits our mission to support open, > > decentralized, and free systems like OpenID and Persona. > > Thus speaks an employee of yet another Provider-That-Won't-Accept-My- > Third-Party-Credentials. Sorry, Barry, but you see the problem: > Unfortunately, we can't do it alone. What needs to happen is there > needs to be a large network of sites that support login via O-D-F > systems like OpenID and Persona. Too many of the sites I use (news > sources, GMail, etc) don't support them and my browser manages my > logins to most of them, so why bother learning OpenID, and then > setting it up site by site? > [snipped lots of observations that I generally agree with] There's been a lot of negativity towards OpenID in this thread -- I'd like to say that in Fedora Infrastructure we've found OpenID to be very very good -- but not at addressing the problem that most people are after here. As you've observed being an OpenID provider is a relatively easy to swallow proposition; accepting OpenID from third parties is another thing entirely. As you've also observed, this has to do with trust. A site can trust their own account system and practices and issue OpenID based on those. It is much riskier for the site to trust someone else's account system and practices when deciding whether a user is actually the owner of the account that they claim. So OpenID fails as a truly generic SSO method across sites on the internet... what have we found it good for then? SSO within our site. More and more apps support OpenID out of the box. Many web frameworks have modules for the code you write to authenticate against an OpenID server. A site configures these apps and modules to only trust the site's OpenID service and then deploys them with less custom code. Sites also get a choice about how much risk they consider compromised accounts to a particular application. If they run a web forum and a build system for instance, they might constrain the build system to only their OpenID service but allow the forum to allow OpenID from other providers. And finally, having an openid service lets their users sign into more trusting sites like python.org properties (unlike say, LDAP) :-) -Toshio From phd at phdru.name Mon Sep 9 19:46:58 2013 From: phd at phdru.name (Oleg Broytman) Date: Mon, 9 Sep 2013 21:46:58 +0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: References: <8593FDCE-E3E0-4AD4-897E-2FB1D751086C@stufft.io> <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905203651.GB30331@iskra.aviel.ru> <20130905165318.2fa40bab@anarchist> <87hadyah89.fsf@uwakimon.sk.tsukuba.ac.jp> Message-ID: <20130909174658.GA8795@iskra.aviel.ru> On Mon, Sep 09, 2013 at 10:39:11AM -0700, Toshio Kuratomi wrote: > So OpenID fails as a truly generic SSO method across sites on the > internet... what have we found it good for then? SSO within our site. I.e., OpenID could be good for core developers (using @python.org email adresses as IDs) but not for general public to login to pydotorg sites, right? Oleg. -- Oleg Broytman http://phdru.name/ phd at phdru.name Programmers don't die, they just GOSUB without RETURN. From solipsis at pitrou.net Mon Sep 9 19:49:59 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Mon, 9 Sep 2013 19:49:59 +0200 Subject: [Python-Dev] PEP 447: add type.__locallookup__ References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> <522DECA3.2030709@hotpy.org> <522DF1E5.5050309@stoneleaf.us> Message-ID: <20130909194959.1e8115ef@fsol> On Mon, 09 Sep 2013 09:05:57 -0700 Ethan Furman wrote: > On 09/09/2013 08:43 AM, Mark Shannon wrote: > > I would like time to investigate this further, but at the moment I think it will either make attribute lookup poorly > > defined or slow. > > > > Of the top of my head, the problem as a I see it is basically this: > > Currently, type.__getattribute__() is a fixed point in the lookup of attributes. > > The proposal means that a fixed point is not reached until the cls parameter of type.__getattribute__() is either object > > or type, > > otherwise type.__getattribute__() and type.__locallookup__ must bounce back and forth. > > > > This will slow down *every* attribute lookup for what is a fairly obscure use case. > > Looks like there's a patch we can try at http://bugs.python.org/issue18181. > > Here are Ronald's last timings: Thanks but can you run a benchmark that actually exercises the feature? (I don't know enough about it to know what that would be, but I suppose it has to do with lookups on classes, rather than on instances) Regards Antoine. From phd at phdru.name Mon Sep 9 20:08:00 2013 From: phd at phdru.name (Oleg Broytman) Date: Mon, 9 Sep 2013 22:08:00 +0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <20130909174658.GA8795@iskra.aviel.ru> References: <20130905182522.GA26090@iskra.aviel.ru> <2C429087-4E06-4F0F-B524-25D0F6FB4FFF@stufft.io> <20130905184337.GA26926@iskra.aviel.ru> <667454FE-47D1-46BB-99B6-4C0B10986269@stufft.io> <20130905203651.GB30331@iskra.aviel.ru> <20130905165318.2fa40bab@anarchist> <87hadyah89.fsf@uwakimon.sk.tsukuba.ac.jp> <20130909174658.GA8795@iskra.aviel.ru> Message-ID: <20130909180800.GB8795@iskra.aviel.ru> On Mon, Sep 09, 2013 at 09:46:58PM +0400, Oleg Broytman wrote: > On Mon, Sep 09, 2013 at 10:39:11AM -0700, Toshio Kuratomi wrote: > > So OpenID fails as a truly generic SSO method across sites on the > > internet... what have we found it good for then? SSO within our site. > > I.e., OpenID could be good for core developers (using @python.org > email adresses as IDs) but not for general public to login to pydotorg > sites, right? Oops, completely messed OpenID URLs and Persona emails. Oleg. -- Oleg Broytman http://phdru.name/ phd at phdru.name Programmers don't die, they just GOSUB without RETURN. From zuo at chopin.edu.pl Mon Sep 9 20:23:40 2013 From: zuo at chopin.edu.pl (Jan Kaliszewski) Date: Mon, 09 Sep 2013 20:23:40 +0200 Subject: [Python-Dev] =?utf-8?q?PEP_447=3A_add_type=2E=5F=5Flocallookup=5F?= =?utf-8?q?=5F?= In-Reply-To: <522DF204.7040109@hotpy.org> References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> <522DECA3.2030709@hotpy.org> <522DF204.7040109@hotpy.org> Message-ID: <0752376899dd7436f6115bfc03594574@chopin.edu.pl> Is '__locallookup__' a really good name? In Python, *local* -- especially in context of *lookups* -- usually associates with locals() i.e. a namespace of a function/method execution frame or a namespace of a class, during *definition* of that class... So '__locallookup__' can be confusing. Why not just '__getclassattribute__' or '__classlookup__', or '__classattribute__'...? Cheers. *j From nad at acm.org Mon Sep 9 21:29:27 2013 From: nad at acm.org (Ned Deily) Date: Mon, 09 Sep 2013 12:29:27 -0700 Subject: [Python-Dev] [RELEASED] Python 3.4.0a2 References: <522DB8D3.1030803@hastings.org> Message-ID: In article <522DB8D3.1030803 at hastings.org>, Larry Hastings wrote: > On behalf of the Python development team, I'm chuffed to announce the > second alpha release of Python 3.4. Yay! 3.4.0a2 also contains a new batteries-included feature for OS X users. The python.org 64-bit/32-bit installer now includes its own private version of Tcl/Tk 8.5.14 so it is finally no longer necessary to install a third-party version of Tcl/Tk 8.5 to workaround the problematic system versions shipped in OS X 10.6+. More improvements to come. -- Ned Deily, nad at acm.org From victor.stinner at gmail.com Mon Sep 9 21:51:46 2013 From: victor.stinner at gmail.com (Victor Stinner) Date: Mon, 9 Sep 2013 21:51:46 +0200 Subject: [Python-Dev] [python-committers] [RELEASED] Python 3.4.0a2 In-Reply-To: <20130909144551.76b84640@pitrou.net> References: <522DB8D3.1030803@hastings.org> <20130909144551.76b84640@pitrou.net> Message-ID: 2013/9/9 Antoine Pitrou : > Le Mon, 9 Sep 2013 14:30:50 +0200, > Victor Stinner a ?crit : >> 2013/9/9 Larry Hastings : >> > Python 3.4 includes a range of improvements of the 3.x series, >> > including hundreds of small improvements and bug fixes. Major new >> > features and changes in the 3.4 release series so far include: >> > >> > * PEP 446, changing file descriptors to not be inherited by default >> > in subprocesses >> >> The title of the PEP is "Make newly created file descriptors >> non-inheritable". It has an impact on all functions creating files and >> sockets not only the subprocess module. > > I don't think Larry's description is wrong. "Non-inheritable" is a > shorthand for "non-inheritable in subprocesses" with "subprocesses" > taken in the general sense (i.e. not only created with the subprocess > module). Oh, I misunderstood "in subprocesses", I read "in the subprocess module". The definition of FD inheritance is tricky. For example, on UNIX "non-inheritable" file descriptors are still inherited at fork :-) I hope that the documentation is explicit enough: http://docs.python.org/dev/library/os.html#inheritance-of-file-descriptors Victor From yselivanov.ml at gmail.com Mon Sep 9 22:01:47 2013 From: yselivanov.ml at gmail.com (Yury Selivanov) Date: Mon, 9 Sep 2013 16:01:47 -0400 Subject: [Python-Dev] PEP 447: add type.__locallookup__ In-Reply-To: <0752376899dd7436f6115bfc03594574@chopin.edu.pl> References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> <522DECA3.2030709@hotpy.org> <522DF204.7040109@hotpy.org> <0752376899dd7436f6115bfc03594574@chopin.edu.pl> Message-ID: Yes, I don't like the 'local' prefix too. How about '__dictlookup__'? It's just more self-describing. Yury On 2013-09-09, at 2:23 PM, Jan Kaliszewski wrote: > Is '__locallookup__' a really good name? In Python, *local* -- especially in context of *lookups* -- usually associates with locals() i.e. a namespace of a function/method execution frame or a namespace of a class, during *definition* of that class... So '__locallookup__' can be confusing. > > Why not just '__getclassattribute__' or '__classlookup__', or '__classattribute__'...? > > Cheers. > *j > > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/yselivanov.ml%40gmail.com From benjamin at python.org Mon Sep 9 22:16:33 2013 From: benjamin at python.org (Benjamin Peterson) Date: Mon, 9 Sep 2013 16:16:33 -0400 Subject: [Python-Dev] PEP 447: add type.__locallookup__ In-Reply-To: <522DDB74.5080609@stoneleaf.us> References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> Message-ID: Since the main problem is super(), maybe we can just add a __super__ method to get a custom super implementation? 2013/9/9 Ethan Furman : > On 07/30/2013 11:17 PM, Ronald Oussoren wrote: >> >> >> And something I forgot to ask: is anyone willing to be the BDFL-Delegate >> for >> PEP 447? > > > *Bump*. > > It would be nice if this could make into 3.4. > > -- > ~Ethan~ > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/benjamin%40python.org -- Regards, Benjamin From mark at hotpy.org Mon Sep 9 23:18:38 2013 From: mark at hotpy.org (Mark Shannon) Date: Mon, 09 Sep 2013 22:18:38 +0100 Subject: [Python-Dev] PEP 447: add type.__locallookup__ In-Reply-To: <522DDB74.5080609@stoneleaf.us> References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> Message-ID: <522E3B2E.6050605@hotpy.org> On 09/09/13 15:30, Ethan Furman wrote: > On 07/30/2013 11:17 PM, Ronald Oussoren wrote: >> >> And something I forgot to ask: is anyone willing to be the >> BDFL-Delegate for >> PEP 447? > > *Bump*. > > It would be nice if this could make into 3.4. > IMO, there are some issues that need to be addressed before PEP 447 should be accepted. 1. Is there even a problem at all, or is this just a bug in super? Why doesn't super() respect the __getattribute__ method of the superclass? 2. Is this the best way to solve the problem (if there is a problem)? Would a __super__ special method be sufficient and less intrusive. 3. Are the proposed semantics OK? I think they are, but very low level changes such as these can have unforeseen consequences. For example, PEP 3135 and issue 12370. 4. What is the performance impact. pybench really doesn't count as a benchmark. 5. Other implementations. What do the Jython/IronPython/PyPy developers think? Cheers, Mark. p.s. Apologies for top-posting earlier From benjamin at python.org Mon Sep 9 23:25:14 2013 From: benjamin at python.org (Benjamin Peterson) Date: Mon, 9 Sep 2013 17:25:14 -0400 Subject: [Python-Dev] PEP 447: add type.__locallookup__ In-Reply-To: <522E3B2E.6050605@hotpy.org> References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> <522E3B2E.6050605@hotpy.org> Message-ID: 2013/9/9 Mark Shannon : > On 09/09/13 15:30, Ethan Furman wrote: >> >> On 07/30/2013 11:17 PM, Ronald Oussoren wrote: >>> >>> >>> And something I forgot to ask: is anyone willing to be the >>> BDFL-Delegate for >>> PEP 447? >> >> >> *Bump*. >> >> It would be nice if this could make into 3.4. >> > > IMO, there are some issues that need to be addressed before PEP 447 should > be accepted. > > 1. Is there even a problem at all, or is this just a bug in super? > Why doesn't super() respect the __getattribute__ method of the superclass? You want to be looking things up on the class, not an instance. -- Regards, Benjamin From mark at hotpy.org Tue Sep 10 00:36:15 2013 From: mark at hotpy.org (Mark Shannon) Date: Mon, 09 Sep 2013 23:36:15 +0100 Subject: [Python-Dev] PEP 447: add type.__locallookup__ In-Reply-To: References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> <522E3B2E.6050605@hotpy.org> Message-ID: <522E4D5F.4050505@hotpy.org> On 09/09/13 22:25, Benjamin Peterson wrote: > 2013/9/9 Mark Shannon : >> On 09/09/13 15:30, Ethan Furman wrote: >>> >>> On 07/30/2013 11:17 PM, Ronald Oussoren wrote: >>>> >>>> >>>> And something I forgot to ask: is anyone willing to be the >>>> BDFL-Delegate for >>>> PEP 447? >>> >>> >>> *Bump*. >>> >>> It would be nice if this could make into 3.4. >>> >> >> IMO, there are some issues that need to be addressed before PEP 447 should >> be accepted. >> >> 1. Is there even a problem at all, or is this just a bug in super? >> Why doesn't super() respect the __getattribute__ method of the superclass? > > You want to be looking things up on the class, not an instance. > Sorry, I meant 'type of the superclass' rather than 'superclass'. I was suggesting that super().m should be type(type(self).__mro__[1]).__getattribute__('m') rather than type(self).__mro__[1].__dict__['m'] (ignoring descriptor __get__ calls) Unfortunately this brings its own problems, due to __getattribute__ doing its own traversal of the mro. So, scratch point 1. Cheers, Mark. From rymg19 at gmail.com Tue Sep 10 02:28:15 2013 From: rymg19 at gmail.com (Ryan) Date: Mon, 09 Sep 2013 19:28:15 -0500 Subject: [Python-Dev] [RELEASED] Python 3.4.0a2 In-Reply-To: References: <522DB8D3.1030803@hastings.org> Message-ID: <610dd75a-ada8-4ae1-9810-7320cbeda9ce@email.android.com> HALLELUJAH!!! Ned Deily wrote: >In article <522DB8D3.1030803 at hastings.org>, > Larry Hastings wrote: > >> On behalf of the Python development team, I'm chuffed to announce the >> second alpha release of Python 3.4. > >Yay! 3.4.0a2 also contains a new batteries-included feature for OS X >users. The python.org 64-bit/32-bit installer now includes its own >private version of Tcl/Tk 8.5.14 so it is finally no longer necessary >to >install a third-party version of Tcl/Tk 8.5 to workaround the >problematic system versions shipped in OS X 10.6+. More improvements >to >come. > >-- > Ned Deily, > nad at acm.org > >_______________________________________________ >Python-Dev mailing list >Python-Dev at python.org >https://mail.python.org/mailman/listinfo/python-dev >Unsubscribe: >https://mail.python.org/mailman/options/python-dev/rymg19%40gmail.com -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan_ml at behnel.de Tue Sep 10 07:48:51 2013 From: stefan_ml at behnel.de (Stefan Behnel) Date: Tue, 10 Sep 2013 07:48:51 +0200 Subject: [Python-Dev] [RELEASED] Python 3.4.0a2 In-Reply-To: References: <522DB8D3.1030803@hastings.org> Message-ID: Ned Deily, 09.09.2013 21:29: > 3.4.0a2 also contains a new batteries-included feature for OS X > users. The python.org 64-bit/32-bit installer now includes its own > private version of Tcl/Tk 8.5.14 so it is finally no longer necessary to > install a third-party version of Tcl/Tk 8.5 to workaround the > problematic system versions shipped in OS X 10.6+. More improvements to > come. With MS Windows on steep decline, I'm so happy we have at least MacOS-X rising to keep us busy. Stefan From solipsis at pitrou.net Tue Sep 10 08:08:46 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Tue, 10 Sep 2013 08:08:46 +0200 Subject: [Python-Dev] cpython (2.7): Clarify mmap.close method behavior. Addresses issue #18815 References: <3cYw7T6lKwz7LjZ@mail.python.org> Message-ID: <20130910080846.578093a7@fsol> On Tue, 10 Sep 2013 07:40:21 +0200 (CEST) senthil.kumaran wrote: > http://hg.python.org/cpython/rev/443d12b61e5b > changeset: 85653:443d12b61e5b > branch: 2.7 > parent: 85639:740bd510a888 > user: Senthil Kumaran > date: Mon Sep 09 22:38:58 2013 -0700 > summary: > Clarify mmap.close method behavior. Addresses issue #18815 > Patch contributed by Anoop Thomas Mathew. > > files: > Doc/library/mmap.rst | 5 +++-- > 1 files changed, 3 insertions(+), 2 deletions(-) > > > diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst > --- a/Doc/library/mmap.rst > +++ b/Doc/library/mmap.rst > @@ -152,8 +152,9 @@ > > .. method:: close() > > - Close the file. Subsequent calls to other methods of the object will > - result in an exception being raised. > + Closes the mmap. Subsequent calls to other methods of the object will > + result in a ValueError exception being raised. This will not close > + the open file. I think this could be improved. Anonymous mmap objects don't have an "open file". Also, it would be clearer if it read "the underlying file" rather than "the underlying file object" rather than "the open file", because an mmap object is a file as well (it has read(), write(), seek(), etc.). Regards Antoine. From v+python at g.nevcal.com Tue Sep 10 09:21:28 2013 From: v+python at g.nevcal.com (Glenn Linderman) Date: Tue, 10 Sep 2013 00:21:28 -0700 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: References: <5228C00F.7000209@jcea.es> Message-ID: <522EC878.6080409@g.nevcal.com> On 9/6/2013 10:22 AM, Dan Callahan wrote: > On 9/5/13 12:31 PM, Jesus Cea wrote: >> I have big hopes for Mozilla Persona, looking forward >> Python infrastructure support :). > > Hi, I'm the project lead on Persona signin, and I spoke at PyCon > earlier this year regarding why and how Mozilla is building Persona. > If you'd like some more background, that video [0] is worth a look. > > Let's pull this discussion up a level: > > It sounds like many people (Jesus, Donald, Toshio, Barry, Tres, > Dirkjan, etc.) are interested in seeing Persona on Python.org > properties, and most of the objections coming from a place of "Persona > hasn't gone viral, what if this is wasted effort?" OK, let's pull this discussion down a level: testing it out. So I tried to login to the crossword.thetimes.co.uk -- I used an email address persona had never seen, it asked me for a password, and sent me a confirmation message, containing a link that I clicked on. However, as I was reading clues and filling in blanks, I got a popup that said "login failure [object Object]". And crossword told me it was saving locally, and to login to save to the server. And the Log in button stayed displayed, rather than a Log out button, which I assume it might get replaced with if I ever get successfully logged in. Firefox 23.0.1, Windows 7 64-bit with autoupdates. Need any other info? Write me privately if you want the email address I used (not the one I use here), or the password. I used new ones, so I can share for testing, and then discard them and use different ones "for real". If the system actually works. Hey, the video demos looked great... Glenn -------------- next part -------------- An HTML attachment was scrubbed... URL: From solipsis at pitrou.net Tue Sep 10 10:10:42 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Tue, 10 Sep 2013 10:10:42 +0200 Subject: [Python-Dev] Offtopic: OpenID Providers References: <5228C00F.7000209@jcea.es> <522EC878.6080409@g.nevcal.com> Message-ID: <20130910101042.7c2b66c7@pitrou.net> Ok, can this discussion go off python-dev, please? This has been terribly off-topic for a long time (arguably from the beginning, actually). Thank you Antoine. Le Tue, 10 Sep 2013 00:21:28 -0700, Glenn Linderman a ?crit : > On 9/6/2013 10:22 AM, Dan Callahan wrote: > > On 9/5/13 12:31 PM, Jesus Cea wrote: > >> I have big hopes for Mozilla Persona, looking forward > >> Python infrastructure support :). > > > > Hi, I'm the project lead on Persona signin, and I spoke at PyCon > > earlier this year regarding why and how Mozilla is building > > Persona. If you'd like some more background, that video [0] is > > worth a look. > > > > Let's pull this discussion up a level: > > > > It sounds like many people (Jesus, Donald, Toshio, Barry, Tres, > > Dirkjan, etc.) are interested in seeing Persona on Python.org > > properties, and most of the objections coming from a place of > > "Persona hasn't gone viral, what if this is wasted effort?" > > OK, let's pull this discussion down a level: testing it out. > > So I tried to login to the crossword.thetimes.co.uk -- I used an > email address persona had never seen, it asked me for a password, and > sent me a confirmation message, containing a link that I clicked on. > > However, as I was reading clues and filling in blanks, I got a popup > that said "login failure [object Object]". And crossword told me it > was saving locally, and to login to save to the server. And the Log > in button stayed displayed, rather than a Log out button, which I > assume it might get replaced with if I ever get successfully logged > in. > > Firefox 23.0.1, Windows 7 64-bit with autoupdates. Need any other > info? Write me privately if you want the email address I used (not > the one I use here), or the password. I used new ones, so I can share > for testing, and then discard them and use different ones "for real". > If the system actually works. Hey, the video demos looked great... > > Glenn > From solipsis at pitrou.net Tue Sep 10 11:28:32 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Tue, 10 Sep 2013 11:28:32 +0200 Subject: [Python-Dev] Add a "transformdict" to collections Message-ID: <20130910112832.75ed6c8b@pitrou.net> Hello, In http://bugs.python.org/issue18986 I proposed adding a new mapping type to the collections module. The original use case is quite common in network programming and elsewhere (Eric Snow on the tracker mentioned an application with stock symbols). You want to have an associative container which matches keys case-insensitively but also preserves the original casing (e.g. for presentation). It is a commonly reimplemented container. It is also an instance of a more general pattern: match keys after applying a derivation (or coercion) function, but at the same time keep track of the original key. Note that the derivation function needn't be (and generally won't be) bijective, otherwise it's too simple. Therefore I propose adding the general pattern. Simple example: >>> d = transformdict(str.lower) >>> d['Foo'] = 5 >>> d['foo'] 5 >>> d['FOO'] 5 >>> list(d) ['Foo'] (case-insensitive but case-preserving, as the best filesystems are ;-)) On the tracker issue, it seems everyone agreed on the principle. There is some bikeshedding left to do, though. So here are the reasonable naming proposals so far: - transformkeydict - coercekeydict - transformdict - coercedict I have a sweet spot for "transformdict" myself. Regards Antoine. From skip at pobox.com Tue Sep 10 11:42:46 2013 From: skip at pobox.com (Skip Montanaro) Date: Tue, 10 Sep 2013 04:42:46 -0500 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130910112832.75ed6c8b@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> Message-ID: > (case-insensitive but case-preserving, as the best filesystems are ;-)) > I have a sweet spot for "transformdict" myself. Antoine, "Transform" does not remind me of "case-insensitive but case-preserving". If this is important enough to put into the collections module (I'm skeptical), shouldn't that behavior be more strongly hinted at in the name? Lot's of things are transformations. You're interested in a very specific one. Skip From solipsis at pitrou.net Tue Sep 10 12:00:12 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Tue, 10 Sep 2013 12:00:12 +0200 Subject: [Python-Dev] Add a "transformdict" to collections References: <20130910112832.75ed6c8b@pitrou.net> Message-ID: <20130910120012.6628c98b@pitrou.net> Le Tue, 10 Sep 2013 04:42:46 -0500, Skip Montanaro a ?crit : > > (case-insensitive but case-preserving, as the best filesystems > > are ;-)) > > > I have a sweet spot for "transformdict" myself. > > Antoine, > > "Transform" does not remind me of "case-insensitive but > case-preserving". That was only describing the example, not the proposal. (and I hoped it would be obvious that that sentence was a joke ;-)) Regards Antoine. From victor.stinner at gmail.com Tue Sep 10 12:04:51 2013 From: victor.stinner at gmail.com (Victor Stinner) Date: Tue, 10 Sep 2013 12:04:51 +0200 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130910112832.75ed6c8b@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> Message-ID: 2013/9/10 Antoine Pitrou : > In http://bugs.python.org/issue18986 I proposed adding a new mapping > type to the collections module. > > The original use case is quite common in network programming and > elsewhere (Eric Snow on the tracker mentioned an application with stock > symbols). You want to have an associative container which matches keys > case-insensitively but also preserves the original casing (e.g. for > presentation). It is a commonly reimplemented container. If it is commonly reimplemented, what is the most common name? :-) The http.client and email.message modules convert headers to lower case, but keep the original case. > - transformkeydict Do you know a use case where values need also to be transformed? If not, I prefer the transformdict name. > - coercekeydict > - coercedict I only read "coerce" in old Python documentation, not in other languages. I prefer the more common and generic term "tranform". Victor From oscar.j.benjamin at gmail.com Tue Sep 10 12:34:54 2013 From: oscar.j.benjamin at gmail.com (Oscar Benjamin) Date: Tue, 10 Sep 2013 11:34:54 +0100 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130910112832.75ed6c8b@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> Message-ID: On 10 September 2013 10:28, Antoine Pitrou wrote: > On the tracker issue, it seems everyone agreed on the principle. There > is some bikeshedding left to do, though. So here are the reasonable > naming proposals so far: > > - transformkeydict > - coercekeydict > - transformdict > - coercedict > > I have a sweet spot for "transformdict" myself. Could you not use a name with some sense of purpose like approxmatchdict? Oscar From dirkjan at ochtman.nl Tue Sep 10 12:46:33 2013 From: dirkjan at ochtman.nl (Dirkjan Ochtman) Date: Tue, 10 Sep 2013 12:46:33 +0200 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130910112832.75ed6c8b@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> Message-ID: On Tue, Sep 10, 2013 at 11:28 AM, Antoine Pitrou wrote: > On the tracker issue, it seems everyone agreed on the principle. There > is some bikeshedding left to do, though. So here are the reasonable > naming proposals so far: > > - transformkeydict > - coercekeydict > - transformdict > - coercedict > > I have a sweet spot for "transformdict" myself. Given OrderedDict, it seems like this should definitely be TransformDict rather than transformdict. Cheers, Dirkjan From martin at v.loewis.de Tue Sep 10 13:56:56 2013 From: martin at v.loewis.de (=?ISO-8859-15?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Tue, 10 Sep 2013 13:56:56 +0200 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <5228C00F.7000209@jcea.es> References: <5228C00F.7000209@jcea.es> Message-ID: <522F0908.9030303@v.loewis.de> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 05.09.13 19:31, schrieb Jesus Cea: > What are you using?. bugs.python.org admins could share some data? Most users use one of the large services: https://www.google.com 3326 https://login.launchpad.net 335 https://*.myopenid.com 253 https://launchpad.net 23 https://*.id.fedoraproject.org 11 The remaining ones are mostly private URLs. Of those, a majority again delegates to providers, namely (ignoring providers with less than 3 users) www.startssl.com 3 www.clavid.com 3 openid.stackexchange.com 4 openid.claimid.com 4 login.launchpad.net 7 openid.yandex.ru 8 www.google.com 14 pip.verisignlabs.com 20 www.myopenid.com 41 Regards, Martin -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.18 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlIvCQgACgkQavBT8H2dyNIX/gCeL9As+Z/aRAggbP+bjwUxFtGo wZYAn2YkEEf/iv+bPGDBEnV+UWZmrf9M =B5pE -----END PGP SIGNATURE----- From ncoghlan at gmail.com Tue Sep 10 14:00:37 2013 From: ncoghlan at gmail.com (Nick Coghlan) Date: Tue, 10 Sep 2013 22:00:37 +1000 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> Message-ID: Is this just syntactic sugar for recursive lookup of a transformed version in __missing__? Or a way of supplying a custom "key" function to a dictionary? Any such proposal should consider how it composes with other dict variants like defaultdict, OrderedDict and counter. Cheers, Nick. -------------- next part -------------- An HTML attachment was scrubbed... URL: From solipsis at pitrou.net Tue Sep 10 14:22:58 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Tue, 10 Sep 2013 14:22:58 +0200 Subject: [Python-Dev] Add a "transformdict" to collections References: <20130910112832.75ed6c8b@pitrou.net> Message-ID: <20130910142258.02c148dd@pitrou.net> Le Tue, 10 Sep 2013 22:00:37 +1000, Nick Coghlan a ?crit : > Is this just syntactic sugar for recursive lookup of a transformed > version in __missing__? Nope. For one, it doesn't use __missing__ at all. I think using __missing__ would be... missing the point, because it wouldn't working properly if you have e.g. X != Y such that transform(X) == Y and transform(Y) == X. (a simple example being transform = str.swapcase :-)) > Or a way of supplying a custom "key" function > to a dictionary? Probably, although I'm not entirely sure what you mean by that :-) > Any such proposal should consider how it composes with other dict > variants like defaultdict, OrderedDict and counter. Well, one sticking point here is that those variants don't compose with each other already :-) But, yes, I may make another proposal with composition in mind. Regards Antoine. From p.f.moore at gmail.com Tue Sep 10 14:24:29 2013 From: p.f.moore at gmail.com (Paul Moore) Date: Tue, 10 Sep 2013 13:24:29 +0100 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> Message-ID: On 10 September 2013 13:00, Nick Coghlan wrote: > Is this just syntactic sugar for recursive lookup of a transformed version > in __missing__? Or a way of supplying a custom "key" function to a > dictionary? Not quite, because the dict should preserve the originally entered key. >>> td['FOO'] = 42 >>> td['bar'] = 1 >>> td['foo'] 42 >>> td['BAR'] 1 >>> list(td.keys()) ['FOO', 'bar'] This actually prompts the question, what should the following produce: >>> td['FOO'] = 42 >>> td['foo'] = 32 >>> list(td.keys()) ['FOO'] or ['foo']? Both answers are justifiable. Both are possibly even useful depending on context... Paul From p.f.moore at gmail.com Tue Sep 10 14:25:51 2013 From: p.f.moore at gmail.com (Paul Moore) Date: Tue, 10 Sep 2013 13:25:51 +0100 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> Message-ID: On 10 September 2013 13:24, Paul Moore wrote: > On 10 September 2013 13:00, Nick Coghlan wrote: >> Is this just syntactic sugar for recursive lookup of a transformed version >> in __missing__? Or a way of supplying a custom "key" function to a >> dictionary? > > Not quite, because the dict should preserve the originally entered key. > >>>> td['FOO'] = 42 >>>> td['bar'] = 1 >>>> td['foo'] > 42 >>>> td['BAR'] > 1 >>>> list(td.keys()) > ['FOO', 'bar'] > > This actually prompts the question, what should the following produce: > >>>> td['FOO'] = 42 >>>> td['foo'] = 32 >>>> list(td.keys()) > > ['FOO'] or ['foo']? Both answers are justifiable. Both are possibly > even useful depending on context... I'm using the case where the transform is str.lower here - sorry I wasn't explicit. Paul From solipsis at pitrou.net Tue Sep 10 14:35:58 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Tue, 10 Sep 2013 14:35:58 +0200 Subject: [Python-Dev] Add a "transformdict" to collections References: <20130910112832.75ed6c8b@pitrou.net> Message-ID: <20130910143558.5677b55a@pitrou.net> Le Tue, 10 Sep 2013 13:24:29 +0100, Paul Moore a ?crit : > On 10 September 2013 13:00, Nick Coghlan wrote: > > Is this just syntactic sugar for recursive lookup of a transformed > > version in __missing__? Or a way of supplying a custom "key" > > function to a dictionary? > > Not quite, because the dict should preserve the originally entered > key. > > >>> td['FOO'] = 42 > >>> td['bar'] = 1 > >>> td['foo'] > 42 > >>> td['BAR'] > 1 > >>> list(td.keys()) > ['FOO', 'bar'] > > This actually prompts the question, what should the following produce: > > >>> td['FOO'] = 42 > >>> td['foo'] = 32 > >>> list(td.keys()) > > ['FOO'] or ['foo']? Both answers are justifiable. Both are possibly > even useful depending on context... I think it would be best to leave it as an implementation detail, because whichever is easiest to implement depends on the exact implementation choices (e.g. C vs. Python). (my prototypes right now conserve the last __setitem__ key, not the first) Regards Antoine. From martin at v.loewis.de Tue Sep 10 14:44:01 2013 From: martin at v.loewis.de (=?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?=) Date: Tue, 10 Sep 2013 14:44:01 +0200 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130910143558.5677b55a@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> <20130910143558.5677b55a@pitrou.net> Message-ID: <522F1411.8010109@v.loewis.de> Am 10.09.13 14:35, schrieb Antoine Pitrou: >> ['FOO'] or ['foo']? Both answers are justifiable. Both are possibly >> even useful depending on context... > > I think it would be best to leave it as an implementation detail, > because whichever is easiest to implement depends on the exact > implementation choices (e.g. C vs. Python). I think this is the point where the datatype is *not* clearly straight-forward, and thus deserves a PEP. I think it would be a flaw to have this detail implementation-defined. This would be like saying that it is implementation-defined which of A,B,C is returned from "A and B and C" if all are true. Regards, Martin From hrvoje.niksic at avl.com Tue Sep 10 15:09:56 2013 From: hrvoje.niksic at avl.com (Hrvoje Niksic) Date: Tue, 10 Sep 2013 15:09:56 +0200 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> Message-ID: <522F1A24.5030808@avl.com> On 09/10/2013 02:24 PM, Paul Moore wrote: >>>> td['FOO'] = 42 >>>> td['foo'] = 32 >>>> list(td.keys()) > > ['FOO'] or ['foo']? Both answers are justifiable. Note that the same question can be reasonably asked for dict itself: >>> d = {} >>> d[1.0] = 'foo' >>> d[1] = 'bar' >>> d {1.0: 'bar'} So, dict.__setitem__ only replaces the value, leaving the original key in place. transformdict should probably do the same, returning 'FOO' in your example. From shibturn at gmail.com Tue Sep 10 15:42:39 2013 From: shibturn at gmail.com (Richard Oudkerk) Date: Tue, 10 Sep 2013 14:42:39 +0100 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130910112832.75ed6c8b@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> Message-ID: <522F21CF.4060609@gmail.com> On 10/09/2013 10:28am, Antoine Pitrou wrote: > Therefore I propose adding the general pattern. Simple example: > > >>> d = transformdict(str.lower) > >>> d['Foo'] = 5 > >>> d['foo'] > 5 > >>> d['FOO'] > 5 > >>> list(d) > ['Foo'] I guess another example is creating an "identity dict" (see http://code.activestate.com/lists/python-ideas/7161/) by doing d = transformdict(id) -- Richard From barry at python.org Tue Sep 10 15:49:28 2013 From: barry at python.org (Barry Warsaw) Date: Tue, 10 Sep 2013 09:49:28 -0400 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> Message-ID: <20130910094928.1cad3f53@anarchist> On Sep 10, 2013, at 12:04 PM, Victor Stinner wrote: >The http.client and email.message modules convert headers to lower >case, but keep the original case. As RDM pointed out on the tracker, email headers aren't a great use case for this because they aren't really dictionaries. They're lists with some dict-like syntax. -Barry From solipsis at pitrou.net Tue Sep 10 15:57:40 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Tue, 10 Sep 2013 15:57:40 +0200 Subject: [Python-Dev] Add a "transformdict" to collections References: <20130910112832.75ed6c8b@pitrou.net> <20130910094928.1cad3f53@anarchist> Message-ID: <20130910155740.1aeab97a@pitrou.net> Le Tue, 10 Sep 2013 09:49:28 -0400, Barry Warsaw a ?crit : > On Sep 10, 2013, at 12:04 PM, Victor Stinner wrote: > > >The http.client and email.message modules convert headers to lower > >case, but keep the original case. > > As RDM pointed out on the tracker, email headers aren't a great use > case for this because they aren't really dictionaries. They're lists > with some dict-like syntax. defaultdict(list)? From barry at python.org Tue Sep 10 16:06:00 2013 From: barry at python.org (Barry Warsaw) Date: Tue, 10 Sep 2013 10:06:00 -0400 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130910155740.1aeab97a@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> <20130910094928.1cad3f53@anarchist> <20130910155740.1aeab97a@pitrou.net> Message-ID: <20130910100600.0078b29a@anarchist> On Sep 10, 2013, at 03:57 PM, Antoine Pitrou wrote: >Le Tue, 10 Sep 2013 09:49:28 -0400, >Barry Warsaw a ?crit : >> On Sep 10, 2013, at 12:04 PM, Victor Stinner wrote: >> >> >The http.client and email.message modules convert headers to lower >> >case, but keep the original case. >> >> As RDM pointed out on the tracker, email headers aren't a great use >> case for this because they aren't really dictionaries. They're lists >> with some dict-like syntax. > >defaultdict(list)? Not really. Email headers support duplicates, although the dict-syntax will only return the first such header. Alternative syntax like .get_all() gives you all of them. But anyway, don't let this stop you! I like your robots-in-disguise[1] dicts no matter what you call them, and even if email can't use them. -Barry [1] http://www.youtube.com/watch?v=59QeKkjishs From arigo at tunes.org Tue Sep 10 16:09:16 2013 From: arigo at tunes.org (Armin Rigo) Date: Tue, 10 Sep 2013 16:09:16 +0200 Subject: [Python-Dev] PEP 447: add type.__locallookup__ Message-ID: Hi Mark, On Mon, Sep 9, 2013 at 11:18 PM, Mark Shannon wrote: > 5. Other implementations. What do the Jython/IronPython/PyPy developers > think? Thanks for asking :-) I'm fine with staying out of language design issues like this one, and I believe it's the general concensus in PyPy. Whatever gets decided will probably be easy to port to PyPy and have no measurable performance impact: the extra checks on the type, if any, are all constant-folded by the JIT. A bient?t, Armin. From arigo at tunes.org Tue Sep 10 16:15:56 2013 From: arigo at tunes.org (Armin Rigo) Date: Tue, 10 Sep 2013 16:15:56 +0200 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <522F21CF.4060609@gmail.com> References: <20130910112832.75ed6c8b@pitrou.net> <522F21CF.4060609@gmail.com> Message-ID: Hi Richard, On Tue, Sep 10, 2013 at 3:42 PM, Richard Oudkerk wrote: > I guess another example is creating an "identity dict" (see > http://code.activestate.com/lists/python-ideas/7161/) by doing > > d = transformdict(id) This is bogus, because only the id will be stored, and the original key object will be forgotten (and its id probably reused). A bient?t, Armin. From eliben at gmail.com Tue Sep 10 16:18:41 2013 From: eliben at gmail.com (Eli Bendersky) Date: Tue, 10 Sep 2013 07:18:41 -0700 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130910142258.02c148dd@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> <20130910142258.02c148dd@pitrou.net> Message-ID: On Tue, Sep 10, 2013 at 5:22 AM, Antoine Pitrou wrote: > Le Tue, 10 Sep 2013 22:00:37 +1000, > Nick Coghlan a ?crit : > > Is this just syntactic sugar for recursive lookup of a transformed > > version in __missing__? > > Nope. For one, it doesn't use __missing__ at all. I think > using __missing__ would be... missing the point, because it wouldn't > working properly if you have e.g. X != Y such that transform(X) == Y > and transform(Y) == X. > > (a simple example being transform = str.swapcase :-)) > > > Or a way of supplying a custom "key" function > > to a dictionary? > > Probably, although I'm not entirely sure what you mean by that :-) > > > Any such proposal should consider how it composes with other dict > > variants like defaultdict, OrderedDict and counter. > > Well, one sticking point here is that those variants don't compose with > each other already :-) > But, yes, I may make another proposal with composition in mind. > Does anyone have an idea how to make the existing variants more composable? It would be nice to get a better understanding of this before we add another variant. Conceptually, composability makes a lot of sense (what if we want this transformdict but also in insertion order...) Eli -------------- next part -------------- An HTML attachment was scrubbed... URL: From solipsis at pitrou.net Tue Sep 10 16:37:19 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Tue, 10 Sep 2013 16:37:19 +0200 Subject: [Python-Dev] Add a "transformdict" to collections References: <20130910112832.75ed6c8b@pitrou.net> <20130910142258.02c148dd@pitrou.net> Message-ID: <20130910163719.0c07be69@pitrou.net> Le Tue, 10 Sep 2013 07:18:41 -0700, Eli Bendersky a ?crit : > On Tue, Sep 10, 2013 at 5:22 AM, Antoine Pitrou > wrote: > > > Le Tue, 10 Sep 2013 22:00:37 +1000, > > Nick Coghlan a ?crit : > > > Is this just syntactic sugar for recursive lookup of a transformed > > > version in __missing__? > > > > Nope. For one, it doesn't use __missing__ at all. I think > > using __missing__ would be... missing the point, because it wouldn't > > working properly if you have e.g. X != Y such that transform(X) == Y > > and transform(Y) == X. > > > > (a simple example being transform = str.swapcase :-)) > > > > > Or a way of supplying a custom "key" function > > > to a dictionary? > > > > Probably, although I'm not entirely sure what you mean by that :-) > > > > > Any such proposal should consider how it composes with other dict > > > variants like defaultdict, OrderedDict and counter. > > > > Well, one sticking point here is that those variants don't compose > > with each other already :-) > > But, yes, I may make another proposal with composition in mind. > > > > Does anyone have an idea how to make the existing variants more > composable? It would be nice to get a better understanding of this > before we add another variant. Conceptually, composability makes a > lot of sense (what if we want this transformdict but also in > insertion order...) AFAICT, the main problem with composability is that the implementation is less simple and it removes many opportunities for optimization. It may or may not be a problem, depending on your use cases. (I'm playing a bit with a TransformMap which is a composable version of transformdict, and it's clear the implementation is less amenable to optimization tweaks and shortcuts: in fact, I have to *add* some logic to e.g. cater with defaultdict) Regards Antoine. From solipsis at pitrou.net Tue Sep 10 16:37:57 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Tue, 10 Sep 2013 16:37:57 +0200 Subject: [Python-Dev] Add a "transformdict" to collections References: <20130910112832.75ed6c8b@pitrou.net> <522F21CF.4060609@gmail.com> Message-ID: <20130910163757.30288824@pitrou.net> Le Tue, 10 Sep 2013 16:15:56 +0200, Armin Rigo a ?crit : > Hi Richard, > > On Tue, Sep 10, 2013 at 3:42 PM, Richard Oudkerk > wrote: > > I guess another example is creating an "identity dict" (see > > http://code.activestate.com/lists/python-ideas/7161/) by doing > > > > d = transformdict(id) > > This is bogus, because only the id will be stored, and the original > key object will be forgotten (and its id probably reused). No, the original key is kept as well. Regards Antoine. From ethan at stoneleaf.us Tue Sep 10 16:00:17 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Tue, 10 Sep 2013 07:00:17 -0700 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <522F1A24.5030808@avl.com> References: <20130910112832.75ed6c8b@pitrou.net> <522F1A24.5030808@avl.com> Message-ID: <522F25F1.4030104@stoneleaf.us> On 09/10/2013 06:09 AM, Hrvoje Niksic wrote: > On 09/10/2013 02:24 PM, Paul Moore wrote: >>>>> td['FOO'] = 42 >>>>> td['foo'] = 32 >>>>> list(td.keys()) >> >> ['FOO'] or ['foo']? Both answers are justifiable. > > Note that the same question can be reasonably asked for dict itself: > >>>> d = {} >>>> d[1.0] = 'foo' >>>> d[1] = 'bar' >>>> d > {1.0: 'bar'} > > So, dict.__setitem__ only replaces the value, leaving the original key in place. transformdict should probably do the > same, returning 'FOO' in your example. +1 From solipsis at pitrou.net Tue Sep 10 16:54:38 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Tue, 10 Sep 2013 16:54:38 +0200 Subject: [Python-Dev] Add a "transformdict" to collections References: <20130910112832.75ed6c8b@pitrou.net> <522F1A24.5030808@avl.com> Message-ID: <20130910165438.297d71bc@pitrou.net> Le Tue, 10 Sep 2013 15:09:56 +0200, Hrvoje Niksic a ?crit : > On 09/10/2013 02:24 PM, Paul Moore wrote: > >>>> td['FOO'] = 42 > >>>> td['foo'] = 32 > >>>> list(td.keys()) > > > > ['FOO'] or ['foo']? Both answers are justifiable. > > Note that the same question can be reasonably asked for dict itself: > > >>> d = {} > >>> d[1.0] = 'foo' > >>> d[1] = 'bar' > >>> d > {1.0: 'bar'} > > So, dict.__setitem__ only replaces the value, leaving the original > key in place. transformdict should probably do the same, returning > 'FOO' in your example. It's not that obvious. It's not common to rely on that aspect of dict semantics, because you will usually lookup using the exact same type, not a compatible one. I would expect very little code, if any, to rely on this. (also, I would intuitively expect the latest key to be held, not the first one, since that's what happens for values.) Regards Antoine. From corbellini.andrea at gmail.com Tue Sep 10 11:37:01 2013 From: corbellini.andrea at gmail.com (Andrea Corbellini) Date: Tue, 10 Sep 2013 11:37:01 +0200 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130910112832.75ed6c8b@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> Message-ID: On Tue, Sep 10, 2013 at 11:28 AM, Antoine Pitrou wrote: > Therefore I propose adding the general pattern. Simple example: > > >>> d = transformdict(str.lower) > >>> d['Foo'] = 5 > >>> d['foo'] > 5 > >>> d['FOO'] > 5 > >>> list(d) > ['Foo'] > > (case-insensitive but case-preserving, as the best filesystems are ;-)) Just a nitpick: if this example (or a similar one) gets into the documentation, it would be better to replace str.lower() with str.casefold(). From shibturn at gmail.com Tue Sep 10 15:42:39 2013 From: shibturn at gmail.com (Richard Oudkerk) Date: Tue, 10 Sep 2013 14:42:39 +0100 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130910112832.75ed6c8b@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> Message-ID: <522F21CF.4060609@gmail.com> On 10/09/2013 10:28am, Antoine Pitrou wrote: > Therefore I propose adding the general pattern. Simple example: > > >>> d = transformdict(str.lower) > >>> d['Foo'] = 5 > >>> d['foo'] > 5 > >>> d['FOO'] > 5 > >>> list(d) > ['Foo'] I guess another example is creating an "identity dict" (see http://code.activestate.com/lists/python-ideas/7161/) by doing d = transformdict(id) -- Richard From shibturn at gmail.com Tue Sep 10 16:40:55 2013 From: shibturn at gmail.com (Richard Oudkerk) Date: Tue, 10 Sep 2013 15:40:55 +0100 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> <522F21CF.4060609@gmail.com> Message-ID: <522F2F77.9020805@gmail.com> On 10/09/2013 3:15pm, Armin Rigo wrote: > Hi Richard, > > On Tue, Sep 10, 2013 at 3:42 PM, Richard Oudkerk wrote: >> I guess another example is creating an "identity dict" (see >> http://code.activestate.com/lists/python-ideas/7161/) by doing >> >> d = transformdict(id) > > This is bogus, because only the id will be stored, and the original > key object will be forgotten (and its id probably reused). Seems to work for me: >>> import collections >>> d = collections.transformdict(id) >>> L = [1,2,3] >>> d[L] = None >>> L in d True >>> [1,2,3] in d False >>> print(d[L]) None >>> d._data {41444136: ([1, 2, 3], None)} >>> list(d) [[1, 2, 3]] However __repr__() is broken: >>> d Traceback (most recent call last): File "", line 1, in File "C:\Repos\cpython-dirty\lib\collections\abc.py", line 444, in __repr__ return '{0.__class__.__name__}({0._mapping!r})'.format(self) File "C:\Repos\cpython-dirty\lib\collections\__init__.py", line 944, in __repr__ self._transform, repr(dict(self))) TypeError: unhashable type: 'list' -- Richard From zhangpeipei812 at outlook.com Tue Sep 10 12:58:32 2013 From: zhangpeipei812 at outlook.com (=?gb2312?B?1cXF5cXl?=) Date: Tue, 10 Sep 2013 18:58:32 +0800 Subject: [Python-Dev] IOCP (I/O Completion Port) in Python ? Message-ID: Hello: I wondering why there is no standard IOCP module in Python ? As I know: Python3 have support epoll in linux and kqueue in freebsd. Is there a plan to add IOCP module for Windows ? Regards! peipei From guido at python.org Tue Sep 10 17:08:20 2013 From: guido at python.org (Guido van Rossum) Date: Tue, 10 Sep 2013 08:08:20 -0700 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: <522EC878.6080409@g.nevcal.com> References: <5228C00F.7000209@jcea.es> <522EC878.6080409@g.nevcal.com> Message-ID: Why do several posts in this thread have an Unsubscribe link that tries to unsubscribe me from the list? (I saw one by Glen, and another one by Donald Stufft.) (Come to think of it, what's the point of having an Unbub link in ever message that goes out?) On Tue, Sep 10, 2013 at 12:21 AM, Glenn Linderman wrote: > On 9/6/2013 10:22 AM, Dan Callahan wrote: > > On 9/5/13 12:31 PM, Jesus Cea wrote: > > I have big hopes for Mozilla Persona, looking forward > Python infrastructure support :). > > > Hi, I'm the project lead on Persona signin, and I spoke at PyCon earlier > this year regarding why and how Mozilla is building Persona. If you'd like > some more background, that video [0] is worth a look. > > Let's pull this discussion up a level: > > It sounds like many people (Jesus, Donald, Toshio, Barry, Tres, Dirkjan, > etc.) are interested in seeing Persona on Python.org properties, and most > of the objections coming from a place of "Persona hasn't gone viral, what > if this is wasted effort?" > > > OK, let's pull this discussion down a level: testing it out. > > So I tried to login to the crossword.thetimes.co.uk -- I used an email > address persona had never seen, it asked me for a password, and sent me a > confirmation message, containing a link that I clicked on. > > However, as I was reading clues and filling in blanks, I got a popup that > said "login failure [object Object]". And crossword told me it was saving > locally, and to login to save to the server. And the Log in button stayed > displayed, rather than a Log out button, which I assume it might get > replaced with if I ever get successfully logged in. > > Firefox 23.0.1, Windows 7 64-bit with autoupdates. Need any other info? > Write me privately if you want the email address I used (not the one I use > here), or the password. I used new ones, so I can share for testing, and > then discard them and use different ones "for real". If the system actually > works. Hey, the video demos looked great... > > Glenn > > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/guido%40python.org > > -- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: From guido at python.org Tue Sep 10 17:11:05 2013 From: guido at python.org (Guido van Rossum) Date: Tue, 10 Sep 2013 08:11:05 -0700 Subject: [Python-Dev] IOCP (I/O Completion Port) in Python ? In-Reply-To: References: Message-ID: One will come with Tulip (http://code.google.com/p/tulip/), assuming we can get PEP 3156 accepted at least as "experimental" and the core Tulip code in the stdlib. At the moment the IOCP code there is pretty specialized for use with Tulip -- but if you want to help extracting the IOCP code from there for inclusion into the stdlib that would be great! On Tue, Sep 10, 2013 at 3:58 AM, ??? wrote: > Hello: > I wondering why there is no standard IOCP module in Python ? > As I know: Python3 have support epoll in linux and kqueue in freebsd. > Is there a plan to add IOCP module for Windows ? > > Regards! > peipei > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/guido%40python.org > -- --Guido van Rossum (python.org/~guido) -------------- next part -------------- An HTML attachment was scrubbed... URL: From v+python at g.nevcal.com Tue Sep 10 17:29:52 2013 From: v+python at g.nevcal.com (Glenn Linderman) Date: Tue, 10 Sep 2013 08:29:52 -0700 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: References: <5228C00F.7000209@jcea.es> <522EC878.6080409@g.nevcal.com> Message-ID: <522F3AF0.8020300@g.nevcal.com> On 9/10/2013 8:08 AM, Guido van Rossum wrote: > Why do several posts in this thread have an Unsubscribe link that > tries to unsubscribe me from the list? (I saw one by Glen, and another > one by Donald Stufft.) Seems to be in all of them. Probably added by the mailing list software. Why don't you always see it? Possibly a combination of being directly listed as a recipient, so that you get a copy not sent through the mailing list, together with an email client that suppresses the duplicates (if the mailing list software doesn't change the Message-Id:). But since heretofore you haven't participated in this thread, if you don't see the Unsub link in all of this thread, I doubt this is the explanation. You message to which I'm replying is the first in this thread that came directly to me and which doesn't have the link, because you addressed me directly. Use Reply-List rather than Reply-All if your MUA supports that. > (Come to think of it, what's the point of having an Unbub link in ever > message that goes out?) To avoid people that accidentally subscribe from asking how to unsubscribe, perhaps. -------------- next part -------------- An HTML attachment was scrubbed... URL: From barry at python.org Tue Sep 10 17:41:34 2013 From: barry at python.org (Barry Warsaw) Date: Tue, 10 Sep 2013 11:41:34 -0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: References: <5228C00F.7000209@jcea.es> <522EC878.6080409@g.nevcal.com> Message-ID: <20130910114134.1015365d@anarchist> On Sep 10, 2013, at 08:08 AM, Guido van Rossum wrote: >Why do several posts in this thread have an Unsubscribe link that tries to >unsubscribe me from the list? (I saw one by Glen, and another one by Donald >Stufft.) This is way off topic, but I suspect your original response didn't trim your little unsub footer and they didn't trim it from their responses. Looking at my list copy of *this* message, I see my own unsub footer, but my MUA automatically trims it in my response buffer. OTOH, I always try to trim my responses anyway, which I think is good netiquette, and which is easy for me with Emacs as my edit/composer of messages. >(Come to think of it, what's the point of having an Unbub link in ever >message that goes out?) As a general Mailman feature, it decreases the likelihood that laypeople who want off a mailing list will do bad things to unsub because they can't figure out how to do it, like complain back to the list or the admins, spam block, or worse, report the list as spam. All of which and more we've seen in the wild. Adding the footer with the unsub block doesn't eliminate this, because some people are lazy, stressed, mean, or frustrated, but it does reduce the incidences. Now, whether it's appropriate for a highly technical list like python-dev is up for discussion (but maybe not here?). While messages are personalized on this list (meaning, you get a unique copy of it for bounce tracking, and yes unsub personalization), those unsub stanzas cannot currently be disabled on a per-user basis. -Barry From ethan at stoneleaf.us Tue Sep 10 16:59:22 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Tue, 10 Sep 2013 07:59:22 -0700 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130910165438.297d71bc@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> <522F1A24.5030808@avl.com> <20130910165438.297d71bc@pitrou.net> Message-ID: <522F33CA.6000909@stoneleaf.us> On 09/10/2013 07:54 AM, Antoine Pitrou wrote: > Le Tue, 10 Sep 2013 15:09:56 +0200, > Hrvoje Niksic a ?crit : >> On 09/10/2013 02:24 PM, Paul Moore wrote: >>>>>> td['FOO'] = 42 >>>>>> td['foo'] = 32 >>>>>> list(td.keys()) >>> >>> ['FOO'] or ['foo']? Both answers are justifiable. >> >> Note that the same question can be reasonably asked for dict itself: >> >> >>> d = {} >> >>> d[1.0] = 'foo' >> >>> d[1] = 'bar' >> >>> d >> {1.0: 'bar'} >> >> So, dict.__setitem__ only replaces the value, leaving the original >> key in place. transformdict should probably do the same, returning >> 'FOO' in your example. > > It's not that obvious. It's not common to rely on that aspect of dict > semantics, because you will usually lookup using the exact same type, > not a compatible one. I would expect very little code, if any, to rely > on this. > > (also, I would intuitively expect the latest key to be held, not the > first one, since that's what happens for values.) Whether there is a bunch of code that relies on this behavior is irrelevant. That behavior is already in place, and having another dict that is just the opposite will only lead to more confusion, not less. -- ~Ethan~ From rymg19 at gmail.com Tue Sep 10 17:26:00 2013 From: rymg19 at gmail.com (Ryan Gonzalez) Date: Tue, 10 Sep 2013 10:26:00 -0500 Subject: [Python-Dev] [RELEASED] Python 3.4.0a2 In-Reply-To: References: <522DB8D3.1030803@hastings.org> Message-ID: MS Windows is on a steep decline? I mean, I know Windows 8 isn't the most popular thing on the planet, but...Windows itself? If anything would be rising, I'd still prefer it to be either Linux or Haiku. On Tue, Sep 10, 2013 at 12:48 AM, Stefan Behnel wrote: > Ned Deily, 09.09.2013 21:29: > > 3.4.0a2 also contains a new batteries-included feature for OS X > > users. The python.org 64-bit/32-bit installer now includes its own > > private version of Tcl/Tk 8.5.14 so it is finally no longer necessary to > > install a third-party version of Tcl/Tk 8.5 to workaround the > > problematic system versions shipped in OS X 10.6+. More improvements to > > come. > > With MS Windows on steep decline, I'm so happy we have at least MacOS-X > rising to keep us busy. > > Stefan > > > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/rymg19%40gmail.com > -- Ryan -------------- next part -------------- An HTML attachment was scrubbed... URL: From donald.stufft at gmail.com Tue Sep 10 17:28:25 2013 From: donald.stufft at gmail.com (Donald Stufft) Date: Tue, 10 Sep 2013 11:28:25 -0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: References: <5228C00F.7000209@jcea.es> <522EC878.6080409@g.nevcal.com> Message-ID: On Sep 10, 2013, at 11:08 AM, Guido van Rossum wrote: > Why do several posts in this thread have an Unsubscribe link that tries to unsubscribe me from the list? (I saw one by Glen, and another one by Donald Stufft.) > > (Come to think of it, what's the point of having an Unbub link in ever message that goes out?) All posts should have that. It's possible your mail client is collapsing it in some cases though because it looks like quoted text. > > > On Tue, Sep 10, 2013 at 12:21 AM, Glenn Linderman wrote: > On 9/6/2013 10:22 AM, Dan Callahan wrote: >> On 9/5/13 12:31 PM, Jesus Cea wrote: >>> I have big hopes for Mozilla Persona, looking forward >>> Python infrastructure support :). >> >> Hi, I'm the project lead on Persona signin, and I spoke at PyCon earlier this year regarding why and how Mozilla is building Persona. If you'd like some more background, that video [0] is worth a look. >> >> Let's pull this discussion up a level: >> >> It sounds like many people (Jesus, Donald, Toshio, Barry, Tres, Dirkjan, etc.) are interested in seeing Persona on Python.org properties, and most of the objections coming from a place of "Persona hasn't gone viral, what if this is wasted effort?" > > OK, let's pull this discussion down a level: testing it out. > > So I tried to login to the crossword.thetimes.co.uk -- I used an email address persona had never seen, it asked me for a password, and sent me a confirmation message, containing a link that I clicked on. > > However, as I was reading clues and filling in blanks, I got a popup that said "login failure [object Object]". And crossword told me it was saving locally, and to login to save to the server. And the Log in button stayed displayed, rather than a Log out button, which I assume it might get replaced with if I ever get successfully logged in. > > Firefox 23.0.1, Windows 7 64-bit with autoupdates. Need any other info? Write me privately if you want the email address I used (not the one I use here), or the password. I used new ones, so I can share for testing, and then discard them and use different ones "for real". If the system actually works. Hey, the video demos looked great... > > Glenn > > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/guido%40python.org > > > > > -- > --Guido van Rossum (python.org/~guido) ----------------- Donald Stufft PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: Message signed with OpenPGP using GPGMail URL: From janzert at janzert.com Tue Sep 10 17:54:20 2013 From: janzert at janzert.com (Janzert) Date: Tue, 10 Sep 2013 11:54:20 -0400 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130910165438.297d71bc@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> <522F1A24.5030808@avl.com> <20130910165438.297d71bc@pitrou.net> Message-ID: On 9/10/2013 10:54 AM, Antoine Pitrou wrote: > (also, I would intuitively expect the latest key to be held, not the > first one, since that's what happens for values.) > > Regards > > Antoine. > I intuitively expected, and I think most often would want, the first key to be held. The reason being that I would except most often the initial insertion to be the canonical form. Whichever way is adopted, I think even if you say it's implementation specific, people will end up relying on it in their code. Janzert From phd at phdru.name Tue Sep 10 18:03:35 2013 From: phd at phdru.name (Oleg Broytman) Date: Tue, 10 Sep 2013 20:03:35 +0400 Subject: [Python-Dev] Offtopic: OpenID Providers In-Reply-To: References: <5228C00F.7000209@jcea.es> <522EC878.6080409@g.nevcal.com> Message-ID: <20130910160335.GA3093@iskra.aviel.ru> On Tue, Sep 10, 2013 at 11:28:25AM -0400, Donald Stufft wrote: > On Sep 10, 2013, at 11:08 AM, Guido van Rossum wrote: > > Why do several posts in this thread have an Unsubscribe link that tries to unsubscribe me from the list? (I saw one by Glen, and another one by Donald Stufft.) > > > > (Come to think of it, what's the point of having an Unbub link in ever message that goes out?) > > All posts should have that. It's possible your mail client is collapsing it in some cases though because it looks like quoted text. When a mail message is all plain/text Mailman simply inline the stance into the text. When a message is a complex tree of MIME parts (like the message I'm replying to) Mailman append the stance to the end of the message as another MIME part. Some MUAs could ignore that part -- they neither show the part nor include it in replies. Mine (mutt) shows it and includes in replies anyway, I always trim it myself. Oleg. -- Oleg Broytman http://phdru.name/ phd at phdru.name Programmers don't die, they just GOSUB without RETURN. From v+python at g.nevcal.com Tue Sep 10 17:58:43 2013 From: v+python at g.nevcal.com (Glenn Linderman) Date: Tue, 10 Sep 2013 08:58:43 -0700 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> <522F1A24.5030808@avl.com> <20130910165438.297d71bc@pitrou.net> Message-ID: <522F41B3.9020608@g.nevcal.com> On 9/10/2013 8:54 AM, Janzert wrote: > > I intuitively expected, and I think most often would want, the first > key to be held. My intuition matches yours, but my thoughts are that it should be changeable by specific request. -------------- next part -------------- An HTML attachment was scrubbed... URL: From eric at trueblade.com Tue Sep 10 18:12:43 2013 From: eric at trueblade.com (Eric V. Smith) Date: Tue, 10 Sep 2013 12:12:43 -0400 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> <522F1A24.5030808@avl.com> <20130910165438.297d71bc@pitrou.net> Message-ID: <522F44FB.8040408@trueblade.com> On 09/10/2013 11:54 AM, Janzert wrote: > On 9/10/2013 10:54 AM, Antoine Pitrou wrote: >> (also, I would intuitively expect the latest key to be held, not the >> first one, since that's what happens for values.) >> >> Regards >> >> Antoine. >> > > I intuitively expected, and I think most often would want, the first key > to be held. The reason being that I would except most often the initial > insertion to be the canonical form. My stock ticker example (but from a real problem I had a few days ago) would want to have this example: I want the first key, because I'm pre-seeding the dict with a variety of keys that are of the canonical form. > Whichever way is adopted, I think even if you say it's implementation > specific, people will end up relying on it in their code. Agreed. Eric. From nigel at nigelsmall.com Tue Sep 10 17:21:18 2013 From: nigel at nigelsmall.com (Nigel Small) Date: Tue, 10 Sep 2013 16:21:18 +0100 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <522F2F77.9020805@gmail.com> References: <20130910112832.75ed6c8b@pitrou.net> <522F21CF.4060609@gmail.com> <522F2F77.9020805@gmail.com> Message-ID: Could a more generic variant of this class work? In the same way that `sorted` can accept a comparison function, similar could be done for a dictionary-like class: d = transformdict(key=str.lower) Strictly speaking, this would provide case-insensitive but not case-preserving behaviour. For any given use case, though, a function could instead be supplied to "normalise" the key (upper, lower, title case, etc) in a way that fits that case. I can't think of many real cases where multiple types of capitalisation would be useful within the same dictionary. Nigel On 10 September 2013 15:40, Richard Oudkerk wrote: > On 10/09/2013 3:15pm, Armin Rigo wrote: > >> Hi Richard, >> >> On Tue, Sep 10, 2013 at 3:42 PM, Richard Oudkerk >> wrote: >> >>> I guess another example is creating an "identity dict" (see >>> http://code.activestate.com/**lists/python-ideas/7161/) >>> by doing >>> >>> d = transformdict(id) >>> >> >> This is bogus, because only the id will be stored, and the original >> key object will be forgotten (and its id probably reused). >> > > Seems to work for me: > > >>> import collections > >>> d = collections.transformdict(id) > >>> L = [1,2,3] > >>> d[L] = None > >>> L in d > True > >>> [1,2,3] in d > False > >>> print(d[L]) > None > >>> d._data > {41444136: ([1, 2, 3], None)} > >>> list(d) > [[1, 2, 3]] > > However __repr__() is broken: > > >>> d > Traceback (most recent call last): > File "", line 1, in > File "C:\Repos\cpython-dirty\lib\**collections\abc.py", line 444, in > __repr__ > return '{0.__class__.__name__}({0._**mapping!r})'.format(self) > File "C:\Repos\cpython-dirty\lib\**collections\__init__.py", line 944, > in __repr__ > self._transform, repr(dict(self))) > TypeError: unhashable type: 'list' > > -- > Richard > > ______________________________**_________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/**mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/**mailman/options/python-dev/** > nigel%40nigelsmall.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From shibturn at gmail.com Tue Sep 10 19:09:30 2013 From: shibturn at gmail.com (Richard Oudkerk) Date: Tue, 10 Sep 2013 18:09:30 +0100 Subject: [Python-Dev] IOCP (I/O Completion Port) in Python ? In-Reply-To: References: Message-ID: <522F524A.6000800@gmail.com> On 10/09/2013 11:58am, ??? wrote: > Hello: > I wondering why there is no standard IOCP module in Python ? > As I know: Python3 have support epoll in linux and kqueue in freebsd. > Is there a plan to add IOCP module for Windows ? _winapi does have some undocumented support for IOCP (used only by multiprocessing), but the APIs are not very nice and should not be considered stable. (Also _winapi.ReadFile(), _winapi.WriteFile() only support pipes or sockets, not disk-based files where you also have to control file-position.) -- Richard From shibturn at gmail.com Tue Sep 10 19:09:30 2013 From: shibturn at gmail.com (Richard Oudkerk) Date: Tue, 10 Sep 2013 18:09:30 +0100 Subject: [Python-Dev] IOCP (I/O Completion Port) in Python ? In-Reply-To: References: Message-ID: <522F524A.6000800@gmail.com> On 10/09/2013 11:58am, ??? wrote: > Hello: > I wondering why there is no standard IOCP module in Python ? > As I know: Python3 have support epoll in linux and kqueue in freebsd. > Is there a plan to add IOCP module for Windows ? _winapi does have some undocumented support for IOCP (used only by multiprocessing), but the APIs are not very nice and should not be considered stable. (Also _winapi.ReadFile(), _winapi.WriteFile() only support pipes or sockets, not disk-based files where you also have to control file-position.) -- Richard From rdmurray at bitdance.com Tue Sep 10 20:28:00 2013 From: rdmurray at bitdance.com (R. David Murray) Date: Tue, 10 Sep 2013 14:28:00 -0400 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> <522F21CF.4060609@gmail.com> <522F2F77.9020805@gmail.com> Message-ID: <20130910182800.6A0112507A2@webabinitio.net> On Tue, 10 Sep 2013 16:21:18 +0100, Nigel Small wrote: > Could a more generic variant of this class work? In the same way that > `sorted` can accept a comparison function, similar could be done for a > dictionary-like class: > > d = transformdict(key=str.lower) > > Strictly speaking, this would provide case-insensitive but not > case-preserving behaviour. For any given use case, though, a function could > instead be supplied to "normalise" the key (upper, lower, title case, etc) > in a way that fits that case. I can't think of many real cases where > multiple types of capitalisation would be useful within the same dictionary. I can: MIME-Version Message-ID Content-Type For network protocols you really do want to *preserve* the case. --David From solipsis at pitrou.net Tue Sep 10 20:31:40 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Tue, 10 Sep 2013 20:31:40 +0200 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <522F1411.8010109@v.loewis.de> References: <20130910112832.75ed6c8b@pitrou.net> <20130910143558.5677b55a@pitrou.net> <522F1411.8010109@v.loewis.de> Message-ID: <20130910203140.1e8c1008@fsol> On Tue, 10 Sep 2013 14:44:01 +0200 "Martin v. L?wis" wrote: > Am 10.09.13 14:35, schrieb Antoine Pitrou: > >> ['FOO'] or ['foo']? Both answers are justifiable. Both are possibly > >> even useful depending on context... > > > > I think it would be best to leave it as an implementation detail, > > because whichever is easiest to implement depends on the exact > > implementation choices (e.g. C vs. Python). > > I think this is the point where the datatype is *not* clearly > straight-forward, and thus deserves a PEP. Not saying you're necessary wrong, but a few data points: - defaultdict was added without a PEP: http://bugs.python.org/issue1433928 - Counter was added without a PEP: http://bugs.python.org/issue1696199 - ChainMap was added without a PEP: http://bugs.python.org/issue11089 http://bugs.python.org/issue11297 - namedtuple was added without a PEP: https://mail.python.org/pipermail/python-dev/2007-February/071196.html (no tracker reference for its addition) OrderedDict, however, came with a PEP: http://www.python.org/dev/peps/pep-0372/ > I think it would be a flaw to have this detail implementation-defined. > This would be like saying that it is implementation-defined which > of A,B,C is returned from "A and B and C" if all are true. Ok, it seems everyone (except me :-)) agrees that it should return the first key value, so that's how it will be. Regards Antoine. From p.f.moore at gmail.com Tue Sep 10 21:08:56 2013 From: p.f.moore at gmail.com (Paul Moore) Date: Tue, 10 Sep 2013 20:08:56 +0100 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130910203140.1e8c1008@fsol> References: <20130910112832.75ed6c8b@pitrou.net> <20130910143558.5677b55a@pitrou.net> <522F1411.8010109@v.loewis.de> <20130910203140.1e8c1008@fsol> Message-ID: On 10 September 2013 19:31, Antoine Pitrou wrote: >> I think it would be a flaw to have this detail implementation-defined. >> This would be like saying that it is implementation-defined which >> of A,B,C is returned from "A and B and C" if all are true. > > Ok, it seems everyone (except me :-)) agrees that it should return the > first key value, so that's how it will be. If you retain the first key value, it's easy enough for the application to implement "retain the last" semantics: try: del d[k] finally: d[k] = v If you provide "retain the last", I can't see any obvious way of implementing "retain the first" in application code without in effect reimplementing the class. Paul From python at mrabarnett.plus.com Tue Sep 10 21:59:56 2013 From: python at mrabarnett.plus.com (MRAB) Date: Tue, 10 Sep 2013 20:59:56 +0100 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> <20130910143558.5677b55a@pitrou.net> <522F1411.8010109@v.loewis.de> <20130910203140.1e8c1008@fsol> Message-ID: <522F7A3C.1040701@mrabarnett.plus.com> On 10/09/2013 20:08, Paul Moore wrote: > On 10 September 2013 19:31, Antoine Pitrou wrote: >>> I think it would be a flaw to have this detail implementation-defined. >>> This would be like saying that it is implementation-defined which >>> of A,B,C is returned from "A and B and C" if all are true. >> >> Ok, it seems everyone (except me :-)) agrees that it should return the >> first key value, so that's how it will be. > > If you retain the first key value, it's easy enough for the > application to implement "retain the last" semantics: > > try: > del d[k] > finally: > d[k] = v > That would raise a KeyError is the key was missing. A better way is: d.pop(k, None) d[k] = v > If you provide "retain the last", I can't see any obvious way of > implementing "retain the first" in application code without in effect > reimplementing the class. > "Retain the first" does feel more natural to me. From lukas.lueg at gmail.com Tue Sep 10 22:36:18 2013 From: lukas.lueg at gmail.com (Lukas Lueg) Date: Tue, 10 Sep 2013 22:36:18 +0200 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <522F7A3C.1040701@mrabarnett.plus.com> References: <20130910112832.75ed6c8b@pitrou.net> <20130910143558.5677b55a@pitrou.net> <522F1411.8010109@v.loewis.de> <20130910203140.1e8c1008@fsol> <522F7A3C.1040701@mrabarnett.plus.com> Message-ID: Should'nt the key'ing behaviour be controlled by the type of the key instead of the type of the container? 2013/9/10 MRAB > On 10/09/2013 20:08, Paul Moore wrote: > >> On 10 September 2013 19:31, Antoine Pitrou wrote: >> >>> I think it would be a flaw to have this detail implementation-defined. >>>> This would be like saying that it is implementation-defined which >>>> of A,B,C is returned from "A and B and C" if all are true. >>>> >>> >>> Ok, it seems everyone (except me :-)) agrees that it should return the >>> first key value, so that's how it will be. >>> >> >> If you retain the first key value, it's easy enough for the >> application to implement "retain the last" semantics: >> >> try: >> del d[k] >> finally: >> d[k] = v >> >> That would raise a KeyError is the key was missing. A better way is: > > d.pop(k, None) > > d[k] = v > > If you provide "retain the last", I can't see any obvious way of >> implementing "retain the first" in application code without in effect >> reimplementing the class. >> >> "Retain the first" does feel more natural to me. > > ______________________________**_________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/**mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/**mailman/options/python-dev/** > lukas.lueg%40gmail.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jsbueno at python.org.br Tue Sep 10 22:38:26 2013 From: jsbueno at python.org.br (Joao S. O. Bueno) Date: Tue, 10 Sep 2013 17:38:26 -0300 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> <20130910143558.5677b55a@pitrou.net> <522F1411.8010109@v.loewis.de> <20130910203140.1e8c1008@fsol> Message-ID: On 10 September 2013 16:08, Paul Moore wrote: > If you provide "retain the last", I can't see any obvious way of > implementing "retain the first" in application code without in effect > reimplementing the class. Which reminds one - this class should obviously have a method for retrivieng the original key value, given a matching key - d.canonical('foo') -> 'Foo' From solipsis at pitrou.net Tue Sep 10 23:06:07 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Tue, 10 Sep 2013 23:06:07 +0200 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> <20130910143558.5677b55a@pitrou.net> <522F1411.8010109@v.loewis.de> <20130910203140.1e8c1008@fsol> Message-ID: <20130910230607.701bba16@fsol> On Tue, 10 Sep 2013 17:38:26 -0300 "Joao S. O. Bueno" wrote: > On 10 September 2013 16:08, Paul Moore wrote: > > If you provide "retain the last", I can't see any obvious way of > > implementing "retain the first" in application code without in effect > > reimplementing the class. > > Which reminds one - this class should obviously have a method for > retrivieng the original key value, given a matching key - > > d.canonical('foo') -> 'Foo' I don't know. Is there any use case? (sure, it is trivially implemented) Regards Antoine. From p.f.moore at gmail.com Tue Sep 10 23:12:51 2013 From: p.f.moore at gmail.com (Paul Moore) Date: Tue, 10 Sep 2013 22:12:51 +0100 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <522F7A3C.1040701@mrabarnett.plus.com> References: <20130910112832.75ed6c8b@pitrou.net> <20130910143558.5677b55a@pitrou.net> <522F1411.8010109@v.loewis.de> <20130910203140.1e8c1008@fsol> <522F7A3C.1040701@mrabarnett.plus.com> Message-ID: On 10 September 2013 20:59, MRAB wrote: >> try: >> del d[k] >> finally: >> d[k] = v >> > That would raise a KeyError is the key was missing. A better way is: > > d.pop(k, None) Sorry, I was thinking of try...except: pass. But pop is indeed better. Teach me to code stuff on the fly without testing :-) Paul From ethan at stoneleaf.us Tue Sep 10 23:17:24 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Tue, 10 Sep 2013 14:17:24 -0700 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> <20130910143558.5677b55a@pitrou.net> <522F1411.8010109@v.loewis.de> <20130910203140.1e8c1008@fsol> <522F7A3C.1040701@mrabarnett.plus.com> Message-ID: <522F8C64.1080005@stoneleaf.us> On 09/10/2013 01:36 PM, Lukas Lueg wrote: > > Should'nt the key'ing behaviour be controlled by the type of the key instead of the type of the container? That would be up to the key function. -- ~Ethan~ From jsbueno at python.org.br Tue Sep 10 23:44:20 2013 From: jsbueno at python.org.br (Joao S. O. Bueno) Date: Tue, 10 Sep 2013 18:44:20 -0300 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130910230607.701bba16@fsol> References: <20130910112832.75ed6c8b@pitrou.net> <20130910143558.5677b55a@pitrou.net> <522F1411.8010109@v.loewis.de> <20130910203140.1e8c1008@fsol> <20130910230607.701bba16@fsol> Message-ID: On 10 September 2013 18:06, Antoine Pitrou wrote: > On Tue, 10 Sep 2013 17:38:26 -0300 > "Joao S. O. Bueno" wrote: >> On 10 September 2013 16:08, Paul Moore wrote: >> > If you provide "retain the last", I can't see any obvious way of >> > implementing "retain the first" in application code without in effect >> > reimplementing the class. >> >> Which reminds one - this class should obviously have a method for >> retrivieng the original key value, given a matching key - >> >> d.canonical('foo') -> 'Foo' > > I don't know. Is there any use case? > (sure, it is trivially implemented) Well, I'd expect it to simply be there. I had not thought of other usecases for the transformdict itself - but if I would use it and would need the original key without such a method it would not be trivial to get it. For example, in latim languages it is common to want accented letters to match their unaccented counterparts - pick my own first name "Jo?o" - if I'd use a transform to strip the diactriticals, and have an user input "joao" - it would match, as intended - but I would not be able to retrieve the accented version without re-implementing the class behavior. js -><- > > Regards > > Antoine. > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/jsbueno%40python.org.br From solipsis at pitrou.net Tue Sep 10 23:46:59 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Tue, 10 Sep 2013 23:46:59 +0200 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> <20130910143558.5677b55a@pitrou.net> <522F1411.8010109@v.loewis.de> <20130910203140.1e8c1008@fsol> <20130910230607.701bba16@fsol> Message-ID: <20130910234659.39284dab@fsol> On Tue, 10 Sep 2013 18:44:20 -0300 "Joao S. O. Bueno" wrote: > On 10 September 2013 18:06, Antoine Pitrou wrote: > > On Tue, 10 Sep 2013 17:38:26 -0300 > > "Joao S. O. Bueno" wrote: > >> On 10 September 2013 16:08, Paul Moore wrote: > >> > If you provide "retain the last", I can't see any obvious way of > >> > implementing "retain the first" in application code without in effect > >> > reimplementing the class. > >> > >> Which reminds one - this class should obviously have a method for > >> retrivieng the original key value, given a matching key - > >> > >> d.canonical('foo') -> 'Foo' > > > > I don't know. Is there any use case? > > (sure, it is trivially implemented) > > > Well, I'd expect it to simply be there. I had not thought of > other usecases for the transformdict itself - Well, it is not here for dict, set, etc. > For example, in latim languages it is common to want > accented letters to match their unaccented counterparts > - pick my own first name "Jo?o" - if I'd use a transform to strip > the diactriticals, and have an user input "joao" - it would match, > as intended - but I would not be able to retrieve the accented version > without re-implementing the class behavior. Interesting example, thanks. Regards Antoine. From python at mrabarnett.plus.com Wed Sep 11 00:12:56 2013 From: python at mrabarnett.plus.com (MRAB) Date: Tue, 10 Sep 2013 23:12:56 +0100 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130910234659.39284dab@fsol> References: <20130910112832.75ed6c8b@pitrou.net> <20130910143558.5677b55a@pitrou.net> <522F1411.8010109@v.loewis.de> <20130910203140.1e8c1008@fsol> <20130910230607.701bba16@fsol> <20130910234659.39284dab@fsol> Message-ID: <522F9968.5030108@mrabarnett.plus.com> On 10/09/2013 22:46, Antoine Pitrou wrote: > On Tue, 10 Sep 2013 18:44:20 -0300 > "Joao S. O. Bueno" wrote: >> On 10 September 2013 18:06, Antoine Pitrou wrote: >> > On Tue, 10 Sep 2013 17:38:26 -0300 >> > "Joao S. O. Bueno" wrote: >> >> On 10 September 2013 16:08, Paul Moore wrote: >> >> > If you provide "retain the last", I can't see any obvious way of >> >> > implementing "retain the first" in application code without in effect >> >> > reimplementing the class. >> >> >> >> Which reminds one - this class should obviously have a method for >> >> retrivieng the original key value, given a matching key - >> >> >> >> d.canonical('foo') -> 'Foo' >> > >> > I don't know. Is there any use case? >> > (sure, it is trivially implemented) >> >> Well, I'd expect it to simply be there. I had not thought of >> other usecases for the transformdict itself - > I had the same thought. > Well, it is not here for dict, set, etc. > In those cases the key in the dict == the key you're looking for. >> For example, in latim languages it is common to want >> accented letters to match their unaccented counterparts >> - pick my own first name "Jo?o" - if I'd use a transform to strip >> the diactriticals, and have an user input "joao" - it would match, >> as intended - but I would not be able to retrieve the accented version >> without re-implementing the class behavior. > > Interesting example, thanks. > From ethan at stoneleaf.us Wed Sep 11 00:18:05 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Tue, 10 Sep 2013 15:18:05 -0700 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <522F9968.5030108@mrabarnett.plus.com> References: <20130910112832.75ed6c8b@pitrou.net> <20130910143558.5677b55a@pitrou.net> <522F1411.8010109@v.loewis.de> <20130910203140.1e8c1008@fsol> <20130910230607.701bba16@fsol> <20130910234659.39284dab@fsol> <522F9968.5030108@mrabarnett.plus.com> Message-ID: <522F9A9D.9010008@stoneleaf.us> On 09/10/2013 03:12 PM, MRAB wrote: > On 10/09/2013 22:46, Antoine Pitrou wrote: >> On Tue, 10 Sep 2013 18:44:20 -0300 >> "Joao S. O. Bueno" wrote: >>> On 10 September 2013 18:06, Antoine Pitrou wrote: >>> > On Tue, 10 Sep 2013 17:38:26 -0300 >>> > "Joao S. O. Bueno" wrote: >>> >> On 10 September 2013 16:08, Paul Moore wrote: >>> >> > If you provide "retain the last", I can't see any obvious way of >>> >> > implementing "retain the first" in application code without in effect >>> >> > reimplementing the class. >>> >> >>> >> Which reminds one - this class should obviously have a method for >>> >> retrivieng the original key value, given a matching key - >>> >> >>> >> d.canonical('foo') -> 'Foo' >>> > >>> > I don't know. Is there any use case? >>> > (sure, it is trivially implemented) >>> >>> Well, I'd expect it to simply be there. I had not thought of >>> other usecases for the transformdict itself - >> > I had the same thought. > >> Well, it is not here for dict, set, etc. >> > In those cases the key in the dict == the key you're looking for. With the exception of numbers, of course (float vs int vs Decimal, etc.). But if that distinction was useful for someone they could use this new TransformDict. :) -- ~Ethan~ From eric at trueblade.com Wed Sep 11 02:26:55 2013 From: eric at trueblade.com (Eric V. Smith) Date: Tue, 10 Sep 2013 20:26:55 -0400 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <522F9A9D.9010008@stoneleaf.us> References: <20130910112832.75ed6c8b@pitrou.net> <20130910143558.5677b55a@pitrou.net> <522F1411.8010109@v.loewis.de> <20130910203140.1e8c1008@fsol> <20130910230607.701bba16@fsol> <20130910234659.39284dab@fsol> <522F9968.5030108@mrabarnett.plus.com> <522F9A9D.9010008@stoneleaf.us> Message-ID: <522FB8CF.5020400@trueblade.com> On 9/10/2013 6:18 PM, Ethan Furman wrote: > On 09/10/2013 03:12 PM, MRAB wrote: >> On 10/09/2013 22:46, Antoine Pitrou wrote: >>> On Tue, 10 Sep 2013 18:44:20 -0300 >>> "Joao S. O. Bueno" wrote: >>>> On 10 September 2013 18:06, Antoine Pitrou wrote: >>>> > On Tue, 10 Sep 2013 17:38:26 -0300 >>>> > "Joao S. O. Bueno" wrote: >>>> >> On 10 September 2013 16:08, Paul Moore wrote: >>>> >> > If you provide "retain the last", I can't see any obvious way of >>>> >> > implementing "retain the first" in application code without in >>>> effect >>>> >> > reimplementing the class. >>>> >> >>>> >> Which reminds one - this class should obviously have a method for >>>> >> retrivieng the original key value, given a matching key - >>>> >> >>>> >> d.canonical('foo') -> 'Foo' >>>> > >>>> > I don't know. Is there any use case? >>>> > (sure, it is trivially implemented) >>>> >>>> Well, I'd expect it to simply be there. I had not thought of >>>> other usecases for the transformdict itself - >>> >> I had the same thought. >> >>> Well, it is not here for dict, set, etc. >>> >> In those cases the key in the dict == the key you're looking for. > > With the exception of numbers, of course (float vs int vs Decimal, etc.). They'd still be ==, wouldn't they? -- Eric. From v+python at g.nevcal.com Wed Sep 11 03:15:33 2013 From: v+python at g.nevcal.com (Glenn Linderman) Date: Tue, 10 Sep 2013 18:15:33 -0700 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130910234659.39284dab@fsol> References: <20130910112832.75ed6c8b@pitrou.net> <20130910143558.5677b55a@pitrou.net> <522F1411.8010109@v.loewis.de> <20130910203140.1e8c1008@fsol> <20130910230607.701bba16@fsol> <20130910234659.39284dab@fsol> Message-ID: <522FC435.20405@g.nevcal.com> On 9/10/2013 2:46 PM, Antoine Pitrou wrote: >>>> > >>Which reminds one - this class should obviously have a method for >>>> > >>retrivieng the original key value, given a matching key - >>>> > >> >>>> > >>d.canonical('foo') -> 'Foo' >>> > > >>> > >I don't know. Is there any use case? >>> > >(sure, it is trivially implemented) >> > >> > >> >Well, I'd expect it to simply be there. I had not thought of >> >other usecases for the transformdict itself - > Well, it is not here for dict, set, etc. But they don't change the keys (although numbers have different representations on occasion). One use of transformdict might be to allow use of non-hashable items as keys, by extracting an actual key from the internals of the non-hashable item. The key may be sufficiently unique to enable use of the dict structure for lookups, but it would certainly be handy to obtain the actual item again. Without a canonical lookup feature, one would be forced to also include the key as part of the value, or some such hack. I also thought Jo?o's example was a very practical reason to have the canonical lookup feature, by some name or another. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ethan at stoneleaf.us Wed Sep 11 03:19:20 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Tue, 10 Sep 2013 18:19:20 -0700 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <522FB8CF.5020400@trueblade.com> References: <20130910112832.75ed6c8b@pitrou.net> <20130910143558.5677b55a@pitrou.net> <522F1411.8010109@v.loewis.de> <20130910203140.1e8c1008@fsol> <20130910230607.701bba16@fsol> <20130910234659.39284dab@fsol> <522F9968.5030108@mrabarnett.plus.com> <522F9A9D.9010008@stoneleaf.us> <522FB8CF.5020400@trueblade.com> Message-ID: <522FC518.6060604@stoneleaf.us> On 09/10/2013 05:26 PM, Eric V. Smith wrote: > On 9/10/2013 6:18 PM, Ethan Furman wrote: >> On 09/10/2013 03:12 PM, MRAB wrote: >>> On 10/09/2013 22:46, Antoine Pitrou wrote: >>>> On Tue, 10 Sep 2013 18:44:20 -0300 >>>> "Joao S. O. Bueno" wrote: >>>>> On 10 September 2013 18:06, Antoine Pitrou wrote: >>>>>> On Tue, 10 Sep 2013 17:38:26 -0300 >>>>>> "Joao S. O. Bueno" wrote: >>>>>>> On 10 September 2013 16:08, Paul Moore wrote: >>>>>>>> If you provide "retain the last", I can't see any obvious way of >>>>>>>> implementing "retain the first" in application code without in >>>>> effect >>>>>>>> reimplementing the class. >>>>>>> >>>>>>> Which reminds one - this class should obviously have a method for >>>>>>> retrivieng the original key value, given a matching key - >>>>>>> >>>>>>> d.canonical('foo') -> 'Foo' >>>>>> >>>>>> I don't know. Is there any use case? >>>>>> (sure, it is trivially implemented) >>>>> >>>>> Well, I'd expect it to simply be there. I had not thought of >>>>> other usecases for the transformdict itself - >>>> >>> I had the same thought. >>> >>>> Well, it is not here for dict, set, etc. >>>> >>> In those cases the key in the dict == the key you're looking for. >> >> With the exception of numbers, of course (float vs int vs Decimal, etc.). > > They'd still be ==, wouldn't they? Yes, but for presentation purposes not identical. -- ~Ethan~ From jsbueno at python.org.br Wed Sep 11 04:25:03 2013 From: jsbueno at python.org.br (Joao S. O. Bueno) Date: Tue, 10 Sep 2013 23:25:03 -0300 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130910234659.39284dab@fsol> References: <20130910112832.75ed6c8b@pitrou.net> <20130910143558.5677b55a@pitrou.net> <522F1411.8010109@v.loewis.de> <20130910203140.1e8c1008@fsol> <20130910230607.701bba16@fsol> <20130910234659.39284dab@fsol> Message-ID: On 10 September 2013 18:46, Antoine Pitrou wrote: > On Tue, 10 Sep 2013 18:44:20 -0300 > "Joao S. O. Bueno" wrote: >> On 10 September 2013 18:06, Antoine Pitrou wrote: >> > On Tue, 10 Sep 2013 17:38:26 -0300 >> > "Joao S. O. Bueno" wrote: >> >> On 10 September 2013 16:08, Paul Moore wrote: >> >> > If you provide "retain the last", I can't see any obvious way of >> >> > implementing "retain the first" in application code without in effect >> >> > reimplementing the class. >> >> >> >> Which reminds one - this class should obviously have a method for >> >> retrivieng the original key value, given a matching key - >> >> >> >> d.canonical('foo') -> 'Foo' >> > >> > I don't know. Is there any use case? >> > (sure, it is trivially implemented) >> >> >> Well, I'd expect it to simply be there. I had not thought of >> other usecases for the transformdict itself - > > Well, it is not here for dict, set, etc. For the simple motive that once you retrieve or find that an element is contained in one of these classes, you already have the canonical key. :-) > >> For example, in latim languages it is common to want >> accented letters to match their unaccented counterparts >> - pick my own first name "Jo?o" - if I'd use a transform to strip >> the diactriticals, and have an user input "joao" - it would match, >> as intended - but I would not be able to retrieve the accented version >> without re-implementing the class behavior. > > Interesting example, thanks. > > Regards > > Antoine. > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/jsbueno%40python.org.br From raymond.hettinger at gmail.com Wed Sep 11 04:40:36 2013 From: raymond.hettinger at gmail.com (Raymond Hettinger) Date: Tue, 10 Sep 2013 21:40:36 -0500 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130910112832.75ed6c8b@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> Message-ID: <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> On Sep 10, 2013, at 4:28 AM, Antoine Pitrou wrote: > In http://bugs.python.org/issue18986 I proposed adding a new mapping > type to the collections module. I would *really* like for this to start outside the standard library. It needs to mature with user feedback before being dumped in the collections module (which was never intended to be a giant pile of every collection a person could think of). Adding yet more dictionary variants is an example of way-too-many-ways-to-do-it. Raymond -------------- next part -------------- An HTML attachment was scrubbed... URL: From solipsis at pitrou.net Wed Sep 11 10:27:32 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Wed, 11 Sep 2013 10:27:32 +0200 Subject: [Python-Dev] Add a "transformdict" to collections References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> Message-ID: <20130911102732.2cb268ca@pitrou.net> Le Tue, 10 Sep 2013 21:40:36 -0500, Raymond Hettinger a ?crit : > > On Sep 10, 2013, at 4:28 AM, Antoine Pitrou > wrote: > > > In http://bugs.python.org/issue18986 I proposed adding a new mapping > > type to the collections module. > > I would *really* like for this to start outside the standard library. From a quick search: - case-insensitive dicts (use cases and implementation attempts): http://twistedmatrix.com/documents/current/api/twisted.python.util.InsensitiveDict.html https://mail.python.org/pipermail/python-list/2013-May/647243.html https://mail.python.org/pipermail/python-list/2005-April/296208.html https://mail.python.org/pipermail/python-list/2004-June/241748.html http://bugs.python.org/msg197376 http://stackoverflow.com/a/2082169 http://stackoverflow.com/a/3296782 http://code.activestate.com/recipes/66315-case-insensitive-dictionary/ https://gist.github.com/babakness/3901174 http://www.wikier.org/blog/key-insensitive-dictionary-in-python http://en.sharejs.com/python/14534 http://www.voidspace.org.uk/python/archive.shtml#caseless - identity dicts: https://mail.python.org/pipermail/python-ideas/2010-May/007235.html http://www.gossamer-threads.com/lists/python/python/209527 Python's own pickle module: http://hg.python.org/cpython/file/0e70bf1f32a3/Lib/pickle.py#l234 > It needs to mature with user feedback before being dumped > in the collections module (which was never intended to be a > giant pile of every collection a person could think of). Well, thanks for the reminder, I was *indeed* going to dump all the collections I could think of in the collections module :-) (that would have been embarassing!) Seriously, I'm curious: what needs to mature, according to you? The proposed collection is a plain MutableMapping with the single addition of transforming the key on lookup. The use cases are well-defined and well-known. If you have any concrete questions or concerns then please offer them here. > Adding yet more dictionary variants is an example of > way-too-many-ways-to-do-it. So what is your proposal for what is definitely (see examples above, and this thread's and the tracker's responses) a very common need? Keep letting people write suboptimal, incomplete, buggy versions of the same thing? Thanks Antoine. From storchaka at gmail.com Wed Sep 11 11:38:13 2013 From: storchaka at gmail.com (Serhiy Storchaka) Date: Wed, 11 Sep 2013 12:38:13 +0300 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130910112832.75ed6c8b@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> Message-ID: There is a question about specifying the transform function. There are three ways to do this: 1. Positional argument of the constructor. d = TransformDict(str.casefold, Foo=5) 2. Subclassing. class CaseInsensitiveDict(TransformDict): def transform(self, key): return key.casefold() d = CaseInsensitiveDict(Foo=5) 3. Type generator. d = TransformDict(str.casefold)(Foo=5) Second method looks a little simpler to me from implementation side (What if you call __init__ for already initialized object? What if you used the object before calling __init__?). Third method allows you to customize other aspects of dict behavior (combine OrderedDict, defaultdict,..). First method looks less cumbersome from user side at first look. But how many different transform functions you use? Aren't they deserve named classes? From solipsis at pitrou.net Wed Sep 11 11:52:59 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Wed, 11 Sep 2013 11:52:59 +0200 Subject: [Python-Dev] Add a "transformdict" to collections References: <20130910112832.75ed6c8b@pitrou.net> Message-ID: <20130911115259.57be1a82@pitrou.net> Le Wed, 11 Sep 2013 12:38:13 +0300, Serhiy Storchaka a ?crit : > 2. Subclassing. > > class CaseInsensitiveDict(TransformDict): > def transform(self, key): > return key.casefold() > d = CaseInsensitiveDict(Foo=5) I thought about this first, and then I remembered that python-dev isn't generally very keen on subclassing-based APIs :-) > 3. Type generator. > > d = TransformDict(str.casefold)(Foo=5) > [...] > > Third method allows you to customize other aspects of dict behavior > (combine OrderedDict, defaultdict,..). Well, no, it's not that easy. Especially since OrderedDict and defaultdict weren't written with combination in mind. Regards Antoine. From storchaka at gmail.com Wed Sep 11 12:09:36 2013 From: storchaka at gmail.com (Serhiy Storchaka) Date: Wed, 11 Sep 2013 13:09:36 +0300 Subject: [Python-Dev] Need testing audio files Message-ID: I work on enhancement of audio modules testing [1], and I need free (in both senses) small sample audio files in different formats. We already have audiotest.au (mono, and sunau has a bug in processing multichannel files [2]) and Sine-1000Hz-300ms.aif, but this is not enough. I have generated a pack of files like Sine-1000Hz-300ms.aif by Python, it is enough for regression testing but only if current implementation is correct. I found some collections of sample files at [3], but I'm not sure about copyright, and perhaps they are a little too big. In ideal it should be one high-quality (float64?) multichannel (5+1?) but short master file and it's lower-quality copies made by third-party tools. In ideal the content should be related to Python. [1] http://bugs.python.org/issue18919 [2] http://bugs.python.org/issue18950 [3] http://www-mmsp.ece.mcgill.ca/documents/AudioFormats/ From storchaka at gmail.com Wed Sep 11 12:37:53 2013 From: storchaka at gmail.com (Serhiy Storchaka) Date: Wed, 11 Sep 2013 13:37:53 +0300 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130911115259.57be1a82@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> <20130911115259.57be1a82@pitrou.net> Message-ID: 11.09.13 12:52, Antoine Pitrou ???????(??): > Le Wed, 11 Sep 2013 12:38:13 +0300, > Serhiy Storchaka a ?crit : >> 2. Subclassing. >> >> class CaseInsensitiveDict(TransformDict): >> def transform(self, key): >> return key.casefold() >> d = CaseInsensitiveDict(Foo=5) > > I thought about this first, and then I remembered that python-dev isn't > generally very keen on subclassing-based APIs :-) Why? This way looks most natural to me. >> 3. Type generator. >> >> d = TransformDict(str.casefold)(Foo=5) >> > [...] >> >> Third method allows you to customize other aspects of dict behavior >> (combine OrderedDict, defaultdict,..). > > Well, no, it's not that easy. Especially since OrderedDict and > defaultdict weren't written with combination in mind. They can be rewritten. Actually the defaultdict is just simple wrapper around existing functionality of the __missing__ method. We can add the __transform__ method directly in the dict class. I think it will significant (2-3x) decrease a size of needed C code (no need in defining new type with constructors/destructors/etc, only lookup_transform). From solipsis at pitrou.net Wed Sep 11 13:07:15 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Wed, 11 Sep 2013 13:07:15 +0200 Subject: [Python-Dev] Add a "transformdict" to collections References: <20130910112832.75ed6c8b@pitrou.net> <20130911115259.57be1a82@pitrou.net> Message-ID: <20130911130715.2f834a21@pitrou.net> Le Wed, 11 Sep 2013 13:37:53 +0300, Serhiy Storchaka a ?crit : > > Actually the defaultdict is just simple wrapper around existing > functionality of the __missing__ method. We can add the __transform__ > method directly in the dict class. I think it will significant (2-3x) > decrease a size of needed C code (no need in defining new type with > constructors/destructors/etc, only lookup_transform). Right now I am not proposing any C implementation of TransformDict. That could be added, but it's not what I'm pushing for here :-) But I don't think the "type generator" API would be easier to implement in C, anyway. Regards Antoine. From skip at pobox.com Wed Sep 11 13:08:25 2013 From: skip at pobox.com (Skip Montanaro) Date: Wed, 11 Sep 2013 06:08:25 -0500 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130911102732.2cb268ca@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> Message-ID: > Seriously, I'm curious: what needs to mature, according to you? In my mind, its availability on PyPI along with demonstrated use in the wild (plus corresponding votes to demonstrate that people use/like it) would help. That you can find several implementations at this doesn't mean it's necessarily worth adding to the std lib. Once in, it is very difficult to evict something that is later deemed not to have belonged in the std lib, so I think some extra scrutiny is worthwhile. Is there some obvious advantage to having a single API for this available to all Python applications? Are the semantics well-defined (do all the implementations you cited offer basically the same semantics)? The discussion so far here suggest that the best semantics might not be completely settled. (I still don't care for the name. "Transform" != "case folding" in my mind. A quick scan of your links suggests most people think something like "cidict" or "CaseInsensitiveDict" would be more descriptive.) Skip From storchaka at gmail.com Wed Sep 11 13:23:21 2013 From: storchaka at gmail.com (Serhiy Storchaka) Date: Wed, 11 Sep 2013 14:23:21 +0300 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130911130715.2f834a21@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> <20130911115259.57be1a82@pitrou.net> <20130911130715.2f834a21@pitrou.net> Message-ID: 11.09.13 14:07, Antoine Pitrou ???????(??): > But I don't think the "type generator" API would be easier to implement > in C, anyway. No, I mean subclassing approach. From rdmurray at bitdance.com Wed Sep 11 13:57:06 2013 From: rdmurray at bitdance.com (R. David Murray) Date: Wed, 11 Sep 2013 07:57:06 -0400 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> Message-ID: <20130911115706.C2D98250925@webabinitio.net> On Wed, 11 Sep 2013 06:08:25 -0500, Skip Montanaro wrote: > > Seriously, I'm curious: what needs to mature, according to you? > > In my mind, its availability on PyPI along with demonstrated use in > the wild (plus corresponding votes to demonstrate that people use/like > it) would help. That you can find several implementations at this > doesn't mean it's necessarily worth adding to the std lib. Once in, it > is very difficult to evict something that is later deemed not to have > belonged in the std lib, so I think some extra scrutiny is worthwhile. The problem is that it is hard to get traction on pypi for a "small" feature like this. Most people will just implement a special purpose version that solves their specific need (possibly in a somewhat broken fashion) rather than add yet another dependency. Our approach in cases like this has (I think) been to learn from the existing implementations and build our own based on that (isn't that what happened with OrderedDict?) > Is there some obvious advantage to having a single API for this > available to all Python applications? Are the semantics well-defined > (do all the implementations you cited offer basically the same > semantics)? The discussion so far here suggest that the best semantics > might not be completely settled. I think the only question was what happens to the key on assignment, and that has been settled. Well, I guess there's also a question of how you create one, but that's not a question a pypi version would be any help in resolving: we'd still bikeshed it upon addition to the stdlib. In fact, I would not be surprised if *all* of the bikeshedding we are doing now (except this bit :) would take place if an existing pypi module for this were proposed for addition. I think the bigger question is composition of different dict types, and that is again something that isn't going to be solved by a pypi module. > (I still don't care for the name. "Transform" != "case folding" in my > mind. A quick scan of your links suggests most people think something > like "cidict" or "CaseInsensitiveDict" would be more descriptive.) Except it is wider than that: the transform function can be anything, not just case folding. I suggested surjectiondict or ontodict, but Antoine didn't like those :) (I had to look up the terms...it's been a long time since I studied math.) --David From solipsis at pitrou.net Wed Sep 11 14:45:53 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Wed, 11 Sep 2013 14:45:53 +0200 Subject: [Python-Dev] Need testing audio files References: Message-ID: <20130911144553.17909e76@pitrou.net> Le Wed, 11 Sep 2013 13:09:36 +0300, Serhiy Storchaka a ?crit : > I work on enhancement of audio modules testing [1], and I need free > (in both senses) small sample audio files in different formats. We > already have audiotest.au (mono, and sunau has a bug in processing > multichannel files [2]) and Sine-1000Hz-300ms.aif, but this is not > enough. I have generated a pack of files like Sine-1000Hz-300ms.aif > by Python, it is enough for regression testing but only if current > implementation is correct. If you want to edit, shorten, convert sounds between different formats, you can try Audacity, a free sound editor: http://audacity.sourceforge.net/ Regards Antoine. From victor.stinner at gmail.com Wed Sep 11 14:46:06 2013 From: victor.stinner at gmail.com (Victor Stinner) Date: Wed, 11 Sep 2013 14:46:06 +0200 Subject: [Python-Dev] Need testing audio files In-Reply-To: References: Message-ID: Use your microphone, say "python" and save the file in your favorite file format. Try for example Audacity. I suppose that you don't need specific audio content and you don't need a huge file. Victor 2013/9/11 Serhiy Storchaka : > I work on enhancement of audio modules testing [1], and I need free (in both > senses) small sample audio files in different formats. We already have > audiotest.au (mono, and sunau has a bug in processing multichannel files > [2]) and Sine-1000Hz-300ms.aif, but this is not enough. I have generated a > pack of files like Sine-1000Hz-300ms.aif by Python, it is enough for > regression testing but only if current implementation is correct. > > I found some collections of sample files at [3], but I'm not sure about > copyright, and perhaps they are a little too big. > > In ideal it should be one high-quality (float64?) multichannel (5+1?) but > short master file and it's lower-quality copies made by third-party tools. > In ideal the content should be related to Python. > > [1] http://bugs.python.org/issue18919 > [2] http://bugs.python.org/issue18950 > [3] http://www-mmsp.ece.mcgill.ca/documents/AudioFormats/ > > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/victor.stinner%40gmail.com From ncoghlan at gmail.com Wed Sep 11 14:47:12 2013 From: ncoghlan at gmail.com (Nick Coghlan) Date: Wed, 11 Sep 2013 22:47:12 +1000 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130911115706.C2D98250925@webabinitio.net> References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911115706.C2D98250925@webabinitio.net> Message-ID: On 11 September 2013 21:57, R. David Murray wrote: > Except it is wider than that: the transform function can be anything, > not just case folding. > > I suggested surjectiondict or ontodict, but Antoine didn't like those :) > (I had to look up the terms...it's been a long time since I studied > math.) I'll join the chorus requesting that this live on PyPI for a while first. I think this is a case similar to what happened with contextlib.ExitStack: I'm not sure if anyone actually *used* contextlib2 for anything significant (if they did, they didn't tell me about it), but just going through the process of properly documenting, publishing and testing it as a relatively independent project forced *me* to think through the design. Add in a couple of interesting conversation with Brandon Rhodes and others about the API design, and the end result was a *vast* improvement over what originally went up on PyPI. The barriers to making use of PyPI libraries are also falling with time, so a solid implementation may still see adoption, even if it's in the form of copy-and-paste programming rather than actual dependencies. I think there are also additional API decisions to be made beyond just the one about how to declare the mapping function, related to how to get the mapped key values *out*, as well as how to find out whether or not two potential key values map to the same actual key. As my preferred bikeshed colour, I'm going to suggest "MappedKeyDict" (using a similar naming style to OrderedDict), since the purpose of the container is to map the domain of the supplied keys to a different range before doing the value lookup. Suggested additional methods: md.map_key(key) # Applies the mapping function to the supplied key md.mapped_keys() # Like keys(), but with the key mapping function applied md.mapped_items() # Like items(), but with the key mapping function applied Another (more dubious) possible method: md.same_key(key1, key2) # "md.map_key(key1) == md.map_key(key2)" Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia From solipsis at pitrou.net Wed Sep 11 15:04:23 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Wed, 11 Sep 2013 15:04:23 +0200 Subject: [Python-Dev] Add a "transformdict" to collections References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911115706.C2D98250925@webabinitio.net> Message-ID: <20130911150423.62f77bf2@pitrou.net> Le Wed, 11 Sep 2013 22:47:12 +1000, Nick Coghlan a ?crit : > > I'll join the chorus requesting that this live on PyPI for a while > first. > > I think this is a case similar to what happened with > contextlib.ExitStack: I'm not sure if anyone actually *used* > contextlib2 for anything significant (if they did, they didn't tell me > about it), but just going through the process of properly documenting, > publishing and testing it as a relatively independent project forced > *me* to think through the design. ExitStack was quite a new thing, API-wise. The proposal here is to generalize something which already exists in various forms all over the Internet, and respecting a well-known API, MutableMapping. There are not many possible APIs to create case-insensitive dicts, or identity dicts. The only API contention until now has been about whether the first or last key would be retained (which settled on the former), and Serhiy's three instantiation schemes. The additional methods you suggest may be nice to have, but they are not necessary and (deliberately) not part of the original proposal. That is, they can be grafted later on. > As my preferred bikeshed colour, I'm going to suggest "MappedKeyDict" > (using a similar naming style to OrderedDict), Ha, another colour! Thanks :-) Regards Antoine. From steve at pearwood.info Wed Sep 11 15:40:32 2013 From: steve at pearwood.info (Steven D'Aprano) Date: Wed, 11 Sep 2013 23:40:32 +1000 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> Message-ID: <20130911134032.GA16820@ando> On Wed, Sep 11, 2013 at 06:08:25AM -0500, Skip Montanaro wrote: > (I still don't care for the name. "Transform" != "case folding" in my > mind. A quick scan of your links suggests most people think something > like "cidict" or "CaseInsensitiveDict" would be more descriptive.) But the proposal is not for a case-insensitive dict. It is more general than that, with case-insensitivity just one specific use-case for such a transformative dict. Arguably the most natural, or at least obvious, such transformation, but there are others. I have code that does something like this: MAPPING = {'spam': 23, 'ham': 42, 'eggs': 17} result = MAPPING[key.strip()] # later... answer = MAPPING[key] # Oops, forgot to strip! This is broken. Using Antoine's proposal: MAPPING = TransformDict(str.strip) MAPPING.update({'spam': 23, 'ham': 42, 'eggs': 17}) result = MAPPING[key] # later... answer = MAPPING[key] # Fine now. so that the mapping handles stripping the keys, not the caller. This isn't just about strings, and certainly not just case-insensitivity. -- Steven From stephen at xemacs.org Wed Sep 11 15:50:08 2013 From: stephen at xemacs.org (Stephen J. Turnbull) Date: Wed, 11 Sep 2013 22:50:08 +0900 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130911150423.62f77bf2@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911115706.C2D98250925@webabinitio.net> <20130911150423.62f77bf2@pitrou.net> Message-ID: <87txhr79in.fsf@uwakimon.sk.tsukuba.ac.jp> Antoine Pitrou writes: > ExitStack was quite a new thing, API-wise. The proposal here is to > generalize something which already exists in various forms all over the > Internet, and respecting a well-known API, MutableMapping. What Nick said was "I was too close to the design, and time and a very few good comments greatly improved the product." That's worth considering as generic advice rather than for the specifics of the case he faced compared to yours. Which modules in the stdlib would benefit from rewriting using "transformdict"? How about on PyPI? From brett at python.org Wed Sep 11 15:54:44 2013 From: brett at python.org (Brett Cannon) Date: Wed, 11 Sep 2013 09:54:44 -0400 Subject: [Python-Dev] Need testing audio files In-Reply-To: References: Message-ID: On Wed, Sep 11, 2013 at 8:46 AM, Victor Stinner wrote: > Use your microphone, say "python" and save the file in your favorite > file format. Try for example Audacity. I suppose that you don't need > specific audio content and you don't need a huge file. > And if you don't want your voice in the test suite forever you can see if you can convince Guido to say "Python" into a microphone. -------------- next part -------------- An HTML attachment was scrubbed... URL: From steve at pearwood.info Wed Sep 11 15:56:01 2013 From: steve at pearwood.info (Steven D'Aprano) Date: Wed, 11 Sep 2013 23:56:01 +1000 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911115706.C2D98250925@webabinitio.net> Message-ID: <20130911135601.GB16820@ando> On Wed, Sep 11, 2013 at 10:47:12PM +1000, Nick Coghlan wrote: > I'll join the chorus requesting that this live on PyPI for a while first. Another alternative would be ActiveState's Python recipes: http://code.activestate.com/recipes/langs/python which is a lot lighter weight than creating a package on PyPI. I believe that ChainMap, namedtuple, groupby, lru_cache and even math.fsum started life on ActiveState. -- Steven From victor.stinner at gmail.com Wed Sep 11 15:58:35 2013 From: victor.stinner at gmail.com (Victor Stinner) Date: Wed, 11 Sep 2013 15:58:35 +0200 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130911134032.GA16820@ando> References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911134032.GA16820@ando> Message-ID: 2013/9/11 Steven D'Aprano : > But the proposal is not for a case-insensitive dict. It is more general > than that, with case-insensitivity just one specific use-case for such > a transformative dict. Arguably the most natural, or at least obvious, > such transformation, but there are others. > > I have code that does something like this: > > MAPPING = {'spam': 23, 'ham': 42, 'eggs': 17} > result = MAPPING[key.strip()] > # later... > answer = MAPPING[key] # Oops, forgot to strip! This is broken. For this use case, you should not keep the key unchanged, but it's better to store the stripped key (so MAPPING.keys() gives you the expected result). The transformdict type proposed by Antoine cannot be used for this use case. The os.environ mapping uses a subprocess of MutableMapping which accepts 4 functions: encoder/decoder for the key and encoder/decoder for the value. Such type is even more generic. transformdict cannot replace os._Environ. (Or do you prefer to store the ' eggs' key?) Victor From barry at python.org Wed Sep 11 16:10:53 2013 From: barry at python.org (Barry Warsaw) Date: Wed, 11 Sep 2013 10:10:53 -0400 Subject: [Python-Dev] Need testing audio files In-Reply-To: References: Message-ID: <20130911101053.71deed3b@anarchist> On Sep 11, 2013, at 01:09 PM, Serhiy Storchaka wrote: >In ideal it should be one high-quality (float64?) multichannel (5+1?) but >short master file and it's lower-quality copies made by third-party tools. In >ideal the content should be related to Python. I have some pro-audio recording capabilities and would be happy to generate some copyright-donated clips for Python. Please contact me off-list if needed. -Barry From phd at phdru.name Wed Sep 11 16:10:22 2013 From: phd at phdru.name (Oleg Broytman) Date: Wed, 11 Sep 2013 18:10:22 +0400 Subject: [Python-Dev] Need testing audio files In-Reply-To: References: Message-ID: <20130911141022.GA30682@iskra.aviel.ru> On Wed, Sep 11, 2013 at 09:54:44AM -0400, Brett Cannon wrote: > On Wed, Sep 11, 2013 at 8:46 AM, Victor Stinner wrote: > And if you don't want your voice in the test suite forever you can see if > you can convince Guido to say "Python" into a microphone. Wouldn't his name be enough? http://www.python.org/~guido/guido.au Oleg. -- Oleg Broytman http://phdru.name/ phd at phdru.name Programmers don't die, they just GOSUB without RETURN. From ethan at stoneleaf.us Wed Sep 11 16:04:17 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Wed, 11 Sep 2013 07:04:17 -0700 Subject: [Python-Dev] importance of dir Message-ID: <52307861.6010102@stoneleaf.us> http://docs.python.org/3/library/functions.html#dir: > > Note: Because dir() is supplied primarily as a convenience for > use at an interactive prompt [...] I suspect this comment is out of date, as there are two functions in the inspect module that rely on dir(), which also means that help indirectly relies on dir(). And we also now have the __dir__ method that we can use to customize what gets returned. > [...] more than it tries to supply a rigorously or consistently > defined set of names, [...] If this is still true, should inspect be relying on dir()? -- ~Ethan~ From solipsis at pitrou.net Wed Sep 11 16:32:23 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Wed, 11 Sep 2013 16:32:23 +0200 Subject: [Python-Dev] Add a "transformdict" to collections References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911115706.C2D98250925@webabinitio.net> <20130911150423.62f77bf2@pitrou.net> <87txhr79in.fsf@uwakimon.sk.tsukuba.ac.jp> Message-ID: <20130911163223.1334c00d@pitrou.net> Le Wed, 11 Sep 2013 22:50:08 +0900, "Stephen J. Turnbull" a ?crit : > Antoine Pitrou writes: > > > ExitStack was quite a new thing, API-wise. The proposal here is to > > generalize something which already exists in various forms all > > over the Internet, and respecting a well-known API, MutableMapping. > > What Nick said was "I was too close to the design, and time and a very > few good comments greatly improved the product." That's worth > considering as generic advice rather than for the specifics of the > case he faced compared to yours. "Time and comments" is why I'm posting a discussion thread here and waiting for responses. There are currently 34517 packages on PyPI. A new 34518th one won't magically get a lot of attention :-) (for example, I got very few comments when posting pathlib on PyPI - despite making several actual releases there -, compared to what I got from the PEP 428 discussion on python-ideas) Regards Antoine. From ethan at stoneleaf.us Wed Sep 11 16:34:32 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Wed, 11 Sep 2013 07:34:32 -0700 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911115706.C2D98250925@webabinitio.net> Message-ID: <52307F78.7050303@stoneleaf.us> On 09/11/2013 05:47 AM, Nick Coghlan wrote: > On 11 September 2013 21:57, R. David Murray wrote: >> Except it is wider than that: the transform function can be anything, >> not just case folding. >> >> I suggested surjectiondict or ontodict, but Antoine didn't like those :) >> (I had to look up the terms...it's been a long time since I studied >> math.) > > I'll join the chorus requesting that this live on PyPI for a while first. Personally, I would not add a PyPI dependency for a single object like transformdict. If we are that nervous about it we can make it provisional, but I don't see that as necessary. > I think this is a case similar to what happened with > contextlib.ExitStack: I'm not sure if anyone actually *used* > contextlib2 for anything significant (if they did, they didn't tell me > about it), but just going through the process of properly documenting, > publishing and testing it as a relatively independent project forced > *me* to think through the design. I had the opposite experience. Going through PyDev to get Enum was *far* more educational, informative, and useful than creating an independent package. Plus, transformdict is not that new or different from existing dicts, and most decisions (which key to keep? how to initialize?) can be answered by simply being consistent with what we already have. -- ~Ethan~ From ethan at stoneleaf.us Wed Sep 11 16:17:29 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Wed, 11 Sep 2013 07:17:29 -0700 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> Message-ID: <52307B79.1080002@stoneleaf.us> On 09/11/2013 02:38 AM, Serhiy Storchaka wrote: > There is a question about specifying the transform function. > > There are three ways to do this: > > 1. Positional argument of the constructor. > > d = TransformDict(str.casefold, Foo=5) This method follows the precedent of defaultdict: --> from collections import defaultdict --> l = defaultdict(list, foo=['ham','eggs']) --> l defaultdict(, {'foo': ['ham', 'eggs']}) Without a compelling reason to change, we should keep it consistent. -- ~Ethan~ From ethan at stoneleaf.us Wed Sep 11 16:27:44 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Wed, 11 Sep 2013 07:27:44 -0700 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911134032.GA16820@ando> Message-ID: <52307DE0.9040208@stoneleaf.us> On 09/11/2013 06:58 AM, Victor Stinner wrote: > 2013/9/11 Steven D'Aprano : >> But the proposal is not for a case-insensitive dict. It is more general >> than that, with case-insensitivity just one specific use-case for such >> a transformative dict. Arguably the most natural, or at least obvious, >> such transformation, but there are others. >> >> I have code that does something like this: >> >> MAPPING = {'spam': 23, 'ham': 42, 'eggs': 17} >> result = MAPPING[key.strip()] >> # later... >> answer = MAPPING[key] # Oops, forgot to strip! This is broken. > > For this use case, you should not keep the key unchanged, but it's > better to store the stripped key (so MAPPING.keys() gives you the > expected result). He isn't keeping the key unchanged (notice no white space in MAPPING), he's merely providing a function that will automatically strip the whitespace from key lookups. > The transformdict type proposed by Antoine cannot be > used for this use case. Yes, it can. --> from collections import transformdict --> MAPPING = transformdict(str.strip) --> MAPPING.update({'spam': 23, 'ham': 42, 'eggs': 17}) --> MAPPING transformdict(, {'ham': 42, 'spam': 23, 'eggs': 17}) --> MAPPING[' eggs '] 17 -- ~Ethan~ From skip at pobox.com Wed Sep 11 17:17:37 2013 From: skip at pobox.com (Skip Montanaro) Date: Wed, 11 Sep 2013 10:17:37 -0500 Subject: [Python-Dev] importance of dir In-Reply-To: <52307861.6010102@stoneleaf.us> References: <52307861.6010102@stoneleaf.us> Message-ID: >> Note: Because dir() is supplied primarily as a convenience for >> use at an interactive prompt [...] This was always my interpretation of its intent. In fact, I use a customized dir() for my own needs which would probably break inspect (elides _-prefixed functions by default, notes modules or packages within other packages which haven't been imported yet). I never realized that module used it. Skip From ethan at stoneleaf.us Wed Sep 11 16:48:56 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Wed, 11 Sep 2013 07:48:56 -0700 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911134032.GA16820@ando> Message-ID: <523082D8.2040607@stoneleaf.us> On 09/11/2013 06:58 AM, Victor Stinner wrote: > > The os.environ mapping uses a subclass of MutableMapping which > accepts 4 functions: encoder/decoder for the key and encoder/decoder > for the value. Such type is even more generic. transformdict cannot > replace os._Environ. True, it's more generic -- but is it used more often? Or often enough to have those four functions be part of transformdict instead of just the one encodekey function? (I mean the idea of os._Environ, not that specific implementation.) Personally, I wouldn't mind having all four; for one thing, the name 'transformdict' would then be entirely appropriate. ;) -- ~Ethan~ From solipsis at pitrou.net Wed Sep 11 17:48:09 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Wed, 11 Sep 2013 17:48:09 +0200 Subject: [Python-Dev] Add a "transformdict" to collections References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911134032.GA16820@ando> <523082D8.2040607@stoneleaf.us> Message-ID: <20130911174809.2c12a7d0@pitrou.net> Le Wed, 11 Sep 2013 07:48:56 -0700, Ethan Furman a ?crit : > On 09/11/2013 06:58 AM, Victor Stinner wrote: > > > > The os.environ mapping uses a subclass of MutableMapping which > > accepts 4 functions: encoder/decoder for the key and encoder/decoder > > for the value. Such type is even more generic. transformdict cannot > > replace os._Environ. > > True, it's more generic -- but is it used more often? Or often > enough to have those four functions be part of transformdict instead > of just the one encodekey function? (I mean the idea of os._Environ, > not that specific implementation.) > > Personally, I wouldn't mind having all four; for one thing, the name > 'transformdict' would then be entirely appropriate. ;) The key decoder function is quite useless since the original key is retained. As for the value encoder/decoder, I don't really see the point: just store whichever value you want to retrieve later. The main point of transformdict is that the *lookup* is done using a different key than the user-provided key. Regards Antoine. From victor.stinner at gmail.com Wed Sep 11 17:49:25 2013 From: victor.stinner at gmail.com (Victor Stinner) Date: Wed, 11 Sep 2013 17:49:25 +0200 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <52307DE0.9040208@stoneleaf.us> References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911134032.GA16820@ando> <52307DE0.9040208@stoneleaf.us> Message-ID: 2013/9/11 Ethan Furman : > He isn't keeping the key unchanged (notice no white space in MAPPING), he's > merely providing a function that will automatically strip the whitespace > from key lookups. transformdict keeps the key unchanged, see the first message: >>> d = transformdict(str.lower) >>> d['Foo'] = 5 >>> d['foo'] 5 >>> d['FOO'] 5 >>> list(d) ['Foo'] 'Foo' is stored as 'Foo', not as 'foo'. So for stripped keys: d=transformdict(str.strip); d[' abc ']; print(list(d)) should print "[' abc ']", not "['abc']". Is it the expected result? Victor From ethan at stoneleaf.us Wed Sep 11 18:03:18 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Wed, 11 Sep 2013 09:03:18 -0700 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911134032.GA16820@ando> <52307DE0.9040208@stoneleaf.us> Message-ID: <52309446.6070809@stoneleaf.us> On 09/11/2013 08:49 AM, Victor Stinner wrote: > 2013/9/11 Ethan Furman : >> He isn't keeping the key unchanged (notice no white space in MAPPING), he's >> merely providing a function that will automatically strip the whitespace >> from key lookups. > > transformdict keeps the key unchanged, see the first message: > > >>> d = transformdict(str.lower) > >>> d['Foo'] = 5 > >>> d['foo'] > 5 > >>> d['FOO'] > 5 > >>> list(d) > ['Foo'] > > 'Foo' is stored as 'Foo', not as 'foo'. So for stripped keys: > > d=transformdict(str.strip); d[' abc ']; print(list(d)) > > should print "[' abc ']", not "['abc']". And indeed it does: Python 3.4.0a1+ (default:833246d42825+, Aug 31 2013, 14:17:59) [GCC 4.7.3] on linux Type "help", "copyright", "credits" or "license" for more information. --> from collections import transformdict --> d=transformdict(str.strip); d[' abc '] = 42; print(list(d)) [' abc '] > Is it the expected result? Yup! :) -- ~Ethan~ From ethan at stoneleaf.us Wed Sep 11 18:04:25 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Wed, 11 Sep 2013 09:04:25 -0700 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130911174809.2c12a7d0@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911134032.GA16820@ando> <523082D8.2040607@stoneleaf.us> <20130911174809.2c12a7d0@pitrou.net> Message-ID: <52309489.6000008@stoneleaf.us> On 09/11/2013 08:48 AM, Antoine Pitrou wrote: > Le Wed, 11 Sep 2013 07:48:56 -0700, > Ethan Furman a ?crit : >> >> Personally, I wouldn't mind having all four; for one thing, the name >> 'transformdict' would then be entirely appropriate. ;) > > The key decoder function is quite useless since the original key is > retained. As for the value encoder/decoder, I don't really see the > point: just store whichever value you want to retrieve later. The main > point of transformdict is that the *lookup* is done using a different > key than the user-provided key. Very good points. I am convinced. -- ~Ethan~ From storchaka at gmail.com Wed Sep 11 17:37:24 2013 From: storchaka at gmail.com (Serhiy Storchaka) Date: Wed, 11 Sep 2013 18:37:24 +0300 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <87txhr79in.fsf@uwakimon.sk.tsukuba.ac.jp> References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911115706.C2D98250925@webabinitio.net> <20130911150423.62f77bf2@pitrou.net> <87txhr79in.fsf@uwakimon.sk.tsukuba.ac.jp> Message-ID: 11.09.13 16:50, Stephen J. Turnbull ???????(??): > Which modules in the stdlib would benefit from rewriting using > "transformdict"? How about on PyPI? At least _threading_local, cProfile, doctest, json, and perhaps future implementations of __sizeof__ for some classes would benefit from rewriting using IdentityDict. Unfortunately copy and pickle expose their replacements of IdentityDict to public and can't change them. I don't known anything about general TransformDict use cases. From storchaka at gmail.com Wed Sep 11 18:34:35 2013 From: storchaka at gmail.com (Serhiy Storchaka) Date: Wed, 11 Sep 2013 19:34:35 +0300 Subject: [Python-Dev] Need testing audio files In-Reply-To: <20130911101053.71deed3b@anarchist> References: <20130911101053.71deed3b@anarchist> Message-ID: 11.09.13 17:10, Barry Warsaw ???????(??): > I have some pro-audio recording capabilities and would be happy to generate > some copyright-donated clips for Python. Please contact me off-list if > needed. Thank you. From storchaka at gmail.com Wed Sep 11 18:00:43 2013 From: storchaka at gmail.com (Serhiy Storchaka) Date: Wed, 11 Sep 2013 19:00:43 +0300 Subject: [Python-Dev] Need testing audio files In-Reply-To: <20130911144553.17909e76@pitrou.net> References: <20130911144553.17909e76@pitrou.net> Message-ID: 11.09.13 15:45, Antoine Pitrou ???????(??): > If you want to edit, shorten, convert sounds between different formats, > you can try Audacity, a free sound editor: > http://audacity.sourceforge.net/ Yes, Audacity is great. From storchaka at gmail.com Wed Sep 11 17:45:25 2013 From: storchaka at gmail.com (Serhiy Storchaka) Date: Wed, 11 Sep 2013 18:45:25 +0300 Subject: [Python-Dev] Need testing audio files In-Reply-To: References: Message-ID: 11.09.13 15:46, Victor Stinner ???????(??): > Use your microphone, say "python" and save the file in your favorite > file format. Try for example Audacity. I suppose that you don't need > specific audio content and you don't need a huge file. My voice is even more ugly than my English. I don't want perpetuate it in Python test suite. From storchaka at gmail.com Wed Sep 11 17:47:18 2013 From: storchaka at gmail.com (Serhiy Storchaka) Date: Wed, 11 Sep 2013 18:47:18 +0300 Subject: [Python-Dev] Need testing audio files In-Reply-To: <20130911141022.GA30682@iskra.aviel.ru> References: <20130911141022.GA30682@iskra.aviel.ru> Message-ID: 11.09.13 17:10, Oleg Broytman ???????(??): > Wouldn't his name be enough? http://www.python.org/~guido/guido.au It is Lib/test/audiotest.au. 1-channel and 8-bit. No, it wouldn't enough. From martin at v.loewis.de Wed Sep 11 19:31:56 2013 From: martin at v.loewis.de (=?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?=) Date: Wed, 11 Sep 2013 19:31:56 +0200 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130911150423.62f77bf2@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911115706.C2D98250925@webabinitio.net> <20130911150423.62f77bf2@pitrou.net> Message-ID: <5230A90C.3090102@v.loewis.de> Am 11.09.13 15:04, schrieb Antoine Pitrou: > There are not many possible APIs to create case-insensitive dicts, or > identity dicts. That is certainly not true. Most obviously, you have the choice of a specialized case-mapping dict, or a generalized type that can be used for case mapping also. Does any of the referenced use cases actually use the API that you are proposing (i.e. with a key transformation function)? FWIW, I can think of yet another API for this: write a Proxy class class TransformedKey: # untested def __init__(self, original): self.original = original self.transformed = self.transform(original) def __hash__(self): return hash(self.transformed) def __eq__(self, other): return self.transformed == other.transformed def transform(self, key): raise NotImplementedError If there is then disciplined use in the form d[TransformedKey(key)] == value then you can use the existing dictionary type. Notice that this can do both case-insensitive and identity dicts (plus there are multiple choices of getting the transform function into it, as well as variations of the __eq__ implementation). There is evidence in this thread that people "grasp" case-insensitive more easily than the generalized API. For the record, I initially typed two responses into the tracker which I found to be incorrect before posting them, so I ended up posting neither. The "transformdict" type is not at all "natural", even though it may be useful. If you really want to "push" this API into 3.4, I think you will need to write a PEP, and find a PEP dictator who is willing to approve it. As you seem to dislike the idea of writing a PEP, I suggest to follow the idea of publishing it on PyPI now, and then proposing it for inclusion into 3.5. Regards, Martin From solipsis at pitrou.net Wed Sep 11 19:49:35 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Wed, 11 Sep 2013 19:49:35 +0200 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <5230A90C.3090102@v.loewis.de> References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911115706.C2D98250925@webabinitio.net> <20130911150423.62f77bf2@pitrou.net> <5230A90C.3090102@v.loewis.de> Message-ID: <20130911194935.1b116266@fsol> On Wed, 11 Sep 2013 19:31:56 +0200 "Martin v. L?wis" wrote: > Am 11.09.13 15:04, schrieb Antoine Pitrou: > > There are not many possible APIs to create case-insensitive dicts, or > > identity dicts. > > That is certainly not true. Most obviously, you have the choice of a > specialized case-mapping dict, or a generalized type that can be used > for case mapping also. Does any of the referenced use cases actually > use the API that you are proposing (i.e. with a key transformation > function)? Well, when you have a specialized need, you don't implement a generic version (*), so I don't think anybody implemented it ;-). The point of a generic API is to help replace all specialized implementations at once, rather than a small subset of them. (*) even the Twisted people don't seem to go that far > FWIW, I can think of yet another API for this: write a Proxy class > > class TransformedKey: # untested > def __init__(self, original): > self.original = original > self.transformed = self.transform(original) > def __hash__(self): > return hash(self.transformed) > def __eq__(self, other): > return self.transformed == other.transformed > def transform(self, key): > raise NotImplementedError > > If there is then disciplined use in the form > > d[TransformedKey(key)] == value The problem is "disciplined use" here. This means any consumer of your API has to know about that quirk, so it's an inferior solution. (TransformedKey could be an internal detail of the implementation, as with weak dictionaries; but as a public API it doesn't seem very desirable) > The "transformdict" type > is not at all "natural", even though it may be useful. By that token, nothing is "natural" ;-) defaultdict isn't natural, yet it went in without a PEP. However, to all persons who already had that need and responded to the proposal, the generic version *does* seem natural enough, AFAICT. Only people who've never had such a need seem to fail to "grasp" it (and I only counted one such person, but my memory may be failing me). You know, I'm not against having "only" a case-insensitive dict. But that would be less useful all the while not being significantly easier to use, so I'm not really seeing the point. > If you really want to "push" this API into 3.4, I think you will need > to write a PEP, and find a PEP dictator who is willing to approve it. > As you seem to dislike the idea of writing a PEP, I suggest to follow > the idea of publishing it on PyPI now, and then proposing it for > inclusion into 3.5. What I dislike is the idea of doing additional work because some barriers are imposed ;-). PEP or PyPI are on a similar scale here. At least a PEP would help record the various discussion details, so I'd favour that over the PyPI path. Regards Antoine. From ethan at stoneleaf.us Wed Sep 11 20:07:55 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Wed, 11 Sep 2013 11:07:55 -0700 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130911194935.1b116266@fsol> References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911115706.C2D98250925@webabinitio.net> <20130911150423.62f77bf2@pitrou.net> <5230A90C.3090102@v.loewis.de> <20130911194935.1b116266@fsol> Message-ID: <5230B17B.3000607@stoneleaf.us> On 09/11/2013 10:49 AM, Antoine Pitrou wrote: > > What I dislike is the idea of doing additional work because some > barriers are imposed ;-). PEP or PyPI are on a similar scale here. At > least a PEP would help record the various discussion details, so I'd > favour that over the PyPI path. I would think a good summary on the bug tracker would preserve the detail just fine. -- ~Ethan~ From tjreedy at udel.edu Wed Sep 11 22:04:45 2013 From: tjreedy at udel.edu (Terry Reedy) Date: Wed, 11 Sep 2013 16:04:45 -0400 Subject: [Python-Dev] Need testing audio files In-Reply-To: <20130911101053.71deed3b@anarchist> References: <20130911101053.71deed3b@anarchist> Message-ID: On 9/11/2013 10:10 AM, Barry Warsaw wrote: > On Sep 11, 2013, at 01:09 PM, Serhiy Storchaka wrote: > >> In ideal it should be one high-quality (float64?) multichannel (5+1?) but >> short master file and it's lower-quality copies made by third-party tools. In >> ideal the content should be related to Python. How about "Python is a great programming language." Long enough? > I have some pro-audio recording capabilities and would be happy to generate > some copyright-donated clips for Python. Please contact me off-list if > needed. -- Terry Jan Reedy From timothy.c.delaney at gmail.com Wed Sep 11 23:39:31 2013 From: timothy.c.delaney at gmail.com (Tim Delaney) Date: Thu, 12 Sep 2013 07:39:31 +1000 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <52309446.6070809@stoneleaf.us> References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911134032.GA16820@ando> <52307DE0.9040208@stoneleaf.us> <52309446.6070809@stoneleaf.us> Message-ID: On 12 September 2013 02:03, Ethan Furman wrote: > On 09/11/2013 08:49 AM, Victor Stinner wrote: > >> 2013/9/11 Ethan Furman : >> >>> He isn't keeping the key unchanged (notice no white space in MAPPING), >>> he's >>> merely providing a function that will automatically strip the whitespace >>> from key lookups. >>> >> >> transformdict keeps the key unchanged, see the first message: >> >> >>> d = transformdict(str.lower) >> >>> d['Foo'] = 5 >> >>> d['foo'] >> 5 >> >>> d['FOO'] >> 5 >> >>> list(d) >> ['Foo'] >> > That seems backwards to me. I would think that retrieving the keys from the dict would return the transformed keys (I'd call them canonical keys). That way there's no question about which key is stored - it's *always* the transformed key. In fact, I think this might get more traction if it were referred to as a canonicalising dictionary (bikeshedding, I know). Tim Delaney -------------- next part -------------- An HTML attachment was scrubbed... URL: From ethan at stoneleaf.us Wed Sep 11 23:56:22 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Wed, 11 Sep 2013 14:56:22 -0700 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911134032.GA16820@ando> <52307DE0.9040208@stoneleaf.us> <52309446.6070809@stoneleaf.us> Message-ID: <5230E706.2070103@stoneleaf.us> On 09/11/2013 02:39 PM, Tim Delaney wrote: > On 12 September 2013 02:03, Ethan Furman > wrote: > > On 09/11/2013 08:49 AM, Victor Stinner wrote: > > 2013/9/11 Ethan Furman >: > > He isn't keeping the key unchanged (notice no white space in MAPPING), he's > merely providing a function that will automatically strip the whitespace > from key lookups. > > > transformdict keeps the key unchanged, see the first message: > > >>> d = transformdict(str.lower) > >>> d['Foo'] = 5 > >>> d['foo'] > 5 > >>> d['FOO'] > 5 > >>> list(d) > ['Foo'] > > That seems backwards to me. I would think that retrieving the keys from the dict would return the transformed keys (I'd > call them canonical keys). That way there's no question about which key is stored - it's *always* the transformed key. At this point there is still no question: it's the first version of the key seen. For a stupid example: --> d = transformdict(str.lower) --> d['ThePyramid'] = 'Game Show' --> d['AtOnce'] = now() --> for k, v in d.items(): ... print(k, v) Imagine writing a function to get that capitalization right. > In fact, I think this might get more traction if it were referred to as a canonicalising dictionary (bikeshedding, I know). Whoa, that's way harder to spell! ;) Drop the 'ising', though, and I'm in. -- ~Ethan~ From ben+python at benfinney.id.au Thu Sep 12 01:12:36 2013 From: ben+python at benfinney.id.au (Ben Finney) Date: Thu, 12 Sep 2013 09:12:36 +1000 Subject: [Python-Dev] Need testing audio files References: Message-ID: <7w7gen2brv.fsf@benfinney.id.au> Serhiy Storchaka writes: > I work on enhancement of audio modules testing [1], and I need free > (in both senses) small sample audio files in different formats. The Internet Archive has a wide selection of free-software media, many of which have free license terms that would be suitable for inclusion in Python. I haven't used it, but appears to be a collection of sounds in the public domain. -- \ ?The whole area of [treating source code as intellectual | `\ property] is almost assuring a customer that you are not going | _o__) to do any innovation in the future.? ?Gary Barnett | Ben Finney From solipsis at pitrou.net Thu Sep 12 08:14:23 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Thu, 12 Sep 2013 08:14:23 +0200 Subject: [Python-Dev] cpython (merge 3.3 -> default): merge from 3.3 References: <3cb8QF2vy7z7Ljh@mail.python.org> Message-ID: <20130912081423.4607ea82@fsol> On Thu, 12 Sep 2013 07:57:25 +0200 (CEST) senthil.kumaran wrote: > > +<<<<<<< local > Optional argument random is a 0-argument function returning a > random float in [0.0, 1.0); if it is the default None, the > standard random.random will be used. > +======= > + Optional arg random is a 0-argument function returning a random > + float in [0.0, 1.0); by default, the standard random.random. > + > + Do not supply the 'int' argument. > +>>>>>>> other Can you fix this? Thanks Antoine. From ethan at stoneleaf.us Thu Sep 12 16:08:47 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Thu, 12 Sep 2013 07:08:47 -0700 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911134032.GA16820@ando> <52307DE0.9040208@stoneleaf.us> <52309446.6070809@stoneleaf.us> Message-ID: <5231CAEF.1080500@stoneleaf.us> On 09/11/2013 02:39 PM, Tim Delaney wrote: > > I would think that retrieving the keys from the dict would return the transformed keys (I'd > call them canonical keys). The more I think about this the more I agree. A canonicaldict with a key function that simply stored the transformed key and it's value would seem to be a lot simpler: - no need to store a separate "presentation" key - no confusion about which of the first key/last key seen is stored - no mistakes with the "first" key not being added before real data and getting the presentation key wrong Further, in order to store the non-canonical keys a separate list must be kept of the keys to preseed the canonicaldict; if we store the canonical keys a separate list must be kept for presentation purposes -- so worst case scenario we're keeping the same amount of information and best-case scenario the presentation of the keys doesn't matter and we just saved ourselves an extra data structure. -- ~Ethan~ From ronaldoussoren at mac.com Thu Sep 12 16:42:39 2013 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Thu, 12 Sep 2013 16:42:39 +0200 Subject: [Python-Dev] PEP 447: add type.__locallookup__ In-Reply-To: <0752376899dd7436f6115bfc03594574@chopin.edu.pl> References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> <522DECA3.2030709@hotpy.org> <522DF204.7040109@hotpy.org> <0752376899dd7436f6115bfc03594574@chopin.edu.pl> Message-ID: <8F0FD1DE-A8ED-40D7-878A-9A005ABDF70C@mac.com> On 9 Sep, 2013, at 20:23, Jan Kaliszewski wrote: > Is '__locallookup__' a really good name? In Python, *local* -- especially in context of *lookups* -- usually associates with locals() i.e. a namespace of a function/method execution frame or a namespace of a class, during *definition* of that class... So '__locallookup__' can be confusing. > > Why not just '__getclassattribute__' or '__classlookup__', or '__classattribute__'...? I don't particularly like __locallookup__ either, but haven't found a better name yet. "__lookup_in_class__" was the best alternative I could come up with, and that feels different than other special methods. The name in the PEP is more or less derived from _PyType_Lookup, with "local" meaning "only in this class, don't recurse in the rest of the MRO". Ronald From solipsis at pitrou.net Thu Sep 12 16:43:00 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Thu, 12 Sep 2013 16:43:00 +0200 Subject: [Python-Dev] Add a "transformdict" to collections References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911134032.GA16820@ando> <52307DE0.9040208@stoneleaf.us> <52309446.6070809@stoneleaf.us> <5231CAEF.1080500@stoneleaf.us> Message-ID: <20130912164300.5cd27a1a@pitrou.net> Le Thu, 12 Sep 2013 07:08:47 -0700, Ethan Furman a ?crit : > On 09/11/2013 02:39 PM, Tim Delaney wrote: > > > > I would think that retrieving the keys from the dict would return > > the transformed keys (I'd call them canonical keys). > > The more I think about this the more I agree. A canonicaldict with a > key function that simply stored the transformed key and it's value > would seem to be a lot simpler: And it wouldn't solve the use cases. What's the point? > Further, in order to store the non-canonical keys a separate list > must be kept of the keys to preseed the canonicaldict; Yeah, so this is totally silly. What you're basically saying is "we don't need TransformDict since people can re-implement it themselves". Regards Antoine. From duda.piotr at gmail.com Thu Sep 12 16:51:26 2013 From: duda.piotr at gmail.com (Piotr Duda) Date: Thu, 12 Sep 2013 16:51:26 +0200 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <5231CAEF.1080500@stoneleaf.us> References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911134032.GA16820@ando> <52307DE0.9040208@stoneleaf.us> <52309446.6070809@stoneleaf.us> <5231CAEF.1080500@stoneleaf.us> Message-ID: 2013/9/12 Ethan Furman : > On 09/11/2013 02:39 PM, Tim Delaney wrote: >> >> >> I would think that retrieving the keys from the dict would return the >> transformed keys (I'd >> call them canonical keys). > > > The more I think about this the more I agree. A canonicaldict with a key > function that simply stored the transformed key and it's value would seem to > be a lot simpler: > > - no need to store a separate "presentation" key > - no confusion about which of the first key/last key seen is stored > - no mistakes with the "first" key not being added before real data > and getting the presentation key wrong If original keys aren't stored then d = TransformDict(transfunc, ...) for k in d: dosomething(k, d[k]) will break if transfunc(transfunc(x)) != transfunc(x) -- ???????? ?????? From ronaldoussoren at mac.com Thu Sep 12 16:25:56 2013 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Thu, 12 Sep 2013 16:25:56 +0200 Subject: [Python-Dev] PEP 447: add type.__locallookup__ In-Reply-To: <522DECA3.2030709@hotpy.org> References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> <522DECA3.2030709@hotpy.org> Message-ID: On 9 Sep, 2013, at 17:43, Mark Shannon wrote: > I would like time to investigate this further, but at the moment I think it will either make attribute lookup poorly defined or slow. > > Of the top of my head, the problem as a I see it is basically this: > Currently, type.__getattribute__() is a fixed point in the lookup of attributes. > The proposal means that a fixed point is not reached until the cls parameter of type.__getattribute__() is either object or type, > otherwise type.__getattribute__() and type.__locallookup__ must bounce back and forth. > > This will slow down *every* attribute lookup for what is a fairly obscure use case. I did a benchmark run (see the pep for details) and that seems to indicate that the performance impact is very small, possibly because the patch keeps the attribute lookup cache used by _PyType_Lookup. Anyway, I'm glad that there is now some real discussion on the proposal. Not unsurprisingly I'd love to have this, or something simular, in 3.4. I had hoped to repost the PEP a while back with more information on how the API would affect PyObjC (code removal, performance impact), but haven't had time to move forward on that front :-( Ronald > > Cheers, > Mark. > > On 09/09/13 16:27, Guido van Rossum wrote: >> Let's just accept this PEP. It looks like a nice addition to the metaclass machinery and I don't think we'll get much more useful feedback by waiting. >> >> >> On Mon, Sep 9, 2013 at 7:30 AM, Ethan Furman > wrote: >> >> On 07/30/2013 11:17 PM, Ronald Oussoren wrote: >> >> >> And something I forgot to ask: is anyone willing to be the BDFL-Delegate for >> PEP 447? >> >> >> *Bump*. >> >> It would be nice if this could make into 3.4. >> >> -- >> ~Ethan~ >> >> _________________________________________________ >> Python-Dev mailing list >> Python-Dev at python.org >> https://mail.python.org/__mailman/listinfo/python-dev >> Unsubscribe: https://mail.python.org/__mailman/options/python-dev/__guido%40python.org >> >> >> >> >> -- >> --Guido van Rossum (python.org/~guido ) >> >> >> _______________________________________________ >> Python-Dev mailing list >> Python-Dev at python.org >> https://mail.python.org/mailman/listinfo/python-dev >> Unsubscribe: https://mail.python.org/mailman/options/python-dev/mark%40hotpy.org >> > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/ronaldoussoren%40mac.com From ethan at stoneleaf.us Thu Sep 12 17:05:44 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Thu, 12 Sep 2013 08:05:44 -0700 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130912164300.5cd27a1a@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911134032.GA16820@ando> <52307DE0.9040208@stoneleaf.us> <52309446.6070809@stoneleaf.us> <5231CAEF.1080500@stoneleaf.us> <20130912164300.5cd27a1a@pitrou.net> Message-ID: <5231D848.1090709@stoneleaf.us> On 09/12/2013 07:43 AM, Antoine Pitrou wrote: > > Yeah, so this is totally silly. What you're basically saying is "we > don't need TransformDict since people can re-implement it themselves". No, what I'm saying is that the "case-preserving" aspect of transformdict is silly. The main point of transformdict is to enable, for example, 'IBM', 'Ibm', and 'ibm' to all match up as the same key. But why? Because you don't trust the user data. And if you don't trust the user data you have to add the correct version of the key yourself before you ever process that data, which means you already have the correct version stored somewhere. -- ~Ethan~ From rdmurray at bitdance.com Thu Sep 12 17:30:49 2013 From: rdmurray at bitdance.com (R. David Murray) Date: Thu, 12 Sep 2013 11:30:49 -0400 Subject: [Python-Dev] PEP 447: add type.__locallookup__ In-Reply-To: <8F0FD1DE-A8ED-40D7-878A-9A005ABDF70C@mac.com> References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> <522DECA3.2030709@hotpy.org> <522DF204.7040109@hotpy.org> <0752376899dd7436f6115bfc03594574@chopin.edu.pl> <8F0FD1DE-A8ED-40D7-878A-9A005ABDF70C@mac.com> Message-ID: <20130912153050.3CBC0250843@webabinitio.net> On Thu, 12 Sep 2013 16:42:39 +0200, Ronald Oussoren wrote: > > On 9 Sep, 2013, at 20:23, Jan Kaliszewski wrote: > > > Is '__locallookup__' a really good name? In Python, *local* -- > > especially in context of *lookups* -- usually associates with > > locals() i.e. a namespace of a function/method execution frame or a > > namespace of a class, during *definition* of that class... So > > '__locallookup__' can be confusing. > > > > Why not just '__getclassattribute__' or '__classlookup__', or > > '__classattribute__'...? > > I don't particularly like __locallookup__ either, but haven't found a > better name yet. "__lookup_in_class__" was the best alternative I > could come up with, and that feels different than other special > methods. The name in the PEP is more or less derived from > _PyType_Lookup, with "local" meaning "only in this class, don't > recurse in the rest of the MRO". Why is __getclassattribute__ worse than __locallookup__? --David From ronaldoussoren at mac.com Thu Sep 12 16:33:12 2013 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Thu, 12 Sep 2013 16:33:12 +0200 Subject: [Python-Dev] PEP 447: add type.__locallookup__ In-Reply-To: <522E3B2E.6050605@hotpy.org> References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> <522E3B2E.6050605@hotpy.org> Message-ID: On 9 Sep, 2013, at 23:18, Mark Shannon wrote: > On 09/09/13 15:30, Ethan Furman wrote: >> On 07/30/2013 11:17 PM, Ronald Oussoren wrote: >>> >>> And something I forgot to ask: is anyone willing to be the >>> BDFL-Delegate for >>> PEP 447? >> >> *Bump*. >> >> It would be nice if this could make into 3.4. >> > > IMO, there are some issues that need to be addressed before PEP 447 should be accepted. > > 1. Is there even a problem at all, or is this just a bug in super? > Why doesn't super() respect the __getattribute__ method of the superclass? Because __getattribute__ looks in the instance __dict__ before walking the MRO, while super does not. > > 2. Is this the best way to solve the problem (if there is a problem)? > Would a __super__ special method be sufficient and less intrusive. One reason for the __locallookup__ method is to make normal and super attribute lookup more simular, adding a __super__ special method would lead to code duplication: both __getattribute__ and __super__ would either contain simular code, or would call out to a shared method anyway. > > 3. Are the proposed semantics OK? > I think they are, but very low level changes such as these can have unforeseen consequences. For example, PEP 3135 and issue 12370. > > 4. What is the performance impact. pybench really doesn't count as a benchmark. What kind of benchmark would you like to see? BTW. I ran more than pybench, I also ran the part of the performance benchmark that worked on py3k at the time. Ronald From solipsis at pitrou.net Thu Sep 12 17:40:31 2013 From: solipsis at pitrou.net (Antoine Pitrou) Date: Thu, 12 Sep 2013 17:40:31 +0200 Subject: [Python-Dev] Add a "transformdict" to collections References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911134032.GA16820@ando> <52307DE0.9040208@stoneleaf.us> <52309446.6070809@stoneleaf.us> <5231CAEF.1080500@stoneleaf.us> <20130912164300.5cd27a1a@pitrou.net> <5231D848.1090709@stoneleaf.us> Message-ID: <20130912174031.5971338f@pitrou.net> Le Thu, 12 Sep 2013 08:05:44 -0700, Ethan Furman a ?crit : > On 09/12/2013 07:43 AM, Antoine Pitrou wrote: > > > > Yeah, so this is totally silly. What you're basically saying is "we > > don't need TransformDict since people can re-implement it > > themselves". > > No, what I'm saying is that the "case-preserving" aspect of > transformdict is silly. The main point of transformdict is to > enable, for example, 'IBM', 'Ibm', and 'ibm' to all match up as the > same key. But why? Because you don't trust the user data. And if > you don't trust the user data you have to add the correct version of > the key yourself before you ever process that data, which means you > already have the correct version stored somewhere. That's assuming there is an a priori "correct" version. But there might not be any. Keeping the original key is important for different reasons depending on the use case: - for case-insensitive dicts, you want to keep the original key for presentation, logging and debugging purposes (*) - for identity dicts, the original key is mandatory because the id() value in itself is completely useless, it's just used for matching (*) For a well-known example of such behaviour, think about Windows filesystems. Regards Antoine. From rdmurray at bitdance.com Thu Sep 12 17:46:11 2013 From: rdmurray at bitdance.com (R. David Murray) Date: Thu, 12 Sep 2013 11:46:11 -0400 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <5231D848.1090709@stoneleaf.us> References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911134032.GA16820@ando> <52307DE0.9040208@stoneleaf.us> <52309446.6070809@stoneleaf.us> <5231CAEF.1080500@stoneleaf.us> <20130912164300.5cd27a1a@pitrou.net> <5231D848.1090709@stoneleaf.us> Message-ID: <20130912154611.CEDD4250843@webabinitio.net> On Thu, 12 Sep 2013 08:05:44 -0700, Ethan Furman wrote: > On 09/12/2013 07:43 AM, Antoine Pitrou wrote: > > > > Yeah, so this is totally silly. What you're basically saying is "we > > don't need TransformDict since people can re-implement it themselves". > > No, what I'm saying is that the "case-preserving" aspect of > transformdict is silly. The main point of transformdict is to enable, > for example, 'IBM', 'Ibm', and 'ibm' to all match up as the same key. > But why? Because you don't trust the user data. And if you don't > trust the user data you have to add the correct version of the key > yourself before you ever process that data, which means you already > have the correct version stored somewhere. No, in the *(original use case* (and many other use cases, such as the identity dict) we *do* trust the user data. It is more trustworthy than the key forms used to look up the data inside the program. That's the whole point. (Don't be distracted by Eric's particular use case.) But even for the general case...well, let me repost here what I said on the tracker: In our view, this data structure is for cases where the original key is the most important piece of information (about the keys). The transformation in the lookup process is entirely in the service of looking up the value paired with that original key when there is more than one possible representation of that key. It is the original key that is critical when re-serializing the data or otherwise making use of the keys for anything other than lookup. So this is about making the data structure succinctly model the problem domain, which is what OO is supposed to be good at :) --David From ethan at stoneleaf.us Thu Sep 12 17:48:22 2013 From: ethan at stoneleaf.us (Ethan Furman) Date: Thu, 12 Sep 2013 08:48:22 -0700 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130912174031.5971338f@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911134032.GA16820@ando> <52307DE0.9040208@stoneleaf.us> <52309446.6070809@stoneleaf.us> <5231CAEF.1080500@stoneleaf.us> <20130912164300.5cd27a1a@pitrou.net> <5231D848.1090709@stoneleaf.us> <20130912174031.5971338f@pitrou.net> Message-ID: <5231E246.2020507@stoneleaf.us> On 09/12/2013 08:40 AM, Antoine Pitrou wrote: > Le Thu, 12 Sep 2013 08:05:44 -0700, > Ethan Furman a ?crit : >> On 09/12/2013 07:43 AM, Antoine Pitrou wrote: >>> >>> Yeah, so this is totally silly. What you're basically saying is "we >>> don't need TransformDict since people can re-implement it >>> themselves". >> >> No, what I'm saying is that the "case-preserving" aspect of >> transformdict is silly. The main point of transformdict is to >> enable, for example, 'IBM', 'Ibm', and 'ibm' to all match up as the >> same key. But why? Because you don't trust the user data. And if >> you don't trust the user data you have to add the correct version of >> the key yourself before you ever process that data, which means you >> already have the correct version stored somewhere. > > That's assuming there is an a priori "correct" version. But there might > not be any. Keeping the original key is important for different reasons > depending on the use case: > > - for case-insensitive dicts, you want to keep the original key for > presentation, logging and debugging purposes (*) > > - for identity dicts, the original key is mandatory because the id() > value in itself is completely useless, it's just used for matching > > (*) For a well-known example of such behaviour, think about Windows > filesystems. Ah, I see. Thank you for explaining. -- ~Ethan~ From ronaldoussoren at mac.com Thu Sep 12 20:12:18 2013 From: ronaldoussoren at mac.com (Ronald Oussoren) Date: Thu, 12 Sep 2013 20:12:18 +0200 Subject: [Python-Dev] PEP 447: add type.__locallookup__ In-Reply-To: <20130912153050.3CBC0250843@webabinitio.net> References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> <522DECA3.2030709@hotpy.org> <522DF204.7040109@hotpy.org> <0752376899dd7436f6115bfc03594574@chopin.edu.pl> <8F0FD1DE-A8ED-40D7-878A-9A005ABDF70C@mac.com> <20130912153050.3CBC0250843@webabinitio.net> Message-ID: <35B9C3A0-3039-49CA-90D6-319890611618@mac.com> > On 12 sep. 2013, at 17:30, "R. David Murray" wrote: > >> On Thu, 12 Sep 2013 16:42:39 +0200, Ronald Oussoren wrote: >> >>> On 9 Sep, 2013, at 20:23, Jan Kaliszewski wrote: >>> >>> Is '__locallookup__' a really good name? In Python, *local* -- >>> especially in context of *lookups* -- usually associates with >>> locals() i.e. a namespace of a function/method execution frame or a >>> namespace of a class, during *definition* of that class... So >>> '__locallookup__' can be confusing. >>> >>> Why not just '__getclassattribute__' or '__classlookup__', or >>> '__classattribute__'...? >> >> I don't particularly like __locallookup__ either, but haven't found a >> better name yet. "__lookup_in_class__" was the best alternative I >> could come up with, and that feels different than other special >> methods. The name in the PEP is more or less derived from >> _PyType_Lookup, with "local" meaning "only in this class, don't >> recurse in the rest of the MRO". > > Why is __getclassattribute__ worse than __locallookup__? Getclassattribute feels like it is related to classmethod, or fetches an attribute of a class. The method does however fetch a value from the class that is transformed to the actual attribute value through the descriptor protocol. Ronald > > --David > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/ronaldoussoren%40mac.com From v+python at g.nevcal.com Thu Sep 12 21:15:14 2013 From: v+python at g.nevcal.com (Glenn Linderman) Date: Thu, 12 Sep 2013 12:15:14 -0700 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130912174031.5971338f@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911134032.GA16820@ando> <52307DE0.9040208@stoneleaf.us> <52309446.6070809@stoneleaf.us> <5231CAEF.1080500@stoneleaf.us> <20130912164300.5cd27a1a@pitrou.net> <5231D848.1090709@stoneleaf.us> <20130912174031.5971338f@pitrou.net> Message-ID: <523212C2.6040705@g.nevcal.com> On 9/12/2013 8:40 AM, Antoine Pitrou wrote: > Le Thu, 12 Sep 2013 08:05:44 -0700, > Ethan Furman a ?crit : >> On 09/12/2013 07:43 AM, Antoine Pitrou wrote: >>> Yeah, so this is totally silly. What you're basically saying is "we >>> don't need TransformDict since people can re-implement it >>> themselves". >> No, what I'm saying is that the "case-preserving" aspect of >> transformdict is silly. The main point of transformdict is to >> enable, for example, 'IBM', 'Ibm', and 'ibm' to all match up as the >> same key. But why? Because you don't trust the user data. And if >> you don't trust the user data you have to add the correct version of >> the key yourself before you ever process that data, which means you >> already have the correct version stored somewhere. > That's assuming there is an a priori "correct" version. But there might > not be any. Keeping the original key is important for different reasons > depending on the use case: > > - for case-insensitive dicts, you want to keep the original key for > presentation, logging and debugging purposes (*) > > - for identity dicts, the original key is mandatory because the id() > value in itself is completely useless, it's just used for matching - for dict with non-hashable key, but a transform function that can derive a hashable key from it, the presentation key value may be much more complex than the actual key value. > > (*) For a well-known example of such behaviour, think about Windows > filesystems. > > Regards > > Antoine. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From xdegaye at gmail.com Thu Sep 12 22:20:04 2013 From: xdegaye at gmail.com (Xavier de Gaye) Date: Thu, 12 Sep 2013 22:20:04 +0200 Subject: [Python-Dev] f_lineno accessors Message-ID: <523221F4.8020406@gmail.com> In issues 7238 [1], 16482 [2], 17697 [3] and 17277 [4], the line number may be incorrect when the global trace function has been removed but not the frame f_trace function. A simple test (see below) in issue 17288 [5] crashes the interpreter when setting f_lineno in a generator from a return trace function. All those issues are few months old. There is a patch at issue 17277 [4] that fixes the first 4 issues. There is also a patch for issue 17288 [5]. ###### Setting f_lineno in a generator ###### $ cat jump.py def gen(): for i in range(1): yield i lineno = 4 for i in gen(): pass $ python -m pdb jump.py > /tmp/jump.py(1)() -> def gen(): (Pdb) import sys; print(sys.version) 3.4.0a1+ (default:975d1e180689, Sep 6 2013, 09:26:12) [GCC 4.3.2] (Pdb) break 3 Breakpoint 1 at /tmp/jump.py:3 (Pdb) continue > /tmp/jump.py(3)gen() -> yield i (Pdb) step --Return-- > /tmp/jump.py(3)gen()->0 -> yield i (Pdb) jump 2 > /tmp/jump.py(2)gen()->0 -> for i in range(1): (Pdb) continue Segmentation fault [1] http://bugs.python.org/issue7238 [2] http://bugs.python.org/issue16482 [3] http://bugs.python.org/issue17697 [4] http://bugs.python.org/issue17277 [5] http://bugs.python.org/issue17288 Xavier From timothy.c.delaney at gmail.com Thu Sep 12 23:29:30 2013 From: timothy.c.delaney at gmail.com (Tim Delaney) Date: Fri, 13 Sep 2013 07:29:30 +1000 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: <20130912174031.5971338f@pitrou.net> References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911134032.GA16820@ando> <52307DE0.9040208@stoneleaf.us> <52309446.6070809@stoneleaf.us> <5231CAEF.1080500@stoneleaf.us> <20130912164300.5cd27a1a@pitrou.net> <5231D848.1090709@stoneleaf.us> <20130912174031.5971338f@pitrou.net> Message-ID: On 13 September 2013 01:40, Antoine Pitrou wrote: > Le Thu, 12 Sep 2013 08:05:44 -0700, > Ethan Furman a ?crit : > > On 09/12/2013 07:43 AM, Antoine Pitrou wrote: > > > > > > Yeah, so this is totally silly. What you're basically saying is "we > > > don't need TransformDict since people can re-implement it > > > themselves". > > > > No, what I'm saying is that the "case-preserving" aspect of > > transformdict is silly. The main point of transformdict is to > > enable, for example, 'IBM', 'Ibm', and 'ibm' to all match up as the > > same key. But why? Because you don't trust the user data. And if > > you don't trust the user data you have to add the correct version of > > the key yourself before you ever process that data, which means you > > already have the correct version stored somewhere. > > That's assuming there is an a priori "correct" version. But there might > not be any. Keeping the original key is important for different reasons > depending on the use case: > > - for case-insensitive dicts, you want to keep the original key for > presentation, logging and debugging purposes (*) > > - for identity dicts, the original key is mandatory because the id() > value in itself is completely useless, it's just used for matching > > (*) For a well-known example of such behaviour, think about Windows > filesystems. > In this case though, there are two pieces of information: 1. A canonical key (which may or may not equal the original key); 2. The original key. It seems to me then that TransformDict is a specialised case of CanonicalDict, where the canonical key is defined to be the first key inserted. It would in fact be possible (though inefficient) to implement that using a canonicalising callable that maintained state - something like (untested): class OriginalKeys: def __init__(self):: self.keys = CanonicalDict(str.lower) def __call__(self, key): return self.keys.setdefault(key, key) class OriginalKeyDict(CanonicalDict): def __init__(self):: super().__init__(OriginalKeys()) Tim Delaney -------------- next part -------------- An HTML attachment was scrubbed... URL: From timothy.c.delaney at gmail.com Thu Sep 12 23:34:15 2013 From: timothy.c.delaney at gmail.com (Tim Delaney) Date: Fri, 13 Sep 2013 07:34:15 +1000 Subject: [Python-Dev] Add a "transformdict" to collections In-Reply-To: References: <20130910112832.75ed6c8b@pitrou.net> <011DB128-7308-40C0-BE93-A691A26B2C1B@gmail.com> <20130911102732.2cb268ca@pitrou.net> <20130911134032.GA16820@ando> <52307DE0.9040208@stoneleaf.us> <52309446.6070809@stoneleaf.us> <5231CAEF.1080500@stoneleaf.us> <20130912164300.5cd27a1a@pitrou.net> <5231D848.1090709@stoneleaf.us> <20130912174031.5971338f@pitrou.net> Message-ID: On 13 September 2013 07:29, Tim Delaney wrote: > > In this case though, there are two pieces of information: > > 1. A canonical key (which may or may not equal the original key); > > 2. The original key. > > It seems to me then that TransformDict is a specialised case of > CanonicalDict, where the canonical key is defined to be the first key > inserted. It would in fact be possible (though inefficient) to implement > that using a canonicalising callable that maintained state - something like > (untested): > > class OriginalKeys: > def __init__(self):: > self.keys = CanonicalDict(str.lower) > > def __call__(self, key): > return self.keys.setdefault(key, key) > > class OriginalKeyDict(CanonicalDict): > def __init__(self):: > super().__init__(OriginalKeys()) > Bah - got myself mixed up with original key and case preserving there ... try this: class OriginalKeys: def __init__(self, func):: self.keys = CanonicalDict(func) def __call__(self, key): return self.keys.setdefault(key, key) class OriginalKeyDict(CanonicalDict): def __init__(self, func):: super().__init__(OriginalKeys(func)) class IdentityDict(OriginalKeyDict): def __init__(self): super().__init__(id) class CasePreservingDict(OriginalKeyDict): def __init__(self): super().__init__(str.lower) Tim Delaney -------------- next part -------------- An HTML attachment was scrubbed... URL: From steve at pearwood.info Fri Sep 13 01:08:21 2013 From: steve at pearwood.info (Steven D'Aprano) Date: Fri, 13 Sep 2013 09:08:21 +1000 Subject: [Python-Dev] PEP 447: add type.__locallookup__ In-Reply-To: <8F0FD1DE-A8ED-40D7-878A-9A005ABDF70C@mac.com> References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> <522DECA3.2030709@hotpy.org> <522DF204.7040109@hotpy.org> <0752376899dd7436f6115bfc03594574@chopin.edu.pl> <8F0FD1DE-A8ED-40D7-878A-9A005ABDF70C@mac.com> Message-ID: <20130912230820.GC16820@ando> On Thu, Sep 12, 2013 at 04:42:39PM +0200, Ronald Oussoren wrote: > I don't particularly like __locallookup__ either, but haven't found a > better name yet. "__lookup_in_class__" was the best alternative I > could come up with, and that feels different than other special > methods. The name in the PEP is more or less derived from > _PyType_Lookup, with "local" meaning "only in this class, don't > recurse in the rest of the MRO". How about __typelookup__ ? Surely that's the obvious name to derive from _PyType_Lookup :-) -- Steven From Steve.Dower at microsoft.com Fri Sep 13 05:04:49 2013 From: Steve.Dower at microsoft.com (Steve Dower) Date: Fri, 13 Sep 2013 03:04:49 +0000 Subject: [Python-Dev] PEP 447: add type.__locallookup__ In-Reply-To: <20130912230820.GC16820@ando> References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> <522DECA3.2030709@hotpy.org> <522DF204.7040109@hotpy.org> <0752376899dd7436f6115bfc03594574@chopin.edu.pl> <8F0FD1DE-A8ED-40D7-878A-9A005ABDF70C@mac.com>,<20130912230820.GC16820@ando> Message-ID: <51c253d972c94acbace9e46fc43b922a@BLUPR03MB199.namprd03.prod.outlook.com> What about __getlocalattribute__ or __getattributenorecurse__? Long, but this isn't going to be used often. Putting "type" or "class" in the name would be misleading. It's an instance method (that is most useful when implemented on a metaclass). (Apologies for the top post.) Sent from my Windows Phone ________________________________ From: Steven D'Aprano Sent: ?9/?12/?2013 16:09 To: python-dev at python.org Subject: Re: [Python-Dev] PEP 447: add type.__locallookup__ On Thu, Sep 12, 2013 at 04:42:39PM +0200, Ronald Oussoren wrote: > I don't particularly like __locallookup__ either, but haven't found a > better name yet. "__lookup_in_class__" was the best alternative I > could come up with, and that feels different than other special > methods. The name in the PEP is more or less derived from > _PyType_Lookup, with "local" meaning "only in this class, don't > recurse in the rest of the MRO". How about __typelookup__ ? Surely that's the obvious name to derive from _PyType_Lookup :-) -- Steven _______________________________________________ Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/steve.dower%40microsoft.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From steve at pearwood.info Fri Sep 13 05:59:17 2013 From: steve at pearwood.info (Steven D'Aprano) Date: Fri, 13 Sep 2013 13:59:17 +1000 Subject: [Python-Dev] PEP 447: add type.__locallookup__ In-Reply-To: <51c253d972c94acbace9e46fc43b922a@BLUPR03MB199.namprd03.prod.outlook.com> References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> <522DECA3.2030709@hotpy.org> <522DF204.7040109@hotpy.org> <0752376899dd7436f6115bfc03594574@chopin.edu.pl> <51c253d972c94acbace9e46fc43b922a@BLUPR03MB199.namprd03.prod.outlook.com> Message-ID: <20130913035917.GE16820@ando> On Fri, Sep 13, 2013 at 03:04:49AM +0000, Steve Dower wrote: > What about __getlocalattribute__ or __getattributenorecurse__? Long, > but this isn't going to be used often. This has nothing to do with locals, nor does it have anything to do with recursion, so both those names are misleading. > Putting "type" or "class" in the name would be misleading. It's an > instance method (that is most useful when implemented on a metaclass). Regardless of whether it is an instance method or not, by default it performs the lookup on the type. Hence the C function _PyType_Lookup and hence my suggestion __typelookup__. But I think that __typelookup__ does describe quite well what the method does. It looks up on the type. The PEP is fairly clear on how this is supposed to work, e.g. the default type.____ method will look up in the class/type dict. PEP 447 includes an example of how you might implement this in Python: class MetaType(type): def __locallookup__(cls, name): try: return cls.__dict__[name] except KeyError: raise AttributeError(name) from None "local lookup" doesn't even come close to describing what the method does or why you would use it. It suggests something to do with locals, which is not the case. Neither does __getattributenorecurse__, which suggests looking up an attribute on an object without following the inheritance hierarchy, e.g. looking in the instance __dict__ but not the class __dict__. So the complete opposite of what it actually does. -- Steven From Steve.Dower at microsoft.com Fri Sep 13 06:26:06 2013 From: Steve.Dower at microsoft.com (Steve Dower) Date: Fri, 13 Sep 2013 04:26:06 +0000 Subject: [Python-Dev] PEP 447: add type.__locallookup__ In-Reply-To: <20130913035917.GE16820@ando> References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> <522DECA3.2030709@hotpy.org> <522DF204.7040109@hotpy.org> <0752376899dd7436f6115bfc03594574@chopin.edu.pl> <51c253d972c94acbace9e46fc43b922a@BLUPR03MB199.namprd03.prod.outlook.com>, <20130913035917.GE16820@ando> Message-ID: <392015291ec843afb1bc85632055729d@BLUPR03MB199.namprd03.prod.outlook.com> Last I checked, looking up in the instance dict us exactly what it does. Even the example you posted is doing that. And the only difference from __getattribute__ is that it throws instead of following the MRO, which is intended to allow base classes (via super, and another call to this method) to dynamically respond to a getattr without the cooperation of subclasses. Consider class A, which knows it has a method F, but will not create it until the first __getattribute__ call. Now class B derives from A, and someone calls super(B).F(obj). Currently, super only looks in __dict__ for F, which will fail to invoke A.__getattribute__. Because super is used to provide MRO traversal, it can't rely on B.__getattribute__ to perform the traversal, so it currently has no choice. The PEP was originally adding a special class method to provide a __getattribute__ equivalent that would not traverse the MRO, so that super could use it and people can create dynamic classes that can act as base classes. I pointed out that this could be an instance method (thereby avoid automatic-classmethod magic) and implemented on a metaclass for the class behavior. Unless the PEP has changed recently, this is still an instance method that will look up members defined directly on the type and not on base classes. There may still be valid questions to answer (such as, should overrides if this method on base classes be inherited), but whether it is a type/class method is no longer one of those. Cheers, Steve Sent from my Windows Phone ________________________________ From: Steven D'Aprano Sent: ?9/?12/?2013 21:00 To: python-dev at python.org Subject: Re: [Python-Dev] PEP 447: add type.__locallookup__ On Fri, Sep 13, 2013 at 03:04:49AM +0000, Steve Dower wrote: > What about __getlocalattribute__ or __getattributenorecurse__? Long, > but this isn't going to be used often. This has nothing to do with locals, nor does it have anything to do with recursion, so both those names are misleading. > Putting "type" or "class" in the name would be misleading. It's an > instance method (that is most useful when implemented on a metaclass). Regardless of whether it is an instance method or not, by default it performs the lookup on the type. Hence the C function _PyType_Lookup and hence my suggestion __typelookup__. But I think that __typelookup__ does describe quite well what the method does. It looks up on the type. The PEP is fairly clear on how this is supposed to work, e.g. the default type.____ method will look up in the class/type dict. PEP 447 includes an example of how you might implement this in Python: class MetaType(type): def __locallookup__(cls, name): try: return cls.__dict__[name] except KeyError: raise AttributeError(name) from None "local lookup" doesn't even come close to describing what the method does or why you would use it. It suggests something to do with locals, which is not the case. Neither does __getattributenorecurse__, which suggests looking up an attribute on an object without following the inheritance hierarchy, e.g. looking in the instance __dict__ but not the class __dict__. So the complete opposite of what it actually does. -- Steven _______________________________________________ Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/steve.dower%40microsoft.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From steve at pearwood.info Fri Sep 13 08:52:38 2013 From: steve at pearwood.info (Steven D'Aprano) Date: Fri, 13 Sep 2013 16:52:38 +1000 Subject: [Python-Dev] PEP 447: add type.__locallookup__ In-Reply-To: <392015291ec843afb1bc85632055729d@BLUPR03MB199.namprd03.prod.outlook.com> References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> <522DECA3.2030709@hotpy.org> <522DF204.7040109@hotpy.org> <0752376899dd7436f6115bfc03594574@chopin.edu.pl> <392015291ec843afb1bc85632055729d@BLUPR03MB199.namprd03.prod.outlook.com> Message-ID: <20130913065236.GF16820@ando> On Fri, Sep 13, 2013 at 04:26:06AM +0000, Steve Dower wrote: > Last I checked, looking up in the instance dict us exactly what it > does. Even the example you posted is doing that. The example from the PEP shows: return cls.__dict__[name] not "self.__dict__[name]". It is true that "the instance" in this case refers to it being an instance of the metaclass, but that instance is, in fact, a class/type. That's why we normally call it "cls" in a metaclass method rather than "self". I was reacting to your statement that [quote]Putting "type" or "class" in the name would be misleading[end quote]. I don't believe it is misleading. "type lookup" is exactly what it does: it does a lookup on a type. Take your example below: > Consider class A, which knows it has a method F, but will not create > it until the first __getattribute__ call. Now class B derives from A, > and someone calls super(B).F(obj). [Aside: I'm not sure why you are using an unbound super object super(B) instead of the more usual super(B, obj).F(). Have I missed something?] As I understand it, that ends up calling type(B).____(B, 'F'). So the objects being used are: - the metaclass type(B); - the class B but not the instance self = B(), even though F is a regular instance method on A that ends up seeing self as the first argument. Given this, I believe that "lookup on the type" is exactly what the method does, whether you interpret "the type" as the metaclass (the ____ method is called on the metaclass) or the class B (which ends up as the first argument to the method). By the way, I think the PEP should have a more complex example. The SillyObject example is nice and easy to understand, but it doesn't really help with the motivating use-case "dynamic classes that can grow new methods on demand". Ronald, if you're reading this, can you add such an example please? Also, there's a typo in the SillyObject M method ("fourtytwo" should not have a U in it). [...] > There may still be valid questions to answer (such as, should > overrides if this method on base classes be inherited), but whether it > is a type/class method is no longer one of those. I don't believe that anyone is arguing that it should be a class method. I'm certainly not. But even if somebody is, that doesn't have anything to do with the name. We write dict.fromkeys(), not dict.typefromkeys(). -- Steven From ncoghlan at gmail.com Fri Sep 13 12:42:46 2013 From: ncoghlan at gmail.com (Nick Coghlan) Date: Fri, 13 Sep 2013 20:42:46 +1000 Subject: [Python-Dev] PEP 447: add type.__locallookup__ In-Reply-To: <20130913065236.GF16820@ando> References: <75030FAC-6918-4E94-95DA-67A88D53E6F5@mac.com> <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> <522DECA3.2030709@hotpy.org> <522DF204.7040109@hotpy.org> <0752376899dd7436f6115bfc03594574@chopin.edu.pl> <392015291ec843afb1bc85632055729d@BLUPR03MB199.namprd03.prod.outlook.com> <20130913065236.GF16820@ando> Message-ID: Perhaps "__getdescriptor__" would work as the method name? Yes, it can technically return a non-descriptor, but the *primary* purpose is to customise the retrieval of objects that will be checked to see if they're descriptors. It *won't* be invoked when looking for ordinary attributes in an instance dict, but *will* be invoked when looking on the class object. Cheers, Nick. -------------- next part -------------- An HTML attachment was scrubbed... URL: From steve at pearwood.info Fri Sep 13 14:23:28 2013 From: steve at pearwood.info (Steven D'Aprano) Date: Fri, 13 Sep 2013 22:23:28 +1000 Subject: [Python-Dev] PEP 447: add type.__locallookup__ In-Reply-To: References: <7D6D4488-2855-41F8-A9F2-1FF23B9E3A56@mac.com> <522DDB74.5080609@stoneleaf.us> <522DECA3.2030709@hotpy.org> <522DF204.7040109@hotpy.org> <0752376899dd7436f6115bfc03594574@chopin.edu.pl> <392015291ec843afb1bc85632055729d@BLUPR03MB199.namprd03.prod.outlook.com> <20130913065236.GF16820@ando> Message-ID: <20130913122328.GI16820@ando> On Fri, Sep 13, 2013 at 08:42:46PM +1000, Nick Coghlan wrote: > Perhaps "__getdescriptor__" would work as the method name? Yes, it can > technically return a non-descriptor, So technically that name is, um, what's the term... oh yes, "a lie". :-) > but the *primary* purpose is to > customise the retrieval of objects that will be checked to see if they're > descriptors. If that's the case, the PEP should make that clear. [Aside: the PEP states that the method shouldn't invoke descriptors. What's the reason for that? If I take the statement literally, doesn't it mean that the method mustn't use any other methods at all? Surely that can't be what is intended, but I'm not sure what is intended.] > It *won't* be invoked when looking for ordinary attributes in > an instance dict, but *will* be invoked when looking on the class object. Just to be clear, if I have: instance = MyClass() x = instance.name and "name" is found in instance.__dict__, then this special method will not be invoked. But if "name" is not found in the instance dict, then "name" will be looked up on the class object MyClass, which may invoke this special method. Am I correct? -- Steven From eric at trueblade.com Fri Sep 13 16:49:05 2013 From: eric at trueblade.com (Eric V. Smith) Date: Fri, 13 Sep 2013 10:49:05 -0400 Subject: [Python-Dev] [Python-checkins] cpython (merge 3.3 -> default): Fix http.server's request handling case on trailing '/'. In-Reply-To: <3cbpGS1zZSz7Lk4@mail.python.org> References: <3cbpGS1zZSz7Lk4@mail.python.org> Message-ID: <523325E1.70608@trueblade.com> On 9/13/2013 3:22 AM, senthil.kumaran wrote: > http://hg.python.org/cpython/rev/b85c9d2a5227 > changeset: 85672:b85c9d2a5227 > parent: 85668:66ec8431032d > parent: 85671:1fcccbbe15e2 > user: Senthil Kumaran > date: Fri Sep 13 00:22:45 2013 -0700 > summary: > Fix http.server's request handling case on trailing '/'. > > Patch contributed by Vajrasky Kok. Addresses Issue #17324 > + trailing_slash = True if path.rstrip().endswith('/') else False Wouldn't this be better just as: trailing_slash = path.rstrip().endswith('/') -- Eric. From status at bugs.python.org Fri Sep 13 18:07:33 2013 From: status at bugs.python.org (Python tracker) Date: Fri, 13 Sep 2013 18:07:33 +0200 (CEST) Subject: [Python-Dev] Summary of Python tracker Issues Message-ID: <20130913160733.5F38B56A5E@psf.upfronthosting.co.za> ACTIVITY SUMMARY (2013-09-06 - 2013-09-13) Python tracker at http://bugs.python.org/ To view or respond to any of the issues listed below, click on the issue. Do NOT respond to this message. Issues counts and deltas: open 4212 (+17) closed 26571 (+48) total 30783 (+65) Open issues with patches: 1935 Issues opened (46) ================== #18939: Venv docs regarding original python install http://bugs.python.org/issue18939 reopened by gwideman #18948: deliberately crashing tests should prevent core dumps http://bugs.python.org/issue18948 opened by pitrou #18950: Miscellaneous fixes for the sunau module http://bugs.python.org/issue18950 opened by serhiy.storchaka #18951: In unittest.TestCase.assertRegex change "re" and "regex" to "r http://bugs.python.org/issue18951 opened by py.user #18955: Confusing documentation in Lib/importlib/util.py http://bugs.python.org/issue18955 opened by vajrasky #18956: Document useful functions in ???pydoc??? module http://bugs.python.org/issue18956 opened by bignose #18958: Exception('No JSON object could be decoded') when parsing a va http://bugs.python.org/issue18958 opened by Gallaecio #18959: Create a "Superseded modules" section in standard library ToC http://bugs.python.org/issue18959 opened by ncoghlan #18960: First line can be executed twice http://bugs.python.org/issue18960 opened by serhiy.storchaka #18961: Non-UTF8 encoding line http://bugs.python.org/issue18961 opened by serhiy.storchaka #18965: 2to3 can produce illegal bytes literals http://bugs.python.org/issue18965 opened by serhiy.storchaka #18966: Threads within multiprocessing Process terminate early http://bugs.python.org/issue18966 opened by pietvo #18967: Find a less conflict prone approach to Misc/NEWS http://bugs.python.org/issue18967 opened by ncoghlan #18968: Find a way to detect incorrectly skipped tests http://bugs.python.org/issue18968 opened by ncoghlan #18969: test suite: enable faulthandler timeout in assert_python http://bugs.python.org/issue18969 opened by neologix #18970: run_setup() behavior differs from cli invocation of setup.py http://bugs.python.org/issue18970 opened by l #18971: Use argparse in the profile/cProfile modules http://bugs.python.org/issue18971 opened by serhiy.storchaka #18972: Use argparse in email example scripts http://bugs.python.org/issue18972 opened by serhiy.storchaka #18973: Use argparse in the calendar module http://bugs.python.org/issue18973 opened by serhiy.storchaka #18974: Use argparse in the diff script http://bugs.python.org/issue18974 opened by serhiy.storchaka #18975: timeit: Use thousands separators and print number of loops per http://bugs.python.org/issue18975 opened by jstasiak #18976: distutils/command/build_ext passes wrong linker flags http://bugs.python.org/issue18976 opened by Benedikt.Morbach #18977: The -t option has no effect in for uu command-line http://bugs.python.org/issue18977 opened by serhiy.storchaka #18978: Allow urllib.request.Request subclasses to override method http://bugs.python.org/issue18978 opened by jason.coombs #18979: Use argparse in the uu module http://bugs.python.org/issue18979 opened by serhiy.storchaka #18981: Typo in the ctypes tests http://bugs.python.org/issue18981 opened by Anoop.Thomas.Mathew #18982: Add tests for CLI of the calendar module http://bugs.python.org/issue18982 opened by serhiy.storchaka #18983: Specify time unit for timeit CLI http://bugs.python.org/issue18983 opened by serhiy.storchaka #18985: Improve the documentation in fcntl module http://bugs.python.org/issue18985 opened by vajrasky #18986: Add a case-insensitive case-preserving dict http://bugs.python.org/issue18986 opened by pitrou #18987: distutils.utils.get_platform() for 32-bit Python on a 64-bit m http://bugs.python.org/issue18987 opened by sferencik #18989: reuse of enum names in class creation inconsistent http://bugs.python.org/issue18989 opened by ethan.furman #18990: Remove unnecessary API inconsistency from ElementTree.XMLPullP http://bugs.python.org/issue18990 opened by scoder #18993: There is an overshadowed and invalid test in testmock.py http://bugs.python.org/issue18993 opened by vajrasky #18994: Inside fcntl module, we does not check the return code of all_ http://bugs.python.org/issue18994 opened by vajrasky #18995: Enum does not work with reversed http://bugs.python.org/issue18995 opened by vajrasky #18996: unittest: more helpful truncating long strings http://bugs.python.org/issue18996 opened by serhiy.storchaka #18998: iter() not working in ElementTree http://bugs.python.org/issue18998 opened by Kronuz #18999: Robustness issues in multiprocessing.{get,set}_start_method http://bugs.python.org/issue18999 opened by larsmans #19001: test_gdb fails on Fedora buildbot http://bugs.python.org/issue19001 opened by pitrou #19003: email.generator.BytesGenerator corrupts data by changing line http://bugs.python.org/issue19003 opened by Alexander.Kruppa #19005: PyIter_Next crashes if passed a non-iterator http://bugs.python.org/issue19005 opened by abacabadabacaba #19006: UnitTest docs should have a single list of assertions http://bugs.python.org/issue19006 opened by roysmith #19007: precise time.time() under Windows 8 http://bugs.python.org/issue19007 opened by pitrou #19009: Enhance HTTPResponse.readline() performance http://bugs.python.org/issue19009 opened by kristjan.jonsson #19010: Make XMLPullParser in ElementTree inherit from XMLParser http://bugs.python.org/issue19010 opened by scoder Most recent 15 issues with no replies (15) ========================================== #19010: Make XMLPullParser in ElementTree inherit from XMLParser http://bugs.python.org/issue19010 #19005: PyIter_Next crashes if passed a non-iterator http://bugs.python.org/issue19005 #19003: email.generator.BytesGenerator corrupts data by changing line http://bugs.python.org/issue19003 #19001: test_gdb fails on Fedora buildbot http://bugs.python.org/issue19001 #18996: unittest: more helpful truncating long strings http://bugs.python.org/issue18996 #18994: Inside fcntl module, we does not check the return code of all_ http://bugs.python.org/issue18994 #18985: Improve the documentation in fcntl module http://bugs.python.org/issue18985 #18982: Add tests for CLI of the calendar module http://bugs.python.org/issue18982 #18981: Typo in the ctypes tests http://bugs.python.org/issue18981 #18979: Use argparse in the uu module http://bugs.python.org/issue18979 #18977: The -t option has no effect in for uu command-line http://bugs.python.org/issue18977 #18976: distutils/command/build_ext passes wrong linker flags http://bugs.python.org/issue18976 #18974: Use argparse in the diff script http://bugs.python.org/issue18974 #18972: Use argparse in email example scripts http://bugs.python.org/issue18972 #18971: Use argparse in the profile/cProfile modules http://bugs.python.org/issue18971 Most recent 15 issues waiting for review (15) ============================================= #19009: Enhance HTTPResponse.readline() performance http://bugs.python.org/issue19009 #18999: Robustness issues in multiprocessing.{get,set}_start_method http://bugs.python.org/issue18999 #18996: unittest: more helpful truncating long strings http://bugs.python.org/issue18996 #18995: Enum does not work with reversed http://bugs.python.org/issue18995 #18994: Inside fcntl module, we does not check the return code of all_ http://bugs.python.org/issue18994 #18993: There is an overshadowed and invalid test in testmock.py http://bugs.python.org/issue18993 #18990: Remove unnecessary API inconsistency from ElementTree.XMLPullP http://bugs.python.org/issue18990 #18989: reuse of enum names in class creation inconsistent http://bugs.python.org/issue18989 #18986: Add a case-insensitive case-preserving dict http://bugs.python.org/issue18986 #18985: Improve the documentation in fcntl module http://bugs.python.org/issue18985 #18982: Add tests for CLI of the calendar module http://bugs.python.org/issue18982 #18981: Typo in the ctypes tests http://bugs.python.org/issue18981 #18979: Use argparse in the uu module http://bugs.python.org/issue18979 #18978: Allow urllib.request.Request subclasses to override method http://bugs.python.org/issue18978 #18977: The -t option has no effect in for uu command-line http://bugs.python.org/issue18977 Top 10 most discussed issues (10) ================================= #18986: Add a case-insensitive case-preserving dict http://bugs.python.org/issue18986 46 msgs #18943: argparse: default args in mutually exclusive groups http://bugs.python.org/issue18943 12 msgs #18999: Robustness issues in multiprocessing.{get,set}_start_method http://bugs.python.org/issue18999 12 msgs #17797: Visual C++ 11.0 reports fileno(stdin) == 0 for non-console pro http://bugs.python.org/issue17797 10 msgs #18967: Find a less conflict prone approach to Misc/NEWS http://bugs.python.org/issue18967 10 msgs #18975: timeit: Use thousands separators and print number of loops per http://bugs.python.org/issue18975 10 msgs #18987: distutils.utils.get_platform() for 32-bit Python on a 64-bit m http://bugs.python.org/issue18987 10 msgs #5815: locale.getdefaultlocale() missing corner case http://bugs.python.org/issue5815 9 msgs #18829: csv produces confusing error message when passed a non-string http://bugs.python.org/issue18829 8 msgs #1565525: tracebacks eat up memory by holding references to locals and g http://bugs.python.org/issue1565525 8 msgs Issues closed (46) ================== #14927: add "Do not supply 'int' argument" to random.shuffle docstring http://bugs.python.org/issue14927 closed by orsenthil #14971: (unittest) loadTestsFromName does not work on method with a de http://bugs.python.org/issue14971 closed by python-dev #17324: SimpleHTTPServer serves files even if the URL has a trailing s http://bugs.python.org/issue17324 closed by orsenthil #18033: Example for Profile Module shows incorrect method http://bugs.python.org/issue18033 closed by orsenthil #18206: license url in site.py should always use X.Y.Z form of version http://bugs.python.org/issue18206 closed by orsenthil #18301: In itertools.chain.from_iterable() there is no cls argument http://bugs.python.org/issue18301 closed by rhettinger #18438: Obsolete url in comment inside decimal module http://bugs.python.org/issue18438 closed by orsenthil #18553: os.isatty() is not Unix only http://bugs.python.org/issue18553 closed by orsenthil #18623: Factor out the _SuppressCoreFiles context manager http://bugs.python.org/issue18623 closed by pitrou #18752: Make chain.from_iterable an alias for a new chain_iterable. http://bugs.python.org/issue18752 closed by rhettinger #18784: minor uuid.py loading optimization http://bugs.python.org/issue18784 closed by serhiy.storchaka #18800: Document Fraction's numerator and denominator properties http://bugs.python.org/issue18800 closed by orsenthil #18808: Thread.join returns before PyThreadState is destroyed http://bugs.python.org/issue18808 closed by pitrou #18815: DOCUMENTATION: "mmap .close()" doesn't close the underlying fi http://bugs.python.org/issue18815 closed by orsenthil #18818: Empty PYTHONIOENCODING is not the same as nonexistent http://bugs.python.org/issue18818 closed by serhiy.storchaka #18821: Add .lastitem attribute to takewhile instances http://bugs.python.org/issue18821 closed by rhettinger #18852: site.py does not handle readline.__doc__ being None http://bugs.python.org/issue18852 closed by r.david.murray #18894: In unittest.TestResult.failures remove deprecated fail* method http://bugs.python.org/issue18894 closed by ezio.melotti #18895: In unittest.TestResult.addError split the sentence http://bugs.python.org/issue18895 closed by ezio.melotti #18904: Unnecessary test in file descriptor inheritance test http://bugs.python.org/issue18904 closed by haypo #18908: Enum docs: sections leak out http://bugs.python.org/issue18908 closed by python-dev #18915: ssl.wrap_socket, pass in certfile and keyfile as PEM strings http://bugs.python.org/issue18915 closed by asvetlov #18917: python won't display greek characters in apache under windows http://bugs.python.org/issue18917 closed by nickl1 #18934: multiprocessing: use selectors module http://bugs.python.org/issue18934 closed by neologix #18935: test_regrtest.test_timeout failure http://bugs.python.org/issue18935 closed by neologix #18944: Minor mistake in test_set.py http://bugs.python.org/issue18944 closed by tim.peters #18946: HTMLParser should ignore errors when parsing text in