Re: changes on windows registry doesn’t take effect immediately

2013-03-15 Thread Steven D'Aprano
On Thu, 14 Mar 2013 22:26:50 -0700, iMath wrote:

 changes on windows registry doesn’t take effect immediately
 
 I am trying to change IE’s proxy settings by the following 2 code
 snippets
[...]
 but the changes on windows registry doesn’t take effect immediately,so
 is there some way to change the windows registry and let the changes 
 take effect immediately without restarting IE ?

That's an IE question, not a Python question. You might be lucky and have 
somebody here happen to know the answer, but you'll probably have more 
luck asking on a group dedicated to Windows and IE.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: changes on windows registry doesn�t take effect immediately

2013-03-15 Thread Tim Roberts
iMath redstone-c...@163.com wrote:

changes on windows registry doesn’t take effect immediately

Well, that's not exactly the issue.  The registry is being changed
immediately.  The issue is that IE doesn't check for proxy settings
continuously.

but the changes on windows registry doesn’t take effect immediately, so
is there some way to change the windows registry and let the changes
take effect immediately without restarting IE ?

No.  This is an IE issue, not a registry issue.  Other browsers might
behave differently.
-- 
Tim Roberts, t...@probo.com
Providenza  Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to couper contenier of a canvas in an outer canvas???

2013-03-15 Thread Chris Angelico
On Fri, Mar 15, 2013 at 12:07 PM, alex23 wuwe...@gmail.com wrote:
 On Mar 15, 8:24 am, Rick Johnson rantingrickjohn...@gmail.com wrote:
 Hmm, well before i can even start solving your problem, i'll need to
 spend some time figuring out what the hell you're problem is. o_O.
 Maybe you meant to say this:

  how to [copy] all the [canvas items] in [one] canvas [into another] canvas?

  Ahhh, the sweet nectar of articulate communication!

 Mocking people for whom English is obviously not their first language
 just makes you look petty and racist.

Yes, but there is legitimate criticism for a post that clearly hasn't
had much work put into it. I'm not 100% convinced that English isn't
the OP's first language (it seems plausible, even likely, but far from
certain), but I'm confident that the OP did not spend a few minutes
polishing the post before hitting Send (or Expedier, or Versenden, or
whatever the button says). Now, that doesn't mean it's polite or
useful to *mock* the person for it, but it is at least a legit
complaint.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python SUDS issue

2013-03-15 Thread VGNU Linux
Able to fix issue by including 'location' as parameter in client
constructor arguments.
client = Client(url=wsdlurl,doctor=schemadoctor, location='
https://46.51.221.138/PBExternalServices/v1/soap?wsdl')

Thanks for helping me out.
Regards,
VGNU


On Thu, Mar 7, 2013 at 10:07 AM, VGNU Linux vgnuli...@gmail.com wrote:

 Hi Guys,
 Not aware what import here is and what it will do.
 But going through some google search result page found that there is
 something called doctor in suds.
 so tried changing code and it did fix the issue.
 suds.TypeNotFound: Type not found: '(GetAccountBalanceFaultResponse,
 http://www.payback.net/lmsglobal/xsd/v1/types, )'

 Here is what i changed.
 from suds.client import Client
 from suds.xsd.doctor import Import, ImportDoctor
 from suds.sax.element import Element

 wsdlurl = 'https://46.51.221.138/PBExternalServices/v1/soap?wsdl'
 schemaurl = 'http://www.payback.net/lmsglobal/xsd/v1/types'
 schemaimport = Import(schemaurl)
 schemadoctor = ImportDoctor(schemaimport)
 client = Client(url=wsdlurl,doctor=schemadoctor)
 print client

 Printing client now lists all the methods and types associated with the
 service.
 But again stuck as on executing a method
 response = client.service.GetAccountBalance(authtype)
 replies with the error.
 ValueError: unknown url type: {endpoint address}

 Totally confused as what is wrong going on here.

 Appreciate your help.
 Regards,
 VGNU


 On Tue, Mar 5, 2013 at 12:46 PM, dieter die...@handshake.de wrote:

 VGNU Linux vgnuli...@gmail.com writes:

  ...
  Here is my code:
  from suds.client import Client
  wsdlurl = 'https://46.51.221.138/PBExternalServices/v1/soap?wsdl'
  client = Client(wsdlurl)
  print client
 
  And following is the error that occurs on trying to print client.
  Traceback (most recent call last):
  ...
  dereference
  midx, deps = x.dependencies()
File C:\Python25\Lib\site-packages\suds\xsd\sxbasic.py, line 469, in
  dependencies
  raise TypeNotFound(self.ref)
  suds.TypeNotFound: Type not found: '(GetAccountBalanceFaultResponse,
  http://www.payback.net/lmsglobal/xsd/v1/types, )'

 Looks like a bug in the WSDL description of the web service.
 It seems to reference a type GetAccountBalanceFaultResponse
 associated with the namespace 
 http://www.payback.net/lmsglobal/xsd/v1/types;,
 but suds cannot find the type.

 Maybe an import is missing in the WSDL description.

 --
 http://mail.python.org/mailman/listinfo/python-list



-- 
http://mail.python.org/mailman/listinfo/python-list


Unicode

2013-03-15 Thread Thomas Heller

I thought I understand unicode (somewhat, at least), but this seems
not to be the case.

I expected the following code to print 'µm' two times to the console:

code
# -*- coding: cp850 -*-

a = uµm
b = u\u03bcm

print(a)
print(b)
/code

But what I get is this:

output
µm
Traceback (most recent call last):
  File x.py, line 7, in module
print(b)
  File C:\Python33-64\lib\encodings\cp850.py, line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u03bc' in 
position 0: character maps to undefined

/output

Using (german) windows, command prompt, codepage 850.

The same happens with Python 2.7.  What am I doing wrong?

Thanks,
Thomas
--
http://mail.python.org/mailman/listinfo/python-list


Re: Unicode

2013-03-15 Thread Steven D'Aprano
On Fri, 15 Mar 2013 11:46:36 +0100, Thomas Heller wrote:

 I thought I understand unicode (somewhat, at least), but this seems not
 to be the case.
 
 I expected the following code to print 'µm' two times to the console:
 
 code
 # -*- coding: cp850 -*-
 
 a = uµm
 b = u\u03bcm
 
 print(a)
 print(b)
 /code
 
 But what I get is this:
 
 output
 µm
 Traceback (most recent call last):
File x.py, line 7, in module
  print(b)
File C:\Python33-64\lib\encodings\cp850.py, line 19, in encode
  return codecs.charmap_encode(input,self.errors,encoding_map)[0]
 UnicodeEncodeError: 'charmap' codec can't encode character '\u03bc' in
 position 0: character maps to undefined /output
 
 Using (german) windows, command prompt, codepage 850.
 
 The same happens with Python 2.7.  What am I doing wrong?


That's because the two strings are not the same.

You can isolate the error by noting that the second one only raises an 
exception when you try to print it. That suggests that the problem is 
that it contains a character which is not defined in your terminal's 
codepage. So let's inspect the strings more carefully:


py a = uµm
py b = u\u03bcm
py a == b
False
py ord(a[0]), ord(b[0])
(181, 956)
py import unicodedata
py unicodedata.name(a[0])
'MICRO SIGN'
py unicodedata.name(b[0])
'GREEK SMALL LETTER MU'

Does codepage 850 include Greek Small Letter Mu? The evidence suggests it 
does not.

If you can, you should set the terminal's encoding to UTF-8. That will 
avoid this sort of problem.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Unicode

2013-03-15 Thread Duncan Booth
Thomas Heller thel...@ctypes.org wrote:

output
 æm
 Traceback (most recent call last):
File x.py, line 7, in module
  print(b)
File C:\Python33-64\lib\encodings\cp850.py, line 19, in encode
  return codecs.charmap_encode(input,self.errors,encoding_map)[0]
 UnicodeEncodeError: 'charmap' codec can't encode character '\u03bc' in 
 position 0: character maps to undefined
/output
 
 Using (german) windows, command prompt, codepage 850.
 
 The same happens with Python 2.7.  What am I doing wrong?
 

They are different characters:

 repr(a)
u'\\xb5m'
 repr(b)
u'\\u03bcm'

a contains unicode MICRO SIGN, b contains GREEK SMALL LETTER MU

-- 
Duncan Booth http://kupuguy.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Im fetching data from excel using python code.. i could see some junk value also with it.

2013-03-15 Thread s . arun316
Hi im fetching data from excel using python code.. i could see some junk value 
also with it. like [text:u

How to remove it.. below is the code



code
from xlrd import open_workbook
from win32com.client import Dispatch
book = open_workbook('C:/Users/742123/Desktop/test.xls')
sheet0 = book.sheet_by_index(0)
#sheet1 = book.sheet_by_index(1)

print sheet0.col(0) 
print sheet0.col(2)
print sheet0.col(3)
print sheet0.col(4)
print sheet0.col(5)
print sheet0.col(6)
print sheet0.col(7)
print sheet0.col(8)
print sheet0.col(9)
print sheet0.col(10)
print sheet0.col(12)
print sheet0.col(13)
print sheet0.col(14)
print sheet0.col(15)
print sheet0.col(16)
print sheet0.col(17)
print sheet0.col(18)
print sheet0.col(19)
print sheet0.col(20)
print sheet0.col(21)
print sheet0.col(22)
print sheet0.col(23)
print sheet0.col(24)
print sheet0.col(25)
print sheet0.col(26)
print sheet0.col(27)
/code
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Unicode

2013-03-15 Thread Thomas Heller

Am 15.03.2013 11:58, schrieb Steven D'Aprano:

On Fri, 15 Mar 2013 11:46:36 +0100, Thomas Heller wrote:

[Windows: Problems with unicode output to console]


You can isolate the error by noting that the second one only raises an
exception when you try to print it. That suggests that the problem is
that it contains a character which is not defined in your terminal's
codepage. So let's inspect the strings more carefully:


py a = uµm
py b = u\u03bcm
py a == b
False
py ord(a[0]), ord(b[0])
(181, 956)
py import unicodedata
py unicodedata.name(a[0])
'MICRO SIGN'
py unicodedata.name(b[0])
'GREEK SMALL LETTER MU'

Does codepage 850 include Greek Small Letter Mu? The evidence suggests it
does not.

If you can, you should set the terminal's encoding to UTF-8. That will
avoid this sort of problem.


Thanks for the clarification.

For the archives: Setting the console codepage to 65001 and the font to 
lucida console helps.


Thomas

--
http://mail.python.org/mailman/listinfo/python-list


wxgrid - is there an easy way to set alignment of a column?

2013-03-15 Thread tinnews
I'm using wxGrid and finding it fairly straightforward but I can't see
an easy way to set the alignment (left, centre, right) for a whole
column. 

There's SetDefaultCellAlignment() which sets the default for the whole
grid and there's SetCellAlignment() which sets it for a specific cell
but there seems to be no way to set the default alignment for a column.

Am I missing something or do I need to do it for individual cells as I
load the data?

-- 
Chris Green
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to couper contenier of a canvas in an outer canvas???

2013-03-15 Thread olsr . kamal
i maybe don't talk english very well but at least i am not a Rude,and you are 
not obligated to answering  me much less  Mocking  me ,i assure  you that  i 
will not post anything anymore jackass
thank you  alex23
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to couper contenier of a canvas in an outer canvas???

2013-03-15 Thread Stefan Behnel
olsr.ka...@gmail.com, 15.03.2013 13:00:
 i maybe don't talk english very well but at least i am not a Rude,and you are 
 not obligated to answering  me much less  Mocking  me ,i assure  you that  i 
 will not post anything anymore jackass
 thank you  alex23

As Chris pointed out, the real problem was that you were not clear at all
in your post about what your problem was. If you had taken a bit more time
explaining it, maybe even showing a bit of code that makes it clear what
you tried and what did not work about it, you would have made it much
clearer that you are a person worth responding to.

Basically, the question is, if you do not care enough yourself to pose an
understandable question (and I mean the actual content, regardless of any
language comprehension deficiencies etc.), why do you think we should care
enough about it to try to understand it and even answer it?

This might help you in asking better questions next time:

http://catb.org/~esr/faqs/smart-questions.html

Note that there is also a list of translations, a couple of which might be
easier to read for you:

http://catb.org/~esr/faqs/smart-questions.html#translations

Stefan


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What's the easiest Python datagrid GUI (preferably with easy database hooks as well)?

2013-03-15 Thread Sibylle Koczian

Am 14.03.2013 14:24, schrieb Wolfgang Keller:

This is becoming an FAQ.

The currently available (non-web) database application development
frameworks for Python are:

using wxPython:
Dabohttp://www.dabodev.com
Defis   http://sourceforge.net/projects/defis/ (Russian only)
GNUehttp://www.gnuenterprise.org/

using PyQt:
Pypapi  https://pypi.python.org/pypi/PyPaPi
Camelot http://www.python-camelot.com/
Qtalchemy   http://www.qtalchemy.org/
Thyme   http://clocksoft.co.uk/downloads/
Kexihttp://www.kexi-project.org/

using PyGTK:
SQLkit  http://sqlkit.argolinux.org/
Kiwihttp://www.async.com.br/projects/kiwi/
Glomhttp://www.glom.org

Openoffice Base
http://www.openoffice.org/product/base.html
Libreoffice Base
http://www.libreoffice.org/features/base/

OpenERP http://www.openerp.org
Tryton  http://www.tryton.org

Dabo (they're about to release 1.0 for Pycon), Pypapi, Camelot, SQLkit
seem to be the most actively developed and best documented ones.



Very helpful collection, only one open question: which of them work with 
Python 3? Not Dabo, sadly, because wxPython doesn't. And not Camelot 
when I last looked (some weeks ago, though).


Will look at Pypapi and SQLkit.

Sibylle

--
http://mail.python.org/mailman/listinfo/python-list


Re: how to couper contenier of a canvas in an outer canvas???

2013-03-15 Thread Dave Angel

On 03/15/2013 08:00 AM, olsr.ka...@gmail.com wrote:

i maybe don't talk english very well but at least i am not a Rude,and you are 
not obligated to answering  me much less  Mocking  me ,i assure  you that  i 
will not post anything anymore jackass
thank you  alex23



Note also that you were insulted by a noted troll generator here (notice 
his pseudo-name, Ranting Rick), one that many of us have kill-filed to 
avoid reading his posts.  Most newcomers to mailing lists will omit some 
details in their queries, and we try to help fill in the details.


Sometimes what might help if you think you might be misunderstood is to 
pose the query in more than one way, or give some example code, or 
something so we can fill in the missing or misunderstood pieces.


Start by specifying the environment you're using (python version, 
operating system, any 3rd party libraries).  Then include enough code 
that we know exactly what you mean by canvas.


--
DaveA
--
http://mail.python.org/mailman/listinfo/python-list


OpenOpt Suite release 0.45

2013-03-15 Thread dmitrey15
Hi all,

I'm glad to inform you about new OpenOpt Suite release 0.45 (2013-March-15):
  * Essential improvements for FuncDesigner interval analysis (thus affect 
solver interalg)
  * Temporary walkaround for a serious bug in FuncDesigner automatic 
differentiation kernel due to a bug in some versions of Python or NumPy, may 
affect optimization problems, including (MI)LP, (MI)NLP, TSP etc
  * Some other minor bugfixes and improvements

---

Regards, D.
http://openopt.org/Dmitrey
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to couper contenier of a canvas in an outer canvas???

2013-03-15 Thread rusi

I dont usually bother about spelling/grammar etc. And I think it silly
to do so on a python list.

However with this question:

On Mar 14, 5:16 pm, olsr.ka...@gmail.com wrote:
 how to couper all the obejcts in a canvas in an auther canvas?

obejcts is clearly objects
and auther is probably other

But what the *^* is couper?
I first thought it was couple
It could be copy as Rick understood
By some stretch it could even be cope

So yes grammar/spellings etc dont matter... as long as we are within
the bounds of comprehension!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OpenOpt Suite release 0.45

2013-03-15 Thread Stefan Behnel
dmitre...@gmail.com, 15.03.2013 14:36:
 I'm glad to inform you about new OpenOpt Suite release 0.45 (2013-March-15):
   * Essential improvements for FuncDesigner interval analysis (thus affect 
 solver interalg)
   * Temporary walkaround for a serious bug in FuncDesigner automatic 
 differentiation kernel due to a bug in some versions of Python or NumPy, may 
 affect optimization problems, including (MI)LP, (MI)NLP, TSP etc
   * Some other minor bugfixes and improvements

Hi,

two comments:

1) You might want to send announcements to the dedicated python-announce
mailing list instead of the general Python mailing list.

2) When you send a software release announcement to a mailing list with an
audience as broad as python-list or python-announce, don't expect others to
already know what you are talking about. It's a good idea (and a nice
touch) to add a short and generally understandable (i.e. using no special
purpose terminology) paragraph to your announcement that tells readers what
the software does and why it would be interesting for them. Usually, that
substantially increases the impact of your announcement, because most
people will just ignore release announcements that they do not immediately
understand, assuming (correctly or incorrectly) that the software is not
meant to be used by them.

Stefan


-- 
http://mail.python.org/mailman/listinfo/python-list


About Starting PYTHON

2013-03-15 Thread SHIVDHWAJ PANDEY
Hi,
I am new to this and wanted to know how to start python?
Which book,website, blog, etc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: About Starting PYTHON

2013-03-15 Thread rusi
On Mar 15, 7:10 pm, SHIVDHWAJ PANDEY shivdh...@gmail.com wrote:
 Hi,
 I am new to this and wanted to know how to start python?
 Which book,website, blog, etc.

http://docs.python.org/2/tutorial/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to couper contenier of a canvas in an outer canvas???

2013-03-15 Thread Jean-Michel Pichavant
- Original Message -
 
 I dont usually bother about spelling/grammar etc. And I think it
 silly
 to do so on a python list.
 
 However with this question:
 
 On Mar 14, 5:16 pm, olsr.ka...@gmail.com wrote:
  how to couper all the obejcts in a canvas in an auther canvas?
 
 obejcts is clearly objects
 and auther is probably other
 
 But what the *^* is couper?
 I first thought it was couple
 It could be copy as Rick understood
 By some stretch it could even be cope
 
 So yes grammar/spellings etc dont matter... as long as we are within
 the bounds of comprehension!

couper is probably a french word, I've seen some of the OP's threads written in 
french.

It means cut.

He probably wants to cut some objects in a canvas and paste them in another.

JM


-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be 
privileged. If you are not the intended recipient, please notify the sender 
immediately and do not disclose the contents to any other person, use it for 
any purpose, or store or copy the information in any medium. Thank you.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to couper contenier of a canvas in an outer canvas???

2013-03-15 Thread Chris Angelico
On Sat, Mar 16, 2013 at 1:52 AM, Jean-Michel Pichavant
jeanmic...@sequans.com wrote:
 - Original Message -

 I dont usually bother about spelling/grammar etc. And I think it
 silly
 to do so on a python list.

 However with this question:

 On Mar 14, 5:16 pm, olsr.ka...@gmail.com wrote:
  how to couper all the obejcts in a canvas in an auther canvas?

 obejcts is clearly objects
 and auther is probably other

 But what the *^* is couper?
 I first thought it was couple
 It could be copy as Rick understood
 By some stretch it could even be cope

 So yes grammar/spellings etc dont matter... as long as we are within
 the bounds of comprehension!

 couper is probably a french word, I've seen some of the OP's threads written 
 in french.

 It means cut.

 He probably wants to cut some objects in a canvas and paste them in 
 another.

Ah. Not having any real comprehension of French, I was thinking along
the lines of copy, which thus wouldn't be very far wrong. However,
it still stands that the message would have been a lot more
comprehensible with a bit more detail.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to couper contenier of a canvas in an outer canvas???

2013-03-15 Thread Jean-Michel Pichavant


- Original Message -
 On Sat, Mar 16, 2013 at 1:52 AM, Jean-Michel Pichavant
  couper is probably a french word, I've seen some of the OP's
  threads written in french.
 
  It means cut.
 
  He probably wants to cut some objects in a canvas and paste
  them in another.
 
 Ah. Not having any real comprehension of French, I was thinking along
 the lines of copy, which thus wouldn't be very far wrong. However,
 it still stands that the message would have been a lot more
 comprehensible with a bit more detail.
 
 ChrisA
 --
 http://mail.python.org/mailman/listinfo/python-list


See 
http://mail.python.org/pipermail/python-list/2013-March/642708.html

I can tell that even in a correct French, the OP gives very few details anyway.
He must have lost a bet, and now can only ask questions with 1 subject, 1 verb, 
no greeting.

JM




-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be 
privileged. If you are not the intended recipient, please notify the sender 
immediately and do not disclose the contents to any other person, use it for 
any purpose, or store or copy the information in any medium. Thank you.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxgrid - is there an easy way to set alignment of a column?

2013-03-15 Thread Ian Kelly
On Fri, Mar 15, 2013 at 5:50 AM,  tinn...@isbd.co.uk wrote:
 I'm using wxGrid and finding it fairly straightforward but I can't see
 an easy way to set the alignment (left, centre, right) for a whole
 column.

 There's SetDefaultCellAlignment() which sets the default for the whole
 grid and there's SetCellAlignment() which sets it for a specific cell
 but there seems to be no way to set the default alignment for a column.

 Am I missing something or do I need to do it for individual cells as I
 load the data?

You can use SetColAttr() to set attributes over a whole column.
-- 
http://mail.python.org/mailman/listinfo/python-list


PyDev 2.7.2 Released / Help to keep PyDev alive

2013-03-15 Thread Fabio Zadrozny
Hi All,

PyDev 2.7.2 has been released and needs help to be kept being developed.


Release Highlights


* Updated icons in PyDev to match better a dark theme.
* Improved minimap.
* Fixed issue copying qualified name when editor is not in the PYTHONPATH.
* Removed call home ping from PyDev.
* Fixed issue on Ctrl+1 assist to ignore some warning.
* Improved comment/uncomment to deal properly with pep8 formatting.


Helping PyDev
---

Currently, PyDev is raising funds so that it's development can be continued
and a lightweight toolchain for editors inside Eclipse can complement it.

Please help keeping PyDev alive! More details can be seen at:
http://igg.me/at/liclipse


What is PyDev?
---

PyDev is a plugin that enables users to use Eclipse for Python, Jython and
IronPython development -- making Eclipse a first class Python IDE -- It
comes with many goodies such as code completion, syntax highlighting,
syntax analysis, refactor, debug and many others.


Cheers,

-- 
Fabio Zadrozny
--
Software Developer

PyDev - Python Development Environment for Eclipse
http://pydev.org
http://pydev.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list


REG PYTHON developer

2013-03-15 Thread ram . nyvasoft

urgently looking for python developer  for contract opportunity for one our 
financial client.

Location: NYC, NY
Contract: 12 Months


4 to 8 years of Developer experience. 
Excellent coding and design skills. Software that works is reliable,  testable 
and maintainable should be what you do by default. 
You enjoy writing software and take pride in what you build. 
SOL proficiency, particularly with PostgreSQL is a plus.
Strong communications skills, both written and verbal.

Thanks  Regards,
 Ram
i3 Software
100 Wood Avenue South, Suite 105
Iselin, NJ, 08830
(O) 703 953 2828
 
Think Green: Please consider the environment before printing this e-mail.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: String performance regression from python 3.2 to 3.3

2013-03-15 Thread rusi
3.2 and 2.7 results on my desktop using Chris examples
(Hope I cut-pasted them correctly)
-
Welcome to the Emacs shell

~ $ python3
Python 3.2.3 (default, Feb 20 2013, 17:02:41)
[GCC 4.7.2] on linux2
Type help, copyright, credits or license for more information.
 from timeit import timeit
 timeit(s=s[:-1]+'\u0034',s='asdf'*1,number=1)
0.2893378734588623
 timeit(s=s[:-1]+'\u1234',s='asdf'*1,number=1)
0.2842249870300293

 timeit(s=s[:-1]+'\u1234',s='\u1234sdf'*1,number=1)
0.28406381607055664
 timeit(s=s[:-1]+'\U00012345',s='asdf'*1,number=1)
0.28420209884643555
 timeit(s=s[:-1]+'\U00012345',s='\u1234sdf'*1,number=1)
0.2853250503540039
 timeit(s=s[:-1]+'\U00012345',s='\U00012345sdf'*1,number=1)
0.283905029296875


~ $ python
Python 2.7.3 (default, Jan  2 2013, 16:53:07)
[GCC 4.7.2] on linux2
Type help, copyright, credits or license for more information.
 from timeit import timeit
 timeit(s=s[:-1]+'\u0034',s='asdf'*1,number=1)
0.20418286323547363
 timeit(s=s[:-1]+'\u1234',s='asdf'*1,number=1)

0.20579099655151367
 timeit(s=s[:-1]+'\u1234',s='\u1234sdf'*1,number=1)
0.5055279731750488
 timeit(s=s[:-1]+'\U00012345',s='asdf'*1,number=1)
0.28449511528015137
 timeit(s=s[:-1]+'\U00012345',s='\u1234sdf'*1,number=1)
0.6001529693603516
 timeit(s=s[:-1]+'\U00012345',s='\U00012345sdf'*1,number=1)
0.8430721759796143
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What's the easiest Python datagrid GUI (preferably with easy database hooks as well)?

2013-03-15 Thread Mark Lawrence

On 15/03/2013 12:36, Sibylle Koczian wrote:


Very helpful collection, only one open question: which of them work with
Python 3? Not Dabo, sadly, because wxPython doesn't. And not Camelot
when I last looked (some weeks ago, though).

Will look at Pypapi and SQLkit.

Sibylle




Note that wxPython is getting there with its so called Phoenix see 
http://wxpython.org/Phoenix/snapshot-builds/


--
Cheers.

Mark Lawrence

--
http://mail.python.org/mailman/listinfo/python-list


PSF Python Brochure available as PDF preview. Last chance to order your ad!

2013-03-15 Thread PSF Python Brochure Project Team
The first full format pre-production issues were shown at several
Python conferences throughout the last year and caused a lot of
excitement among the attendees.

The PSF Python Brochure Project has now finished getting all approvals
from the content providers, so we can finally publish a PDF preview of
the finished brochure for the whole Python community to see.

Please visit our website for more information about the brochure
project:
http://brochure.getpython.info/

This newsletter is also available for online reading:
http://brochure.getpython.info/news/newsletter-5-preview-available



 Finally: After two years in the making,
   the Python brochure is now available as PDF preview!


Please download the PDF preview of the Python brochure and
 have a look:

   http://brochure.getpython.info/pdf-preview


This is your last chance to place your ad in the brochure
=

Your will benefit from reaching out to a fantastic audience, including
Python developers, Python users and many people from around the world,
who don't yet realize what they are missing. This is your chance as a
company to be one of the first to get your name out to these new high
potential future Python users.

You can present your products and consulting services, or show case
your company for recruiting purposes. With over 10,000 printed copies
distributed world-wide this is an excellent way to reach out to new
customers and developers.

As additional benefit, you will also receive a box with high quality
printed brochures to directly present to your customers or use for
recruiting.

Don't miss the opportunity to place your ad in this very first Python
image brochure.


* Ads
-

The brochure will have an addendum with 2 double pages for ads. You
can buy a half page or a full page ad.

After production, you will receive a box of around 120 free copies of
the printed brochure.

We have already sold 6 ads. There is still room for up to 2 half page ads.

* Reference Entry
-

For Python service and consulting companies, we have added a more
affordable option in form of a reference listing with fixed layout on
the last two pages of the Python Brochure.

Each entry will have a full color logo, space for a one line
description of the service and contact details. There is room for
30-40 entries.

We have already sold 5 reference entries. There is still room for up
to 25-35 reference entries.

* Pricing
-

 * A half page ad costs EUR 2,650.00 (+ 19% German VAT, if applicable)

 * A full page ad costs EUR 5,300.00 (+ 19% German VAT, if applicable)

 * A reference entry can be purchased for EUR 500.00 (+ 19% German
   VAT, if applicable)

* Ad Placement
--

We follow first pay, first serve until all ad slots are
booked. Subsequent orders will be placed on a waiting list for the
next edition.

Individual ad placement is not possible.


Deadline for Data  Approval


The deadline for data delivery is April 30 2013.

You will receive a professional software proof PDF of your page prior
to printing with 2 days left for approval and final corrections.

For full technical details regarding data submission, formats and
specifications for the ad content, please consult our Ad Guidelines.


Ordering Procedure
==

For the order you will be redirected to the secure SSL encrypted site
hosted by our production partner evenios publishing. The terms 
conditions and data privacy statement for the order are published on
encrypted.evenios.com .

Please note that the payment is not processed by the PSF! You will
receive an invoice issued by evenios publishing, the company producing
and distributing the brochure.

Order a half page ad

https://encrypted.evenios.com/en/mediadata/cart/order-forms/ad-sponsorship-order-form-1-2-page

Order a full page ad

https://encrypted.evenios.com/en/mediadata/cart/order-forms/ad-sponsorship-order-form-1-1-page

Order a reference entry sponsorship
---
https://encrypted.evenios.com/en/mediadata/cart/order-forms/reference-sponsorship-entry-order-form


Thanks,
-- 
Marc-Andre Lemburg
PSF Vice Chairman / PSF Python Brochure Team
___
 Website:http://brochure.getpython.info/
 Twitter: https://twitter.com/pythonbrochure
 EMail:  broch...@getpython.info
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: String performance regression from python 3.2 to 3.3

2013-03-15 Thread Andriy Kornatskyy
$ python3.2
Python 3.2.3 (default, Jun 25 2012, 22:55:05) 
[GCC 4.6.3] on linux2
Type help, copyright, credits or license for more information.
 from timeit import repeat
 repeat(s=s[:-1]+'\u0034',s='asdf'*1,number=1)
[0.2566258907318115, 0.14485502243041992, 0.14464998245239258]
 repeat(s=s[:-1]+'\u1234',s='asdf'*1,number=1)
[0.25584888458251953, 0.1340939998626709, 0.1338820457458496]
 repeat(s=s[:-1]+'\u1234',s='\u1234sdf'*1,number=1)
[0.2571289539337158, 0.13403892517089844, 0.13388800621032715]
 repeat(s=s[:-1]+'\U00012345',s='asdf'*1,number=1)
[0.5022759437561035, 0.3970041275024414, 0.3764481544494629]
 repeat(s=s[:-1]+'\U00012345',s='\u1234sdf'*1,number=1)
[0.5213770866394043, 0.38585615158081055, 0.40251588821411133]
 repeat(s=s[:-1]+'\U00012345',s='\U00012345sdf'*1,number=1)
[0.768744945526123, 0.5852570533752441, 0.6029140949249268]

$ python3.3
Python 3.3.0 (default, Sep 29 2012, 15:35:49) 
[GCC 4.7.1] on linux
Type help, copyright, credits or license for more information.
 from timeit import repeat
 repeat(s=s[:-1]+'\u0034',s='asdf'*1,number=1)
[0.0985728640225716, 0.0984080360212829, 0.07457763599813916]
 repeat(s=s[:-1]+'\u1234',s='asdf'*1,number=1)
[0.901988381985575, 0.7517840950167738, 0.7540924890199676]
 repeat(s=s[:-1]+'\u1234',s='\u1234sdf'*1,number=1)
[0.3069786810083315, 0.17701858800137416, 0.1769046070112381]
 repeat(s=s[:-1]+'\U00012345',s='asdf'*1,number=1)
[1.081760977016529, 0.9099628589756321, 0.9926943230093457]
 repeat(s=s[:-1]+'\U00012345',s='\u1234sdf'*1,number=1)
[1.2101859120011795, 1.1039280130062252, 0.9306247030035593]
 repeat(s=s[:-1]+'\U00012345',s='\U00012345sdf'*1,number=1)
[0.4759294819959905, 0.35435649199644104, 0.3540659479913302]



 Date: Fri, 15 Mar 2013 10:07:48 -0700
 Subject: Re: String performance regression from python 3.2 to 3.3
 From: rustompm...@gmail.com
 To: python-list@python.org

 3.2 and 2.7 results on my desktop using Chris examples
 (Hope I cut-pasted them correctly)
 -
 Welcome to the Emacs shell

 ~ $ python3
 Python 3.2.3 (default, Feb 20 2013, 17:02:41)
 [GCC 4.7.2] on linux2
 Type help, copyright, credits or license for more information.
  from timeit import timeit
  timeit(s=s[:-1]+'\u0034',s='asdf'*1,number=1)
 0.2893378734588623
  timeit(s=s[:-1]+'\u1234',s='asdf'*1,number=1)
 0.2842249870300293

  timeit(s=s[:-1]+'\u1234',s='\u1234sdf'*1,number=1)
 0.28406381607055664
  timeit(s=s[:-1]+'\U00012345',s='asdf'*1,number=1)
 0.28420209884643555
  timeit(s=s[:-1]+'\U00012345',s='\u1234sdf'*1,number=1)
 0.2853250503540039
  timeit(s=s[:-1]+'\U00012345',s='\U00012345sdf'*1,number=1)
 0.283905029296875
 

 ~ $ python
 Python 2.7.3 (default, Jan 2 2013, 16:53:07)
 [GCC 4.7.2] on linux2
 Type help, copyright, credits or license for more information.
  from timeit import timeit
  timeit(s=s[:-1]+'\u0034',s='asdf'*1,number=1)
 0.20418286323547363
  timeit(s=s[:-1]+'\u1234',s='asdf'*1,number=1)

 0.20579099655151367
  timeit(s=s[:-1]+'\u1234',s='\u1234sdf'*1,number=1)
 0.5055279731750488
  timeit(s=s[:-1]+'\U00012345',s='asdf'*1,number=1)
 0.28449511528015137
  timeit(s=s[:-1]+'\U00012345',s='\u1234sdf'*1,number=1)
 0.6001529693603516
  timeit(s=s[:-1]+'\U00012345',s='\U00012345sdf'*1,number=1)
 0.8430721759796143
 --
 http://mail.python.org/mailman/listinfo/python-list   
   
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxgrid - is there an easy way to set alignment of a column?

2013-03-15 Thread tinnews
Ian Kelly ian.g.ke...@gmail.com wrote:
 On Fri, Mar 15, 2013 at 5:50 AM,  tinn...@isbd.co.uk wrote:
  I'm using wxGrid and finding it fairly straightforward but I can't see
  an easy way to set the alignment (left, centre, right) for a whole
  column.
 
  There's SetDefaultCellAlignment() which sets the default for the whole
  grid and there's SetCellAlignment() which sets it for a specific cell
  but there seems to be no way to set the default alignment for a column.
 
  Am I missing something or do I need to do it for individual cells as I
  load the data?
 
 You can use SetColAttr() to set attributes over a whole column.

Ah, yes, thank you.  It's a bit of a long way round though and, in my
case I think it's simpler just to use SetCellAlignment().

-- 
Chris Green
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to couper contenier of a canvas in an outer canvas???

2013-03-15 Thread Rick Johnson
On Friday, March 15, 2013 7:00:15 AM UTC-5, olsr@gmail.com wrote:
 i maybe don't talk english very well but at least i am not
 a Rude,and you are not obligated to answering  me much
 less  Mocking  me ,i assure  you that  i will not post
 anything anymore jackass
 
 thank you  alex23

Well *WELL*. What happened? Your English is so articulate now. Hmm, maybe you 
can only write clearly when you are angry, OR, maybe you ordered Rosetta 
Stone (you know, the cheesy language learning product from those late night TV 
infomercials, the one where users (oops i meant actors) of the product offer 
intelligent testimonials like this:

 Man: ...it was purdy guud!
 Woman: If you can click a mouse, then, your pretty set!

*FACEPALM*: Evolution has forsaken us all!

However, i will place all my money on the fact that you are nothing more than 
an agent provocateur ...(psst: you should understand that word because it is 
French!)... hell bent on an insidious mission of reverse trolling; which is 
evident by your inability to distinguish emotional troll posts from logical 
and informative replies (whether acerbic or not). I'll allow the intelligent 
folks among us to come to their own conclusions as to your *real* intentions.

However, if you are in-fact real (and i use that term quite loosely), then 
you sir are a fine example of what is wrong with people today. In any event, i 
wish you good luck with your learning adventures.

PS: If you don't like my replies then you need to exercise your freedom by 
ignoring them. You have a right to be offended, and i have a right not to give 
a DAMN!

Cheers
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to couper contenier of a canvas in an outer canvas???

2013-03-15 Thread Rick Johnson
how to couper all the obejcts in a canvas in an auther canvas?
On Friday, March 15, 2013 9:09:41 AM UTC-5, rusi wrote:

 I dont usually bother about spelling/grammar etc. And I
 think it silly to do so on a python list. However with
 this question:
 
 On Mar 14, 5:16 pm, olsr.ka...@gmail.com wrote:
  how to couper all the obejcts in a canvas in an auther
  canvas?
 
 obejcts is clearly objects
 and auther is probably other
 
 But what the *^* is couper?
 I first thought it was couple

Indeed. He could have meant to say:

  Quote = \
  How to couple all object in one canvas with corresponding
  objects in another canvas so that edits in one canvas are
  reflected in the objects of another canvas.
  
 
It would be a strange request, but i have witnessed much stranger. 

But even *IF* we could interpret such cryptic words as coupler and auther, 
we would still have no idea what the word canvas is referring to. I mean, we 
could postulate that it is probably a 2D or 3D graphics window, but even then, 
which GUI library (or gfx library) is he referring to? Maybe he's asking 
questions about WebGL? WHO KNOWS?

A real person would think: oops, i was far too ambiguous with my first 
question, better re-phrase my question now!. 

An agent provocateur would think: Got him! Now pretend to be a helpless 
little student who's just been brow beaten by an overbearing intellectual 
heavy weight and cry loudly in the corner so everyone will feel sorry for me. 

*wah* 

*wah-wah* 

[peeks over shoulder with quivering lips to see if people are watching]

passive voice: ITS WORKING!!!

[quickly turns back to corner and ratchets up the emotion]

*sobbing*

*choking*

*sniffling*

What a PATHETIC display!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: String performance regression from python 3.2 to 3.3

2013-03-15 Thread Thomas 'PointedEars' Lahn
Chris Angelico wrote:

 Thomas 'PointedEars' Lahn […] wrote:
 Chris Angelico wrote:
 jmf, I'd like to see evidence that there has been a performance
 regression compared against a wide build of Python 3.2. You still have
 never answered this fundamental, that the narrow builds of Python are
 *BUGGY* in the same way that JavaScript/ECMAScript is.

 Interesting.  From my work I was under the impression that I knew
 ECMAScript and its implementations fairly well, yet I have never heard of
 this before.

 What do you mean by “narrow build” and “wide build” and what exactly is
 the bug “narrow builds” of Python 3.2 have in common with
 JavaScript/ECMAScript? To which implementation of ECMAScript are you
 referring – or are you referring to the Specification as such?
 
 The ECMAScript spec says that strings are stored and represented in
 UTF-16.

No, it does not (which Edition?).  It says in Edition 5.1:

| 8.4 The String Type
| 
| The String type is the set of all finite ordered sequences of zero or more
| 16-bit unsigned integer values (“elements”). […] Each element is regarded
| as occupying a position within the sequence. These positions are indexed
| with nonnegative integers.  The first element (if any) is at position 0,
| the next element (if any) at position 1, and so on. The length of a
| String is the number of elements (i.e., 16-bit values) within it. 
| 
| […]
| When a String contains actual textual data, each element is considered to
| be a single UTF-16 code unit.  Whether or not this is the actual storage
| format of a String, the characters within a String are numbered by
| their initial code unit element position as though they were represented
| using UTF-16. All operations on Strings (except as otherwise stated) treat
| them as sequences of undifferentiated 16-bit unsigned integers; they do
| not ensure the resulting String is in normalised form, nor do they ensure
| language-sensitive results.
| 
| NOTE
| The rationale behind this design was to keep the implementation of Strings
| as simple and high-performing as possible. The intent is that textual data
| coming into the execution environment from outside (e.g., user input, text
| read from a file or received over the network, etc.) be converted to
| Unicode Normalised Form C before the running program sees it. Usually this
| would occur at the same time incoming text is converted from its original
| character encoding to Unicode (and would impose no additional overhead).
| Since it is recommended that ECMAScript source code be in Normalised Form
| C, string literals are guaranteed to be normalised (if source text is
| guaranteed to be normalised), as long as they do not contain any Unicode
| escape sequences.

 You can see the same thing in Javascript too. Here's a little demo I
 just knocked together:
 
 script
 function foo()
 {
 var txt=document.getElementById(in).value;
 var msg=;
 for (var i=0;itxt.length;++i) msg+=[+i+]: +txt.charCodeAt(i)+
 +txt.charCodeAt(i).toString(16)+\n;
 document.getElementById(out).value=msg;
 }
 /script
 input id=ininput type=button onclick=foo()
 value=Showbrtextarea id=out rows=25 cols=80/textarea

What an awful piece of code.

 Give it an ASCII string

You mean a string of Unicode characters that can also be represented with 
the US-ASCII encoding.  There are no ASCII strings in conforming 
ECMAScript implementations.  And a string of Unicode characters with code 
points within the BMP will suffice already.

 and you'll see, as expected, one index (based on string indexing or
 charCodeAt, same thing) for each character. Same if it's all BMP. But put
 an astral character in and you'll see 00.00.d8.00/24 (oh wait, CIDR
 notation doesn't work in Unicode) come up. I raised this issue on the
 Google V8 list and on the ECMAScript list es-disc...@mozilla.org, and was
 basically told that since JavaScript has been buggy for so long, there's
 no chance of ever making it bug-free:
 
 https://mail.mozilla.org/pipermail/es-discuss/2012-December/027384.html

You misunderstand, and I am not buying Rick's answer.  The problem is not 
that String values are defined as units of 16 bits.  The problem is that the 
length of a primitive String value in ECMAScript, and the position of a 
character, is defined in terms of 16-bit units instead of characters.  There 
is no bug, because ECMAScript specifies that Unicode characters beyond the 
Basic Multilingual Plane (BMP) need not be supported:

| 2 Conformance
| 
| A conforming implementation of this Standard shall interpret characters in
| conformance with the Unicode Standard, Version 3.0 or later and ISO/IEC
| 10646-1 with either UCS-2 or UTF-16 as the adopted encoding form,
| implementation level 3. If the adopted ISO/IEC 10646-1 subset is not
| otherwise specified, it is presumed to be the BMP subset, collection 300.
| If the adopted encoding form is not otherwise specified, it presumed to
| be the UTF-16 encoding form.

But they can:

| A conforming implementation of 

Re: String performance regression from python 3.2 to 3.3

2013-03-15 Thread Mark Lawrence

On 16/03/2013 02:44, Thomas 'PointedEars' Lahn wrote:

Chris Angelico wrote:



Thomas and Chris, would the two of you be kind enough to explain to 
morons such as myself how all the ECMAScript stuff relates to Python's 
unicode as implemented via PEP 393 as you've lost me, easily done I know.


--
Cheers.

Mark Lawrence

--
http://mail.python.org/mailman/listinfo/python-list


Re: String performance regression from python 3.2 to 3.3

2013-03-15 Thread Chris Angelico
On Sat, Mar 16, 2013 at 1:44 PM, Thomas 'PointedEars' Lahn
pointede...@web.de wrote:
 Chris Angelico wrote:
 The ECMAScript spec says that strings are stored and represented in
 UTF-16.

 No, it does not (which Edition?).  It says in Edition 5.1:

Okay, I was sloppy in my terminology. A language will seldom, if ever,
specify the actual storage. But it does specify a representation (to
the script) of UTF-16, and I seriously cannot imagine any reason for
an implementation to store a string in any other way, given that
string indexing is specifically based on UTF-16:

 | The length of a
 | String is the number of elements (i.e., 16-bit values) within it.
 |
 | […]
 | When a String contains actual textual data, each element is considered to
 | be a single UTF-16 code unit.  Whether or not this is the actual storage
 | format of a String, the characters within a String are numbered by
 | their initial code unit element position as though they were represented
 | using UTF-16.

So, yes, it could be stored in some other way, but in terms of what I
was saying (comparing against Python 3.2 and 3.3), it's still a
specification that doesn't allow for the change that Python did. If
narrow builds are all you compare against (as jmf does), then Python
3.2 is exactly like ECMAScript, and Python 3.3 isn't.

 You can see the same thing in Javascript too. Here's a little demo I
 just knocked together:

 script
 function foo()
 {
 var txt=document.getElementById(in).value;
 var msg=;
 for (var i=0;itxt.length;++i) msg+=[+i+]: +txt.charCodeAt(i)+
 +txt.charCodeAt(i).toString(16)+\n;
 document.getElementById(out).value=msg;
 }
 /script
 input id=ininput type=button onclick=foo()
 value=Showbrtextarea id=out rows=25 cols=80/textarea

 What an awful piece of code.

Ehh, it's designed to be short, not beautiful. Got any serious
criticisms of it? It demonstrates what I'm talking about without being
a page of code.

 Give it an ASCII string

 You mean a string of Unicode characters that can also be represented with
 the US-ASCII encoding.  There are no ASCII strings in conforming
 ECMAScript implementations.  And a string of Unicode characters with code
 points within the BMP will suffice already.

You can get a string of ASCII characters and paste them into the entry
field. They'll be turned into Unicode characters before the script
sees them. But yes, okay, my terminology was a bit sloppy.

 and you'll see, as expected, one index (based on string indexing or
 charCodeAt, same thing) for each character. Same if it's all BMP. But put
 an astral character in and you'll see 00.00.d8.00/24 (oh wait, CIDR
 notation doesn't work in Unicode) come up. I raised this issue on the
 Google V8 list and on the ECMAScript list es-disc...@mozilla.org, and was
 basically told that since JavaScript has been buggy for so long, there's
 no chance of ever making it bug-free:

 https://mail.mozilla.org/pipermail/es-discuss/2012-December/027384.html

 You misunderstand, and I am not buying Rick's answer.  The problem is not
 that String values are defined as units of 16 bits.  The problem is that the
 length of a primitive String value in ECMAScript, and the position of a
 character, is defined in terms of 16-bit units instead of characters.  There
 is no bug, because ECMAScript specifies that Unicode characters beyond the
 Basic Multilingual Plane (BMP) need not be supported:

So what you're saying is that an ES implementation is allowed to be
even buggier than I described, and that's somehow a justification?

 People have found ways to make this work in ECMAScript implementations.  For
 example, it is possible to scan a normalized string for lead surrogates:

And it's possible to write a fully conforming Unicode handler in C,
using char[] and relying on (say) UTF-8 encoding. That has nothing to
do with the language actually providing facilities.

 But yes, there should be native support for Unicode characters with code
 points beyond the BMP, and evidently that does _not_ require a second
 language; just a few tweaks to the algorithms.

No, it requires either a complete change of the language, or the
acceptance that O(1) operations can now become O(n) on the length of
the string (if the string is left in UTF-16 but indexed in Unicode),
or the creation of a new user-space data type (which then has to be
converted any time it's given to any standard library function).

 Fortunately for Python, there are version numbers, and policies that
 permit bugs to actually get fixed. (Which is why, for instance, Debian
 Squeeze still ships Python 2.6 rather than upgrading to 2.7 - in case
 some script is broken by that change.

 Debian already ships Python 3.1 in Stable, disproving your argument.

Separate branch. Debian stable ships one from each branch; Debian
unstable does, too (2.7.3 and 3.2.3). Same argument applies to each,
though - even Debian unstable hasn't yet introduced Python 3.3, in
case it breaks stuff. Argument not disproved.

 Can't do that with 

Re: String performance regression from python 3.2 to 3.3

2013-03-15 Thread Chris Angelico
On Sat, Mar 16, 2013 at 2:56 PM, Mark Lawrence breamore...@yahoo.co.uk wrote:
 On 16/03/2013 02:44, Thomas 'PointedEars' Lahn wrote:

 Chris Angelico wrote:


 Thomas and Chris, would the two of you be kind enough to explain to morons
 such as myself how all the ECMAScript stuff relates to Python's unicode as
 implemented via PEP 393 as you've lost me, easily done I know.

Sure. Here's the brief version: It's all about how a string is exposed
to a script.

* Python 3.2 Narrow gives you UTF-16. Non-BMP characters count twice.
* Python 3.2 Wide gives you UTF-32. Each character counts once.
* Python 3.3 gives you UTF-32, but will store it as compactly as possible.
* ECMAScript specifies the semantics of Python 3.2 Narrow.

Python 3.2 was either buggy or inefficient. (Generally, Windows builds
were buggy and Linux builds were inefficient, but you could pick at
compilation time.) String indexing followed obvious rules, as long as
everything fitted inside UCS-2, or you paid the
four-bytes-per-character price of a wide build. Otherwise, stuff went
off-kilter. PEP 393 fixed the matter, and the arguments were about
implementation, efficiency, and so on - but (far as I know) nobody
ever argued that the semantics of UTF-16 strings should be kept.
That's the difference with ES - that behaviour, peculiar though it be,
is actually mandated by the spec. I have banged my head against it at
work (amazingly, PHP's complete lack of native Unicode support is
actually easier to work with there - though mainly I just throw the
stuff at PostgreSQL, which will throw an error back if anything's
wrong); it's an insane mandate. But it's part of the spec, and it
can't be changed now.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: String performance regression from python 3.2 to 3.3

2013-03-15 Thread Thomas 'PointedEars' Lahn
Chris Angelico wrote:

 On Sat, Mar 16, 2013 at 1:44 PM, Thomas 'PointedEars' Lahn
 pointede...@web.de wrote:
 Chris Angelico wrote:
 The ECMAScript spec says that strings are stored and represented in
 UTF-16.

 No, it does not (which Edition?).  It says in Edition 5.1:
 
 Okay, I was sloppy in my terminology. A language will seldom, if ever,
 specify the actual storage. But it does specify a representation (to
 the script) of UTF-16,

No, it does not.

 and I seriously cannot imagine any reason for an implementation to store a
 string in any other way, given that string indexing is specifically based
 on UTF-16:

Non sequitur.
 
 | The length of a String is the number of elements (i.e., 16-bit values)
 | within it.
 |
 | […]
 | When a String contains actual textual data, each element is considered
 | to
 | be a single UTF-16 code unit.  Whether or not this is the actual
 | storage format of a String, the characters within a String are numbered
 | by their initial code unit element position as though they were
 | represented using UTF-16.
 
 So, yes, it could be stored in some other way, but in terms of what I
 was saying (comparing against Python 3.2 and 3.3), it's still a
 specification that doesn't allow for the change that Python did.

Yes, it does.  You must have not been reading or understanding what I 
quoted.

 You can see the same thing in Javascript too. Here's a little demo I
 just knocked together:

 script
 function foo()
 {
 var txt=document.getElementById(in).value;
 var msg=;
 for (var i=0;itxt.length;++i) msg+=[+i+]: +txt.charCodeAt(i)+
 +txt.charCodeAt(i).toString(16)+\n;
 document.getElementById(out).value=msg;
 }
 /script
 input id=ininput type=button onclick=foo()
 value=Showbrtextarea id=out rows=25 cols=80/textarea

 What an awful piece of code.
 
 Ehh, it's designed to be short, not beautiful. Got any serious
 criticisms of it?

Better not here, lest another “moron” would complain.

 It demonstrates what I'm talking about without being a page of code.

It could have been written readable and efficient without that.

 Give it an ASCII string

 You mean a string of Unicode characters that can also be represented with
 the US-ASCII encoding.  There are no ASCII strings in conforming
 ECMAScript implementations.  And a string of Unicode characters with code
 points within the BMP will suffice already.
 
 You can get a string of ASCII characters and paste them into the entry
 field.

Not likely these days, no.

 They'll be turned into Unicode characters before the script
 sees them.

They will have become Windows-1252 or even Unicode characters long before.

 But yes, okay, my terminology was a bit sloppy.

It still is.

 and you'll see, as expected, one index (based on string indexing or
 charCodeAt, same thing) for each character. Same if it's all BMP. But
 put an astral character in and you'll see 00.00.d8.00/24 (oh wait, CIDR
 notation doesn't work in Unicode) come up. I raised this issue on the
 Google V8 list and on the ECMAScript list es-disc...@mozilla.org, and
 was basically told that since JavaScript has been buggy for so long,
 there's no chance of ever making it bug-free:

 https://mail.mozilla.org/pipermail/es-discuss/2012-December/027384.html

 You misunderstand, and I am not buying Rick's answer.  The problem is not
 that String values are defined as units of 16 bits.  The problem is that
 the length of a primitive String value in ECMAScript, and the position of
 a character, is defined in terms of 16-bit units instead of characters. 
 There is no bug, because ECMAScript specifies that Unicode characters
 beyond the Basic Multilingual Plane (BMP) need not be supported:
 
 So what you're saying is that an ES implementation is allowed to be
 even buggier than I described, and that's somehow a justification?

No, I am saying that you have no clue what you are talking about.
 
 But yes, there should be native support for Unicode characters with code
 points beyond the BMP, and evidently that does _not_ require a second
 language; just a few tweaks to the algorithms.
 
 No, it requires either a complete change of the language, […]

No, it does not.  Get yourself informed.

 Can't do that with web browsers.)

 Yes, you could.  It has been done before.
 
 Not easily.

You have still no clue what you are talking about.  Get yourself informed at 
least about the (deprecated/obsolete) “language” and the (standards-
compliant) “type” attribute of SCRIPT/“script” elements before you post on 
this again.

-- 
PointedEars
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: String performance regression from python 3.2 to 3.3

2013-03-15 Thread Chris Angelico
On Sat, Mar 16, 2013 at 3:12 PM, Thomas 'PointedEars' Lahn
pointede...@web.de wrote:
 You have still no clue what you are talking about.

Fine. I'll shut up on the topic. Go ahead, the floor is yours, go and
make whatever point you want to make. Clearly I have absolutely no
idea about characters, strings, Unicode, or in fact anything to do
with programming, as I obviously have no real-world experience with
string manipulation in REXX, Perl, PHP, Python, Pike,
JavaScript/ECMAScript/etc, or the language of bash+GNU utilities,
and clearly I should just let the experts discuss this stuff. Have
fun.

ChrisA
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: String performance regression from python 3.2 to 3.3

2013-03-15 Thread rusi
 On Mar 16, 8:56 am, Mark Lawrence breamore...@yahoo.co.uk wrote:
 On 16/03/2013 02:44, Thomas 'PointedEars' Lahn wrote:

  Chris Angelico wrote:

 Thomas and Chris, would the two of you be kind enough to explain to
 morons such as myself how all the ECMAScript stuff relates to Python's
 unicode as implemented via PEP 393 as you've lost me, easily done I know.

 --
 Cheers.

 Mark Lawrence

The unicode standard is language-agnostic.
Unicode implementations exist withing a language x implementation x C-
compiler implementation x …  -- Notice the gccs in Andriy's
comparison. Do they signify?

On Mar 15, 11:04 pm, Andriy Kornatskyy andriy.kornats...@live.com
wrote:
 $ python3.2
 Python 3.2.3 (default, Jun 25 2012, 22:55:05)
 [GCC 4.6.3] on linux2


 $ python3.3
 Python 3.3.0 (default, Sep 29 2012, 15:35:49)
 [GCC 4.7.1] on linux


The number of actual python implementations is small -- 2.7, 3.1, 3.2,
3.3 -- at most enlarged with wides and narrows; The number of possible
implementations is large (in principle infinite) -- a small example of
a point in design-space that is not explored: eg

There are 17 planes x 2^16 chars in a plane
 32 x 2^16
= 2^5 x 2^16
= 2^21

ie wide unicode (including the astral planes) can fit into 21 bits
ie 3 wide-chars can fit into 64 bit slot rather than 2.
Is this option worth considering? Ive no idea and I would wager that
no one does until some trials are done

So… Coming back to your question… Checking what other languages are
doing speeds up the dream-design-implement-performance-check cycle
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: String performance regression from python 3.2 to 3.3

2013-03-15 Thread rusi
On Mar 16, 9:09 am, Chris Angelico ros...@gmail.com wrote:
 On Sat, Mar 16, 2013 at 2:56 PM, Mark Lawrence breamore...@yahoo.co.uk 
 wrote:
  On 16/03/2013 02:44, Thomas 'PointedEars' Lahn wrote:

  Chris Angelico wrote:

  Thomas and Chris, would the two of you be kind enough to explain to morons
  such as myself how all the ECMAScript stuff relates to Python's unicode as
  implemented via PEP 393 as you've lost me, easily done I know.

 Sure. Here's the brief version: It's all about how a string is exposed
 to a script.

 * Python 3.2 Narrow gives you UTF-16. Non-BMP characters count twice.
 * Python 3.2 Wide gives you UTF-32. Each character counts once.
 * Python 3.3 gives you UTF-32, but will store it as compactly as possible.

Framing issue here (made famous by en.wikipedia.org/wiki/
George_Lakoff)

When one uses words like 'compact' 'flexible' etc it loads the dice in
favour of 3.3 choices.
And ignores that 3.3 trades time for space.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: String performance regression from python 3.2 to 3.3

2013-03-15 Thread Mark Lawrence

On 16/03/2013 04:35, rusi wrote:

On Mar 16, 9:09 am, Chris Angelico ros...@gmail.com wrote:

On Sat, Mar 16, 2013 at 2:56 PM, Mark Lawrence breamore...@yahoo.co.uk wrote:

On 16/03/2013 02:44, Thomas 'PointedEars' Lahn wrote:



Chris Angelico wrote:



Thomas and Chris, would the two of you be kind enough to explain to morons
such as myself how all the ECMAScript stuff relates to Python's unicode as
implemented via PEP 393 as you've lost me, easily done I know.


Sure. Here's the brief version: It's all about how a string is exposed
to a script.

* Python 3.2 Narrow gives you UTF-16. Non-BMP characters count twice.
* Python 3.2 Wide gives you UTF-32. Each character counts once.
* Python 3.3 gives you UTF-32, but will store it as compactly as possible.


Framing issue here (made famous by en.wikipedia.org/wiki/
George_Lakoff)

When one uses words like 'compact' 'flexible' etc it loads the dice in
favour of 3.3 choices.
And ignores that 3.3 trades time for space.



As stated in PEP 393 so what's all the fuss about?

--
Cheers.

Mark Lawrence

--
http://mail.python.org/mailman/listinfo/python-list


Re: String performance regression from python 3.2 to 3.3

2013-03-15 Thread Terry Reedy

On 3/16/2013 12:35 AM, rusi wrote:


And ignores that 3.3 trades time for space.


This is at least a partial falsehood.
It is really sad to see you parroting this.

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list


Re: String performance regression from python 3.2 to 3.3

2013-03-15 Thread rusi
On Mar 16, 9:12 am, Thomas 'PointedEars' Lahn pointede...@web.de
wrote:
 You have still no clue what you are talking about.  Get yourself informed at
 least about the (deprecated/obsolete) “language” and the (standards-
 compliant) “type” attribute of SCRIPT/“script” elements before you post on
 this again.

 --
 PointedEars

An emotional 'PointedEars?'
Now have I dropped into an alternate universe?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: String performance regression from python 3.2 to 3.3

2013-03-15 Thread Steven D'Aprano
On Sat, 16 Mar 2013 15:09:56 +1100, Chris Angelico wrote:

 On Sat, Mar 16, 2013 at 2:56 PM, Mark Lawrence breamore...@yahoo.co.uk
 wrote:
 On 16/03/2013 02:44, Thomas 'PointedEars' Lahn wrote:

 Chris Angelico wrote:


 Thomas and Chris, would the two of you be kind enough to explain to
 morons such as myself how all the ECMAScript stuff relates to Python's
 unicode as implemented via PEP 393 as you've lost me, easily done I
 know.
 
 Sure. Here's the brief version: It's all about how a string is exposed
 to a script.
 
 * Python 3.2 Narrow gives you UTF-16. Non-BMP characters count twice. 
 * Python 3.2 Wide gives you UTF-32. Each character counts once. 
 * Python 3.3 gives you UTF-32, but will store it as compactly as
 possible. 
 * ECMAScript specifies the semantics of Python 3.2 Narrow.

And just for the record:

Unicode actually doesn't define what a character is. Instead, it talks 
about code points, but for our purposes we can gloss over the 
differences and pretend that they are almost the same thing, except where 
noted. Some code points represent characters, some represent non-
characters, and some are currently unused.

UTF-16 is a *variable length* storage mechanism that says each code point 
takes either two or four bytes. Since Unicode includes more code points 
than will fit in two bytes, UTF-16 includes a mechanism for dealing with 
the additional code points:

* The first 65,536 code points are defined as the Basic Multilingual 
Plane, or BMP. Each code point in the BMP is represented in UTF-16 by a 
16-bit value.

* The remaining 16 sets of 65,536 code points are defined as 
Supplementary Multilingual Planes, or SMPs. Each code point in a SMP is 
represented by two 16 bit values, called a surrogate pair. The lead 
surrogate will be in the range 0xD800...0xDBFF and the trail surrogate 
will be in the range 0xDC00...0xDFFF.

The disadvantage here is that you can't tell how far into a string you 
need to go to get to (say) the 1000th character (code point). If all of 
the first 1000 code points are in the BMP, then you can jump directly to 
byte offset 2000. If all of them are in a SMP, then you can jump directly 
to byte offset 4000. But since you don't usually know how many SMP code 
points are in the string, you have to walk through the string:


# Pseudo-code to return the code-point in string at index.
offset = 0  # Offset in pairs of bytes.
counter = 0
while offset  length of string counted in pairs of bytes:
if string[offset] in 0xD800...0xDBFF:
# Lead surrogate of a surrogate pair.
if counter == index:
return string[offset:offset+1]
else:
counter += 1
index += 2  # Skip the next pair.
elif string[offset] in 0xDC00...0xDFFF:
# Trail surrogate found outside of a surrogate pair.
raise Error
else:
   # BMP code point.
   if counter == index:
   return string[offset]
   else:
   counter += 1
   index += 1


What a mess! Slow and annoying to get right. Not surprisingly, most 
implementations of UTF-16 don't do this, and Python is one of them. 
Instead, they assume that all code points take up the same space, and 
consequently they let you create *invalid Unicode strings* by splitting a 
surrogate pair:


This is in Python 3.2 narrow build:

py s = chr(7)
py len(s)
2
py a = s[0]
py a == s
False
py print(a)
Traceback (most recent call last):
  File stdin, line 1, in module
UnicodeEncodeError: 'utf-8' codec can't encode character '\ud804' in 
position 0: surrogates not allowed


Oops! We have created an invalid Unicode string. A wide build will fix 
this, because it uses UTF-32 instead.

UTF-32 is a *fixed width* storage mechanism where every code point takes 
exactly four bytes. Since the entire Unicode range will fit in four 
bytes, that ensures that every code point is covered, and there is no 
need to walk the string every time you perform an indexing operation. But 
it means that if you're one of the 99.9% of users who mostly use 
characters in the BMP, your strings take twice as much space as 
necessary. If you only use Latin1 or ASCII, your strings take four times 
as much space as necessary.

So a Python wide build uses more memory, but gets string processing 
right. Python 3.3 has the best of both worlds, fixing the invalid string 
processing and avoiding memory waste.


One of the complications here is that often people conflate UTF-16 and 
UCS-2. It isn't entirely clear to me, but it seems that ECMAScript may be 
doing that. UCS-2 specifies that *all characters* are represented by 
*exactly* 16 bits (two bytes), and hence it is completely unable to deal 
with the Supplementary Multilingual Planes at all.

If I have read the ECMAScript spec correctly, it *completely ignores* the 
issue of surrogate pairs, and so is underspecified. Instead it talks 
about normalised form, which is entirely unrelated. Normalisation relates 
to the idea that many characters 

Re: String performance regression from python 3.2 to 3.3

2013-03-15 Thread Steven D'Aprano
On Fri, 15 Mar 2013 21:35:42 -0700, rusi wrote:

 And ignores that 3.3 trades time for space.

So what? Lists, dicts and sets trade time for space: they are generally 
over-allocated to ensure a certainly level of performance. The language 
designers are perfectly permitted to make that choice. If somebody wants 
to make another choice they can design their own language, or write their 
own data structures, or put in a bug report and hope to influence the 
language designers to change their minds. Why should strings be treated 
any differently?



-- 
Steven

-- 
http://mail.python.org/mailman/listinfo/python-list


[issue17427] re

2013-03-15 Thread august smith

New submission from august smith:

lol

--
messages: 184215
nosy: JUNO
priority: normal
severity: normal
status: open
title: re

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17427
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17427] spam

2013-03-15 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy:  -JUNO
resolution:  - invalid
stage:  - committed/rejected
status: open - closed
title: re - spam

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17427
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17427] spam

2013-03-15 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
Removed message: http://bugs.python.org/msg184215

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17427
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17415] Clarify docs of os.path.normpath()

2013-03-15 Thread Ezio Melotti

Ezio Melotti added the comment:

 I will correct that if you make me aware about it!

Try to use meaningful titles, e.g. Clarify docs of os.path.normpath().  See 
http://docs.python.org/devguide/triaging.html for more informations.

Also if you could provide patches that would be even better.  The devguide 
explains how to make patches.


For this issue it might be enough to simply swap the two sentences.

--
keywords: +easy
nosy: +ezio.melotti, terry.reedy
stage:  - needs patch
title: Documentation Ambiguity 1 - Clarify docs of os.path.normpath()
versions: +Python 2.7, Python 3.2, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17415
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17426] \0 in re.sub substitutes to space

2013-03-15 Thread anatoly techtonik

anatoly techtonik added the comment:

You're right - groups are defined here: 
http://docs.python.org/2/library/re.html#re.MatchObject.group

The need to fix this is to gain internal language consistency, external 
consistency with other major implementations, reduce docs and amount of 
exception to remember, and thus make this part intuitive.


The external inconsistency is that other languages use \0 and don't make 
distinction between match group and substition group. I wonder if there are 
any other differences justify the presence of this distinction? Internal 
inconsistency is in substitution groups notation:

\0 is \x0 but is not \g0
\1 is not \x1 but is \g1

Let me also put accent that re is a module - not a feature of Python language - 
that provides ability to work with regular expressions. Evolution led to the 
best practices that became unwritten standard in different implementations - 
like using \x for backreferences in replacements. If some library invents its 
own standards that add nothing to the user rather than another thing to 
remember [1] then the user is automatically granted the right to wear the sign 
this library suxx on her t-shirt.


I'd classify a 'language wart' as an inconsistency in expected behavior, 
independent of the language, where a technical fix is possible, but can not be 
fixed due to backward compatibility concerns. Language independent, because 
single language is by definition works as documented and has different 
features in implementation details.

1. http://php.net/manual/en/types.comparisons.php

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17426
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17426] \0 in re.sub substitutes to space

2013-03-15 Thread anatoly techtonik

anatoly techtonik added the comment:

Am I right that \0 is not supported just because nobody thought about 
supporting it?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17426
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17414] timeit.timeit not in __all__ even though documented

2013-03-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset dda8a6b8a351 by Terry Jan Reedy in branch 'default':
Issue #17414: Add timeit, repeat, and default_timer to timeit.__all__.
http://hg.python.org/cpython/rev/dda8a6b8a351

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17414
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17414] timeit.timeit not in __all__ even though documented

2013-03-15 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Fred Drake, Eli Bendersky, and in particular, Guido (I do see that it 
shouldn't be backported, but I don't see any worries about doing it in 3.4.) 
said that this is a 3.4-only enhancement.

Anuj, ACKS are alphabetical. Åstrand is at the end because that is where Å 
sorts. Thanks for the patch. We hope to see more.

--
versions:  -Python 2.6, Python 2.7, Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17414
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17414] timeit.timeit not in __all__ even though documented

2013-03-15 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17414
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17415] Clarify docs of os.path.normpath()

2013-03-15 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The question is what is the 'this' that may change the patch meaning. It does 
not seem to me that changing '/' to '\' would do that. So I suspect 'this' 
refers to 'collapsing'. If so, I suggest the entry be:

Normalize a pathname (but not the case -- use normcase for that). This 
collapses redundant separators and up-level references so that A//B, A/B/, 
A/./B and A/foo/../B all become A/B. This collapsing may change the meaning of 
the path if it contains symbolic links!  On Windows, normpath also converts 
forward slashes to backward slashes.

--
nosy: +loewis, pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17415
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17047] Fix double double words words

2013-03-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4b28a6a3eda6 by Terry Jan Reedy in branch '3.2':
Issue #17047: Add news entry
http://hg.python.org/cpython/rev/4b28a6a3eda6

New changeset 937989570b42 by Terry Jan Reedy in branch '3.3':
Merge with 3.2: issue #17047 news entry
http://hg.python.org/cpython/rev/937989570b42

New changeset f0a3c2006adb by Terry Jan Reedy in branch 'default':
Merge with 3.2: closes issue #17047
http://hg.python.org/cpython/rev/f0a3c2006adb

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17047
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17426] \0 in re.sub substitutes to space

2013-03-15 Thread Ezio Melotti

Ezio Melotti added the comment:

PERL uses $ for the whole match rather than $0.  That would explain why \0 is 
not supported.  For .group() it probably made sense to access the whole match 
using 0 rather than passing something else, and that was likely reflected in 
the \g... form, but not in the \X form.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17426
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17047] Fix double double words words

2013-03-15 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed
type: enhancement - behavior

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17047
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17047] Fix double double words words

2013-03-15 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
assignee: docs@python - terry.reedy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17047
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17428] replace readdir to readdir_r in function posix_listdir

2013-03-15 Thread Rock Li

New submission from Rock Li:

When I'm how glob module is implemented. I found in file posixmodule.c, the 
function posix_listdir is using readdir to get all the entries under one 
directory and the context is setted to allow multi threads. But the function 
readdir is not thread-safe, so I changed this call to use readdir_r instead. 

I'm using the lastest codes in the repo.

--
components: Extension Modules
files: mywork.patch
keywords: patch
messages: 184224
nosy: Rock
priority: normal
severity: normal
status: open
title: replace readdir to readdir_r in function posix_listdir
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file29413/mywork.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17428
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17426] \0 in re.sub substitutes to space

2013-03-15 Thread anatoly techtonik

anatoly techtonik added the comment:

The perl syntax supported $0 according to this doc 
http://turtle.ee.ncku.edu.tw/docs/perl/manual/pod/perlre.html but was removed 
for unknown reason. Using the fact that support is removed without knowing the 
true reason is cargo cult argument, which I hope is not acceptable for Python 
development.

Among the possible reason can be binding of $0 to the __file__ analogue 
according to this doc - 
http://www.cs.cmu.edu/afs/cs/usr/rgs/mosaic/pl-predef.html

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17426
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13918] locale.atof documentation is missing func argument

2013-03-15 Thread Cédric Krier

Cédric Krier added the comment:

Here is a patch for the documentation.

--
keywords: +patch
resolution: wont fix - 
Added file: http://bugs.python.org/file29414/doc_atof.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13918
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17053] pydoc should use inspect.signature instead of inspect.getfullargspec

2013-03-15 Thread Ronald Oussoren

Ronald Oussoren added the comment:

The attached patch appears to work correctly and includes a test for pydoc 
(text output). There could be more testing (HTML output, annotations, 
positional-only arguments).

With this patch I can get usable documentation for Cocoa classes with a patched 
version of PyObjC that includes an __signature__ property on ObjC method 
objects.

As mentioned before I'm not sure about the 'render' method added to 
inspect.Signature and inspect.Parameter. These methods were needed to generate 
output that's compatible with the current pydoc output, in particular to emit 
better HTML output.

--
keywords: +patch
stage: test needed - patch review
Added file: http://bugs.python.org/file29415/issue17053.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17053
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17426] \0 in re.sub substitutes to space

2013-03-15 Thread Matthew Barnett

Matthew Barnett added the comment:

The regex behaves the same as re.

The reason it isn't supported is that \0 starts an octal escape sequence.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17426
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17426] \0 in re.sub substitutes to space

2013-03-15 Thread Guido van Rossum

Guido van Rossum added the comment:

Anatoly, your argument for consistency with other languages is ridiculous.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17426
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1291] test_resource fails on recent linux systems

2013-03-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 59292f366b53 by Senthil Kumaran in branch 'default':
#1291 http.server's send_error takes an optional explain argument
http://hg.python.org/cpython/rev/59292f366b53

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1291
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12921] http.server.BaseHTTPRequestHandler.send_error , ability send a detailed response

2013-03-15 Thread Senthil Kumaran

Senthil Kumaran added the comment:

I have added explain argument in 3.4, committed changeset 82669:59292f366b53

I think the short message no trailing line assertion should be taken by next. 
Either a new issue it if already open or create one just for the purpose.

Thanks Karl for the patch.

--
resolution:  - fixed
stage:  - committed/rejected
status: open - closed
title: http.server.BaseHTTPRequestHandler.send_error and trailing newline - 
http.server.BaseHTTPRequestHandler.send_error , ability send a detailed response

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12921
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12921] http.server.BaseHTTPRequestHandler.send_error , ability send a detailed response

2013-03-15 Thread karl

karl added the comment:

Thanks! Yes we should open a separate issue. I will look at the current patch 
and see what I can propose for the next step.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12921
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12921] http.server.BaseHTTPRequestHandler.send_error , ability send a detailed response

2013-03-15 Thread karl

karl added the comment:

just a minor issue you made a mistake in the commit message. The issue number 
is 12921

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12921
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17429] platform.platform() can throw Unicode error

2013-03-15 Thread Toshio Kuratomi

New submission from Toshio Kuratomi:

Tested on python-3.2 and python-3.3.  platform.platform() looks for a file in 
/etc/ that looks like it will contain the name of the Linux distribution that 
python3 is running on.  Once found, it reads the contents of the file to have a 
name for the Linux distribution.  Most Linux distributions do create files 
inside of /etc/ with a single line which is the distribution name so this is a 
good heuristic.  However, these files are created by the operating system 
vendor and so they can have a different encoding than the encoding of the 
locale the user uses.  This means that if there are non-ascii characters inside 
the file, user code that invokes platform.platform() may throw a traceback.

Test:

$ LC_ALL=en_US.utf8 sudo echo ' Café'  /etc/fedora-release
$ LC_ALL=C python3
 import platform
 platform.platform()
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib64/python3.2/platform.py, line 1538, in platform
distname,distversion,distid = dist('')
  File /usr/lib64/python3.2/platform.py, line 358, in dist
full_distribution_name=0)
  File /usr/lib64/python3.2/platform.py, line 329, in linux_distribution
firstline = f.readline()
  File /usr/lib64/python3.2/encodings/ascii.py, line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 22: 
ordinal not in range(128)

It seems that the standard method of fixing these that we're promoting in 
python3 is to use surrogateescape.  I'll provide a patch that does that.

--
messages: 184234
nosy: a.badger
priority: normal
severity: normal
status: open
title: platform.platform() can throw Unicode error
versions: Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17429
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17429] platform.platform() can throw Unicode error

2013-03-15 Thread Toshio Kuratomi

Changes by Toshio Kuratomi a.bad...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file29416/00175-platform-unicode.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17429
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17426] \0 in re.sub substitutes to space

2013-03-15 Thread anatoly techtonik

anatoly techtonik added the comment:

Matthew, finally the right answer. Thanks!


Looking further, there is a bug in processing backslashes in raw literal 
replacement strings. re.sub ignores raw strings as replacements. This can be 
even more confusing for people who look for more advanced equivalent for string 
replace().


  patt = aaa
  repl = rzed \0 org

  print( aaa .replace(patt, repl))

  import re
  print(re.sub(patt, repl,  aaa ))

This gives:

 zed \0 org
 zed   org

With `repl = zed \0 org`, the output matches:

  zed   org
  zed   org

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17426
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17426] \0 in re.sub substitutes to space

2013-03-15 Thread Guido van Rossum

Guido van Rossum added the comment:

Anatoly, your question belongs on python-list or stack overflow, not in the
tracker.

--Guido van Rossum (sent from Android phone)
On Mar 15, 2013 9:28 AM, anatoly techtonik rep...@bugs.python.org wrote:


 anatoly techtonik added the comment:

 Matthew, finally the right answer. Thanks!


 Looking further, there is a bug in processing backslashes in raw literal
 replacement strings. re.sub ignores raw strings as replacements. This can
 be even more confusing for people who look for more advanced equivalent for
 string replace().


   patt = aaa
   repl = rzed \0 org

   print( aaa .replace(patt, repl))

   import re
   print(re.sub(patt, repl,  aaa ))

 This gives:

  zed \0 org
  zed   org

 With `repl = zed \0 org`, the output matches:

   zed   org
   zed   org

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue17426
 ___


--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17426
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17386] Bring Doc/make.bat as close to Doc/Makefile as possible

2013-03-15 Thread Zachary Ware

Zachary Ware added the comment:

Applying the minipatch makes the big patch fail to apply, so here's an update.  
Also changed in this version of the patch:

- README.txt is updated.  Not all the changes directly relate to this patch, 
but there were some needed updates in there anyway.  If desired, I can split 
those into a separate issue, but all the changes are fairly minor.

- Added *VERSION variables for each of the tools for easy overriding and 
easier-to-find, single place to update.

Terry, you're right about make.bat being very similar between versions.  About 
the only other difference I saw was the removal of the line that prints the 
Python version in use, and the version of Pygments used.  I'd be happy to make 
patches for backporting this as far as desired (assuming, of course, that it is 
accepted and is desirable to backport :-).

--
Added file: http://bugs.python.org/file29417/win_doc_make.v2.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17386
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17386] Bring Doc/make.bat as close to Doc/Makefile as possible

2013-03-15 Thread Zachary Ware

Changes by Zachary Ware zachary.w...@gmail.com:


Removed file: http://bugs.python.org/file29417/win_doc_make.v2.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17386
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17386] Bring Doc/make.bat as close to Doc/Makefile as possible

2013-03-15 Thread Zachary Ware

Changes by Zachary Ware zachary.w...@gmail.com:


Added file: http://bugs.python.org/file29418/win_doc_make.v2.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17386
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17426] \0 in re.sub substitutes to space

2013-03-15 Thread anatoly techtonik

anatoly techtonik added the comment:

I thought that trackers are used to track the sources of the bugs. Aren't they?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17426
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17426] \0 in re.sub substitutes to space

2013-03-15 Thread anatoly techtonik

anatoly techtonik added the comment:

Users list the effect. Then a research is made to find the source. Then a 
decision is made to find the right cause for the source of the bug, and then a 
decision about if the fix is possible.

The bug is closed, but that doesn't mean we can not dedicate some time trying 
to research the cause. This research can be used to develop other language and 
explain the mechanism why this feature works like it does. If people are not 
interested, they can opt-out.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17426
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17426] \0 in re.sub substitutes to space

2013-03-15 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Anatoly, your last question about re.sub is covered by the documentation:
re.sub will process the replacement string, and interpret the sequence \ 0 as 
the NUL character. So you get the NUL character in the returned string.

This is unrelated to raw literal strings.

And yes, sometimes you need 4 backslashes to get one in the output:

 print(re.sub(b, , abc))
a\c

--
nosy: +amaury.forgeotdarc

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17426
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17429] platform.platform() can throw Unicode error

2013-03-15 Thread Martin v . Löwis

Martin v. Löwis added the comment:

What's the most likely encoding? UTF-8? I suggest we assume UTF-8, and use the 
surrogate-escape error handler to deal with the cases when it isn't.

--
nosy: +loewis

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17429
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17426] \0 in re.sub substitutes to space

2013-03-15 Thread anatoly techtonik

anatoly techtonik added the comment:

Amaury, the documentation could make it more clear that it is a double 
replacement. Of course I payed attention to the repeated instructions about 
string substitution, but I thought that it is just a reminder, not an extra 
processing layer on top of standard string processing logic. Currently it reads 
like:

...if it is a string, any backslash escapes in it are processed. That is, \n 
is...

The correct text would be like:

...if it is a string, any backslash escapes in it are processed in addition to 
standard string escapes. That is, \n is... ... Note that re.sub backslash 
processing for replacement string occurs even if the raw strings.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17426
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17426] \0 in re.sub substitutes to space

2013-03-15 Thread anatoly techtonik

anatoly techtonik added the comment:

FWIW, I reimplemented substitution logic in my wikify [1] engine some time ago. 
I was kind of disappointed that I have to reinvent the bicycle, but now I see 
that this was for good. Thanks to people in this report I now understand the 
whole stuff much better and this will definitely make wikify more useful and 
easier to use.

1. https://bitbucket.org/techtonik/wikify

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17426
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17426] \0 in re.sub substitutes to space

2013-03-15 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

It's not a double replacement: chr(92)+chr(0) is processed only once.
And the second paragraph of the re documentation already contains such a 
warning.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17426
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17423] libffi on 32bit is broken on linux

2013-03-15 Thread Simon Cross

Changes by Simon Cross hodges...@gmail.com:


--
nosy: +hodgestar

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17423
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17430] missed peephole optimization

2013-03-15 Thread Neal Norwitz

New submission from Neal Norwitz:

 def fo():
...   if a:
... if b:
...  if c:
...print
... 
 dis.dis(fo)
  2   0 LOAD_GLOBAL  0 (a)
  3 POP_JUMP_IF_FALSE   28

  3   6 LOAD_GLOBAL  1 (b)
  9 POP_JUMP_IF_FALSE   28

  4  12 LOAD_GLOBAL  2 (c)
 15 POP_JUMP_IF_FALSE   25

  5  18 PRINT_NEWLINE   
 19 JUMP_ABSOLUTE   25
 22 JUMP_ABSOLUTE   28
   25 JUMP_FORWARD 0 (to 28)
   28 LOAD_CONST   0 (None)
 31 RETURN_VALUE

The 2 JUMP_ABSOLUTEs should be optimized away since the code is equivalent to: 
if a and b and c: as in:

 dis.dis(fo)
  2   0 LOAD_GLOBAL  0 (a)
  3 POP_JUMP_IF_FALSE   22
  6 LOAD_GLOBAL  1 (b)
  9 POP_JUMP_IF_FALSE   22
 12 LOAD_GLOBAL  2 (c)
 15 POP_JUMP_IF_FALSE   22

  3  18 PRINT_NEWLINE   
 19 JUMP_FORWARD 0 (to 22)
   22 LOAD_CONST   0 (None)
 25 RETURN_VALUE

--
messages: 184245
nosy: Neal.Norwitz
priority: normal
severity: normal
status: open
title: missed peephole optimization
type: performance
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17430
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17337] input() and raw_input() do not work correctly with colored prompts

2013-03-15 Thread Michael Enßlin

Michael Enßlin added the comment:

Terry, i guess you are right; it is indeed not the job of python to know how 
its terminal will print characters; there is a whole lot of issues to consider, 
such as terminal unicode support, control characters, ansi escape sequences, 
terminal-specific escape sequences such as terminal title, etc.
I guess that on UNIX, a lot of that information could be taken from terminfo, 
to provide a method that guesses the length of a text on the terminal that is 
referenced in the $TERM environment variable.

In fact, I think this is a design problem of readline; readline should print 
the prompt, and then try to determine its length via the dedicated escape 
sequence (if it really needs to know the prompt length). In that case, there 
would be no way to fix this in python - apart from re-implementing. In 
conclusion, no, I don't believe the python readline code should be modified, 
maybe an additional, os- and $TERM-dependent method for adding prompt escapes 
should be added.

However, the issue should definitely be documented in the readline 
documentation:
importing readline _will_ break input() if the prompt contains non-printable 
characters that are not escaped by '\x01' and '\x02' characters.

Hence I have changed the bug components to 'Documentation'.

--
assignee:  - docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17337
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17431] email.parser module has no attribute BytesFeedParser

2013-03-15 Thread Forest Wilkinson

New submission from Forest Wilkinson:

The docs claim that email.parser.BytesFeedParser exists, but it doesn't.  Looks 
like email.feedparser.FeedParser is imported into the email.parser module, but 
someone forgot to do the same for BytesFeedParser.

--
components: email
messages: 184247
nosy: barry, forest, r.david.murray
priority: normal
severity: normal
status: open
title: email.parser module has no attribute BytesFeedParser
versions: Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17431
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17431] email.parser module has no attribute BytesFeedParser

2013-03-15 Thread R. David Murray

R. David Murray added the comment:

Thanks for the report.

--
keywords: +easy
stage:  - needs patch
versions: +Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17431
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17400] ipaddress.is_private needs to take into account of rfc6598

2013-03-15 Thread pmoody

pmoody added the comment:

Is the request that is_private should return true for all reserved/non-routable 
addresses? The docstrings refer to specific rfcs which don't cover most of the 
addresses listed in the wikipedia page. I haven't done a lot of network 
programming in the last couple of years, so what do folks think the least 
surprising result here would be?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17400
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17428] replace readdir to readdir_r in function posix_listdir

2013-03-15 Thread Ross Lagerwall

Ross Lagerwall added the comment:

Hi,

There shouldn't be a problem with the existing implementation since, according 
to posix:

The pointer returned by readdir() points to data which may be overwritten by 
another call to readdir() on the same directory stream. This data is not 
overwritten by another call to readdir() on a different directory stream.


Since each call to listdir() opens a different directory stream, this shouldn't 
be a problem.

Also, when using readdir_r(), struct dirent should not be allocated on the 
stack since the last field may be an unspecified size.
See the following for further reading about this:
http://elliotth.blogspot.co.uk/2012/10/how-not-to-use-readdirr3.html
http://womble.decadent.org.uk/readdir_r-advisory.html

Regards

--
nosy: +rosslagerwall

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17428
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13918] locale.atof documentation is missing func argument

2013-03-15 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I find the idea of intentionally not documenting a public parameter and the 
full signature of a function somewhat strange, especially when it is already 
automatically partially-documented.

 import locale
 help(locale.atof)
Help on function atof in module locale:

atof(string, func=class 'float')
Parses a string as a float according to the locale settings.
# 2.7, 3.2, 3.3

Not documenting the full signature of a function seems to me contrary to proper 
policy. That aside, the func parameter is, to me, a useful feature, not just an 
implementation detail

The way to have factored out the common normalization without a func parameter 
is obvious: define a private normalization function.

def _anormalize(string):
remove thousands separators, make decimal dot
ts = localeconv()['thousands_sep']
if ts:
string = string.replace(ts, '')
#next, replace the decimal point with a dot
dd = localeconv()['decimal_point']
if dd:
string = string.replace(dd, '.')
return string

def atof(string):
Parses a string as a float according to the locale settings.
return float(_anormalize(string))

def atoi(string):  # changed from str
Converts a string to an integer according to the locale settings.
return int(_anormalize(string))

But Martin von Loewis, the original author did not do this. I would not assume 
that he thought that copying 3 lines from atof into atoi was a bad idea. 
without asking him.  Whatever his conscious intention, the func parameter 
*does* have the advantage of allowing alternate float string to number 
converters.  We now have another one in the stdlib besides decimal.Decimal: 
fractions.Fractions.

 locale.atof('99,999.99', F)
Fraction(999, 100)
# versus
 F(locale.atof('99,999.99'))
Fraction(6871946986405233, 68719476736)

There are also 3rd party float implementations, such as indefinite precision 
binary floats. Does anyone still object to properly documenting this useful 
feature? I am willing to do the commits.

As to the patch and atof docstring, I thinks 'converts' (used in atoi 
docstring) is better than 'parses'.  So I would change both.

--
nosy: +terry.reedy
versions: +Python 2.7, Python 3.2, Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13918
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14468] Update cloning guidelines in devguide

2013-03-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7a707540391e by Ezio Melotti in branch 'default':
#14468: add FAQs about merge conflicts, null merges, and heads merges.
http://hg.python.org/devguide/rev/7a707540391e

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14468
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10652] test___all_ + test_tcl fails (Windows installed binary)

2013-03-15 Thread Zachary Ware

Zachary Ware added the comment:

I was recently bitten by this issue.  I've reviewed Terry's patch on Rietveld, 
and have tested it myself some.  It seems to get the job done without getting 
in the way.

--
nosy: +zach.ware

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10652
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17398] document url argument of RobotFileParser

2013-03-15 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
assignee: docs@python - terry.reedy
nosy: +terry.reedy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17398
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17398] document url argument of RobotFileParser

2013-03-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 274e68e2a5a6 by Terry Jan Reedy in branch '2.7':
Issue #17398: document url argument of RobotFileParser
http://hg.python.org/cpython/rev/274e68e2a5a6

New changeset 4be7f8da7adf by Terry Jan Reedy in branch '3.2':
Issue #17398: document url argument of RobotFileParser
http://hg.python.org/cpython/rev/4be7f8da7adf

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17398
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10652] test___all_ + test_tcl fails (Windows installed binary)

2013-03-15 Thread Ezio Melotti

Ezio Melotti added the comment:

Would using import_fresh_module() in test_tcl (and others) work?

--
versions: +Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10652
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17398] document url argument of RobotFileParser

2013-03-15 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Agreed.

--
resolution:  - fixed
stage:  - committed/rejected
status: open - closed
type:  - behavior

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17398
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17337] input() and raw_input() do not work correctly with colored prompts

2013-03-15 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Please suggest the specific change in a specific place that you would like to 
see. Message is ok, patch even better.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17337
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17400] ipaddress.is_private needs to take into account of rfc6598

2013-03-15 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Peter, 'Assigned To' is a developer who intends to push (or has pushed) a 
patch. Anyone can write and attach one. And it is nice to give notice that you 
intend to.

--
nosy: +ncoghlan, terry.reedy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17400
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1159051] Handle corrupted gzip files with unexpected EOF

2013-03-15 Thread Matthias Klose

Matthias Klose added the comment:

this change breaks a test case in the bzr testsuite; will try to get to it next 
week. See https://launchpad.net/bugs/1116079

--
nosy: +doko, larry
priority: normal - release blocker

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1159051
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >