Martin v. Löwis wrote: > François Pinard wrote: > >> One thing is that a Python module should have some way to know the >> encoding used in its source file, maybe some kind of `module.__coding__' >> next to `module.__file__', saving the coding effectively used while >> compilation was going on. > > That would be possible to implement. Feel free to create a patch. +1 >> I wonder if some other cookie, next to the `coding:' >> cookie, could not be used to declare that all strings _in this module >> only_ should be interpreted as Unicode by default, but without the need >> of resorting to `u' prefix all over. > > > This could be a starting point of another syntax debate. For example, > > from __future__ import string_literals_are_unicode > > would be possible to implement. If PEP 244 would have been adapted, I > would have proposed > > directive unicode_strings > > Other syntax forms would also be possible. Again, if you know a syntax > which you like, propose a patch. Be prepared to also write a PEP > defending that syntax. +1 Things that have been proposed earlier on, extended a bit: b'xxx' - return a buffer to hold binary data; same as buffer(s'abc') s'abc' - (forced) 8-bit string literal in source code encoding u'abc' - (forced) Unicode literal 'abc' - maps to s'abc' per default, can map to u'abc' based on the command line switch -U or a module switch -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Aug 03 2004) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4