Bug: string.letters
Hallo.
When importing string in python, “letters” are defined as follows:
import string
string.letters
‘abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ’
… whereas when importing matplotlib, the order of “letters” seems to be changed:
import matplotlib
string.letters
‘ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz’
Would be grateful for a comment.
Philipp
···
--------------------------------------------------------------------------------------------------------
Carl Philipp Enssle
Environmental Technology Engineer
AF-Colenco Ltd, Groundwater Protection and Waste DisposalVisiting address: Täfernstrasse 26 | CH-5405 Baden | Switzerland
Direct: +41 (0)56 483 15 48 | Fax: +41 (0)56 483 18 82
carl-philipp.enssle@…3017… | www.af-colenco.com
Enssle Carl Philipp wrote:
Hallo.
When importing string in python, "letters" are defined as follows:
import string
string.letters
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
... whereas when importing matplotlib, the order of "letters" seems to be changed:
import matplotlib
string.letters
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
Would be grateful for a comment.
Philipp
Hello Philipp,
I’m not able to replicate the behavior you describe.
import sys
sys.version
‘2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)]’
import matplotlib
matplotlib.version
‘0.99.1’
import string
string.letters
‘abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ’
– jv
···
carl-philipp.enssle@…3017…www.af-colenco.comhttp://p.sf.net/sfu/intel-sw-devMatplotlib-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/matplotlib-users
I'm seeing this here too:
In [1]: import string
In [2]: string.letters
Out[2]: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
In [3]: import matplotlib
In [4]: string.letters
Out[4]: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
That's just bizarre. This is on 0.99.1.1 on OpenSUSE 11.2
Ryan
···
On Tue, Mar 9, 2010 at 11:28 AM, Enssle Carl Philipp <carl-philipp.enssle@...466...> wrote:
Hallo.
When importing string in python, "letters" are defined as follows:
import string
string.letters
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
… whereas when importing matplotlib, the order of "letters" seems to be
changed:
import matplotlib
string.letters
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
Would be grateful for a comment.
--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Enssle Carl Philipp wrote:
Hallo.
When importing string in python, "letters" are defined as follows:
>>> import string
>>> string.letters
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
… whereas when importing matplotlib, the order of "letters" seems to be changed:
>>> import matplotlib
>>> string.letters
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
Would be grateful for a comment.
Bizarre! I can reproduce it with python 2.6 (ubuntu 9.10) and mpl from svn. I have done a little grepping and other exploration, but have completely failed to find where this change is occurring.
Eric
cbook imports locale -- may be implicated:
string.letters¶
The concatenation of the strings lowercase and uppercase described
below. The specific value is locale-dependent, and will be updated
when locale.setlocale() is called.
See if simply importing locale first has the same effect.
JDH
···
On Tue, Mar 9, 2010 at 12:16 PM, Eric Firing <efiring@...202...> wrote:
Bizarre! I can reproduce it with python 2.6 (ubuntu 9.10) and mpl from
svn. I have done a little grepping and other exploration, but have
completely failed to find where this change is occurring.
Bizarre! I can reproduce it with python 2.6 (ubuntu 9.10) and mpl from
svn. I have done a little grepping and other exploration, but have
completely failed to find where this change is occurring.
cbook imports locale -- may be implicated:
string.letters¶
The concatenation of the strings lowercase and uppercase described
below. The specific value is locale-dependent, and will be updated
when locale.setlocale() is called.
See if simply importing locale first has the same effect.
It seems to be an interaction between numpy and locale. I can reproduce the problem with:
import locale
import numpy as np
preferredencoding = locale.getpreferredencoding()
import string
print string.letters
The bug disappears after removing the numpy import.
-Tony
···
On Mar 9, 2010, at 1:22 PM, John Hunter wrote:
On Tue, Mar 9, 2010 at 12:16 PM, Eric Firing <efiring@...202...> wrote:
Tony S Yu wrote:
Bizarre! I can reproduce it with python 2.6 (ubuntu 9.10) and mpl from
svn. I have done a little grepping and other exploration, but have
completely failed to find where this change is occurring.
cbook imports locale -- may be implicated:
string.letters¶
The concatenation of the strings lowercase and uppercase described
below. The specific value is locale-dependent, and will be updated
when locale.setlocale() is called.
See if simply importing locale first has the same effect.
It seems to be an interaction between numpy and locale. I can reproduce the problem with:
import locale
import numpy as np
preferredencoding = locale.getpreferredencoding()
cbook also calls locale.getpreferredencoding() when it is imported.
Eric
···
On Mar 9, 2010, at 1:22 PM, John Hunter wrote:
On Tue, Mar 9, 2010 at 12:16 PM, Eric Firing <efiring@...202...> wrote:
import string
print string.letters
The bug disappears after removing the numpy import.
-Tony
Eric Firing wrote:
Tony S Yu wrote:
Bizarre! I can reproduce it with python 2.6 (ubuntu 9.10) and mpl from
svn. I have done a little grepping and other exploration, but have
completely failed to find where this change is occurring.
cbook imports locale -- may be implicated:
string.letters¶
The concatenation of the strings lowercase and uppercase described
below. The specific value is locale-dependent, and will be updated
when locale.setlocale() is called.
See if simply importing locale first has the same effect.
It seems to be an interaction between numpy and locale. I can reproduce the problem with:
import locale
import numpy as np
preferredencoding = locale.getpreferredencoding()
cbook also calls locale.getpreferredencoding() when it is imported.
Confirmation:
In [1]:import string
In [2]:string.letters
Out[2]:'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
In [3]:import locale
In [4]:locale.getpreferredencoding ()
Out[4]:'UTF-8'
In [5]:string.letters
Out[5]:'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
The lesson seems to be that the only proper use for string.letters is for testing membership, in which case the order does not matter.
Eric
···
On Mar 9, 2010, at 1:22 PM, John Hunter wrote:
On Tue, Mar 9, 2010 at 12:16 PM, Eric Firing <efiring@...202...> wrote:
Eric
import string
print string.letters
The bug disappears after removing the numpy import.
-Tony
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options
Eric Firing wrote:
Tony S Yu wrote:
Bizarre! I can reproduce it with python 2.6 (ubuntu 9.10) and mpl from
svn. I have done a little grepping and other exploration, but have
completely failed to find where this change is occurring.
cbook imports locale -- may be implicated:
string.letters¶
The concatenation of the strings lowercase and uppercase described
below. The specific value is locale-dependent, and will be updated
when locale.setlocale() is called.
See if simply importing locale first has the same effect.
It seems to be an interaction between numpy and locale. I can reproduce the problem with:
import locale
import numpy as np
preferredencoding = locale.getpreferredencoding()
cbook also calls locale.getpreferredencoding() when it is imported.
Confirmation:
In [1]:import string
In [2]:string.letters
Out[2]:'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
In [3]:import locale
In [4]:locale.getpreferredencoding ()
Out[4]:'UTF-8'
In [5]:string.letters
Out[5]:'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
PyGTK calls locale.setlocale() and thus may be affecting string.letters.
> The lesson seems to be that the only proper use for string.letters is
> for testing membership, in which case the order does not matter.
Yes.
···
On 2010-03-09 12:37 PM, Eric Firing wrote:
On Mar 9, 2010, at 1:22 PM, John Hunter wrote:
On Tue, Mar 9, 2010 at 12:16 PM, Eric Firing<efiring@...202...> wrote:
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco