[issue17878] There is no way to get a list of available codecs

2013-05-02 Thread Dmi Baranov
Dmi Baranov added the comment: Sorry for additional nose - currently there is no way to change the codecs_search_path. Similarly with sys.patch_hooks is a great way to increase the level of customization (maybe I have a faster codec?). -- ___ Python

[issue17878] There is no way to get a list of available codecs

2013-05-02 Thread Paul Moore
Paul Moore added the comment: On 2 May 2013 16:35, Dmi Baranov wrote: > Paul, result as iterable of CodecInfo objects is gives much more > flexibility than the names of codecs (whats if you will have a few codecs > with the same name in different SearchObjects?) Works for me. My usage would be

[issue17878] There is no way to get a list of available codecs

2013-05-02 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 02.05.2013 16:53, Marc-Andre Lemburg wrote: > > Marc-Andre Lemburg added the comment: > > On 02.05.2013 16:45, Walter Dörwald wrote: >> ... >> The search function can't return a list of codec names in this case, as the >> list is infinite. > > True. >

[issue17878] There is no way to get a list of available codecs

2013-05-02 Thread Dmi Baranov
Dmi Baranov added the comment: My +1 for __iter__ with default `raise StopIteration`, it is more elegant solution than declaration and guarantee of the interfaces (based at collections.abc.Callable and collections.abc.Iterator). Paul, result as iterable of CodecInfo objects is gives much more

[issue17878] There is no way to get a list of available codecs

2013-05-02 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 02.05.2013 16:45, Walter Dörwald wrote: > ... > The search function can't return a list of codec names in this case, as the > list is infinite. True. The search object will have to be allowed to raise a NotImplementedError or some other error/return val

[issue17878] There is no way to get a list of available codecs

2013-05-02 Thread Paul Moore
Paul Moore added the comment: @doerwalter In that case, I'd take the view that such a codec should simply not return anything. The discovery mechanism can be limited to returning only statically discoverable codec names (and it can be documented as such). The original use case was to support f

[issue17878] There is no way to get a list of available codecs

2013-05-02 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 02.05.2013 16:41, Nick Coghlan wrote: > > Nick Coghlan added the comment: > > This is actually similar to the problem with getting the list of modules an > importer provides (that is, we don't currently have an officially defined > method in the import

[issue17878] There is no way to get a list of available codecs

2013-05-02 Thread Walter Dörwald
Walter Dörwald added the comment: The point of using a function is to allow the function special hanling of the encoding name, which goes beyond a simple map lookup, i.e. you could do the following: import codecs def search_function(encoding): if not encoding.startswith("append-")

[issue17878] There is no way to get a list of available codecs

2013-05-02 Thread Nick Coghlan
Nick Coghlan added the comment: This is actually similar to the problem with getting the list of modules an importer provides (that is, we don't currently have an officially defined method in the importer protocol for that, although pkgutil.iter_importer_modules implicitly looks for an "iter_m

[issue17878] There is no way to get a list of available codecs

2013-05-02 Thread Dmi Baranov
Dmi Baranov added the comment: I think the "function" is a bit misleading. I suggest something like CodecsSearcher, please look at attached implementation (dirty code, just for start discussion about interfaces, lazy caches, etc). -- Added file: http://bugs.python.org/file30107/codecs_

[issue17878] There is no way to get a list of available codecs

2013-05-01 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 02.05.2013 01:59, Dmi Baranov wrote: > > Dmi Baranov added the comment: > > I think its not possible while codecs registry contains search callbacks > (stateless-registry) It is possible: we'd just need to invent a way to ask search functions for the l

[issue17878] There is no way to get a list of available codecs

2013-05-01 Thread Dmi Baranov
Dmi Baranov added the comment: I think its not possible while codecs registry contains search callbacks (stateless-registry) -- components: +Library (Lib) nosy: +dmi.baranov ___ Python tracker

[issue17878] There is no way to get a list of available codecs

2013-04-30 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue17878] There is no way to get a list of available codecs

2013-04-30 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +lemburg, ncoghlan ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://ma

[issue17878] There is no way to get a list of available codecs

2013-04-30 Thread Paul Moore
New submission from Paul Moore: The codecs module allows the user to register additional codecs, but does not offer a means of getting a list of registered codecs. This is important, for example, in a tool to re-encode files. It is reasonable to expect that such a tool would offer a list of su