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  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  wrote:
>
>> VGNU Linux  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:


# -*- coding: cp850 -*-

a = u"µm"
b = u"\u03bcm"

print(a)
print(b)


But what I get is this:


µm
Traceback (most recent call last):
  File "x.py", line 7, in 
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 



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:
> 
> 
> # -*- coding: cp850 -*-
> 
> a = u"µm"
> b = u"\u03bcm"
> 
> print(a)
> print(b)
> 
> 
> But what I get is this:
> 
> 
> µm
> Traceback (most recent call last):
>File "x.py", line 7, in 
>  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  
> 
> 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  wrote:

>
> æm
> Traceback (most recent call last):
>File "x.py", line 7, in 
>  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 
>
> 
> 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




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)

-- 
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  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
 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,   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  wrote:
> On Fri, Mar 15, 2013 at 5:50 AM,   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:
> 
> 
> function foo()
> {
> var txt=document.getElementById("in").value;
> var msg="";
> for (var i=0;i "+txt.charCodeAt(i).toString(16)+"\n";
> document.getElementById("out").value=msg;
> }
> 
>  value="Show">

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 ECMAScript is permitted

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
 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:
>>
>> 
>> function foo()
>> {
>> var txt=document.getElementById("in").value;
>> var msg="";
>> for (var i=0;i> "+txt.charCodeAt(i).toString(16)+"\n";
>> document.getElementById("out").value=msg;
>> }
>> 
>> > value="Show">
>
> 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 we

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  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
>  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:
>>>
>>> 
>>> function foo()
>>> {
>>> var txt=document.getElementById("in").value;
>>> var msg="";
>>> for (var i=0;i>> "+txt.charCodeAt(i).toString(16)+"\n";
>>> document.getElementById("out").value=msg;
>>> }
>>> 
>>> >> value="Show">
>>
>> 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
 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  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 
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  wrote:
> On Sat, Mar 16, 2013 at 2:56 PM, Mark Lawrence  
> 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  wrote:

On Sat, Mar 16, 2013 at 2:56 PM, Mark Lawrence  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 
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 
> 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 "", line 1, in 
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 t

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


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

2013-03-15 Thread dieter
s.arun...@gmail.com writes:

> 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

It is very difficult to extract data reliably from an undocumented binary 
format (such as "excel" files): things can change between versions,
some "features" may be used only in particular situations
difficult to get at by reverse engineering,
lacking a complete documentation completeness is difficult to get.

I see two options for you:

  *  send a problem report with your data to the "xlrd" author

 He may know how to fix it.

  *  Tell "excel" to export the file to "csv" and
 use Python's "csv" mode to read the values.

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