Re: Performance of int/long in Python 3

2013-04-03 Thread Ian Kelly
On Wed, Apr 3, 2013 at 12:52 AM, Chris Angelico wrote: > Hmm. I was about to say "Can you just do a quick collections.Counter() > of the string widths in 3.3, as an easy way of seeing which ones use > BMP or higher characters", but I can't find a simple way to query a > string's width. Can't see i

Re: Performance of int/long in Python 3

2013-04-03 Thread Chris Angelico
On Wed, Apr 3, 2013 at 6:06 PM, Ian Kelly wrote: > On Wed, Apr 3, 2013 at 12:52 AM, Chris Angelico wrote: >> Hmm. I was about to say "Can you just do a quick collections.Counter() >> of the string widths in 3.3, as an easy way of seeing which ones use >> BMP or higher characters", but I can't fin

Re: Time zone changing while Win app is running

2013-04-03 Thread Steven D'Aprano
On Tue, 02 Apr 2013 17:04:12 -0700, CM wrote: > To summarize the issue: In an application, I have been using Python's > datetime module to get the current time. But it seems that, at least > with Windows (XP), whatever time zone your computer is set to when you > start the application, that's wh

Re: Performance of int/long in Python 3

2013-04-03 Thread Neil Hodgson
Reran the programs taking a bit more care with the encoding of the file. This had no effect on the speeds. There are only a small amount of paths that don't fit into ASCII: ASCII 1076101 Latin1 218 BMP 113 Astral 0 # encoding:utf-8 import codecs, os, time from os.path import join, getsize w

Re: Performance of int/long in Python 3

2013-04-03 Thread Steven D'Aprano
On Wed, 03 Apr 2013 18:24:25 +1100, Chris Angelico wrote: > On Wed, Apr 3, 2013 at 6:06 PM, Ian Kelly wrote: >> On Wed, Apr 3, 2013 at 12:52 AM, Chris Angelico >> wrote: >>> Hmm. I was about to say "Can you just do a quick collections.Counter() >>> of the string widths in 3.3, as an easy way of

Re: Performance of int/long in Python 3

2013-04-03 Thread Chris Angelico
On Wed, Apr 3, 2013 at 6:53 PM, Steven D'Aprano wrote: > Here's another way: > > > (sys.getsizeof(s) - sys.getsizeof(''))/len(s) > > should work. Hmm, I had been under the impression that there was a certain "base length" below which strings all had the same size. Yes, that also works; though aga

Re: Performance of int/long in Python 3

2013-04-03 Thread rusi
On Apr 3, 12:37 pm, Neil Hodgson wrote: >     Reran the programs taking a bit more care with the encoding of the > file. This had no effect on the speeds. There are only a small amount of > paths that don't fit into ASCII: > > ASCII 1076101 > Latin1 218 > BMP 113 > Astral 0 > > # encoding:utf-8 >

Re: Performance of int/long in Python 3

2013-04-03 Thread jmfauth
This FSR is wrong by design. A naive way to embrace Unicode. jmf -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting USB volume serial number from inserted device on OSX

2013-04-03 Thread Sven
Apologies. The main app is in python, and I would like to know any alternative methods to do this in Python on OS X. Doesn't have to use the OS X APIs. I'll try elsewhere too though. Thanks On 3 April 2013 00:37, Ned Deily wrote: > In article > , > Sven wrote: > > I am using Python 2.7 with

Re: Performance of int/long in Python 3

2013-04-03 Thread Neil Hodgson
Roy Smith: On the other hand, how long did it take you to do the directory tree walk required to find those million paths? I'll bet a long longer than 0.78 seconds, so this gets lost in the noise. About 2 minutes. But that's just getting an example data set. Other data sets may be loaded

Re: Performance of int/long in Python 3

2013-04-03 Thread Neil Hodgson
rusi: Can you please try one more experiment Neil? Knock off all non-ASCII strings (paths) from your dataset and try again. Results are the same 0.40 (well, 0.001 less but I don't think the timer is that accurate) for Python 3.2 and 0.78 for Python 3.3. Neil -- http://mail.python.org/

Make python 3.3 the default one and not 2.7

2013-04-03 Thread D. Xenakis
Hi there, i installed python 2.7 (windows 32bit version) from http://www.enthought.com/products/epd_free.php and after that i installed official 3.3 version too. So now i got two python folders like this.. c:/Python27 and c:/Python33 . My problem is that when im trying to execute a .py file, t

Re: Make python 3.3 the default one and not 2.7

2013-04-03 Thread Wolfgang Maier
D. Xenakis hotmail.com> writes: > > Hi there, i installed python 2.7 (windows 32bit version) from > http://www.enthought.com/products/epd_free.php and after that i installed official 3.3 version > too. So now i got two python folders like this.. c:/Python27 and c:/Python33 > . > My problem is

Re: Performance of int/long in Python 3

2013-04-03 Thread Dave Angel
On 04/03/2013 04:22 AM, Neil Hodgson wrote: rusi: Can you please try one more experiment Neil? Knock off all non-ASCII strings (paths) from your dataset and try again. Results are the same 0.40 (well, 0.001 less but I don't think the timer is that accurate) for Python 3.2 and 0.78 for Pyt

Re: Make python 3.3 the default one and not 2.7

2013-04-03 Thread Dave Angel
On 04/03/2013 04:44 AM, D. Xenakis wrote: Hi there, i installed python 2.7 (windows 32bit version) from http://www.enthought.com/products/epd_free.php and after that i installed official 3.3 version too. So now i got two python folders like this.. c:/Python27 and c:/Python33 . My problem is t

Solution found! Qpython+ will work on kindle fire (without live connection)

2013-04-03 Thread ah
+ To: "tu...@python.org" Sent: Monday, 1 April 2013 9:18 AM Subject: [Tutor] is there a simple stand alone python app I can use on my Kindle fire? Hello, I'm enjoying learning python, and would like to be able to study and practice on the go, using my kindle fire reader. (wifi enabled).

Re: Performance of int/long in Python 3

2013-04-03 Thread Neil Hodgson
Dave Angel: That would seem to imply that the speed regression on your data is NOT caused by the differing size encodings. Perhaps it is the difference in MSC compiler version, or other changes made between 3.2 and 3.3 Its not caused by there actually being different size encodings but tha

Twisted 13.0.0 released

2013-04-03 Thread Thomas Hervé
On behalf of Twisted Matrix Laboratories, I am pleased to announce the release of Twisted 13.0. Among the 70 tickets closed, we can see: * A new "Introduction to Deferreds" document that you can find here: http://twistedmatrix.com/documents/13.0.0/core/howto/defer-intro.html * A fix in twisted

Re: Performance of int/long in Python 3

2013-04-03 Thread Mark Lawrence
On 03/04/2013 09:08, jmfauth wrote: This FSR is wrong by design. A naive way to embrace Unicode. jmf The hole you're digging for yourself is getting bigger and bigger and I'm loving it :) -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPyt

Re: Performance of int/long in Python 3

2013-04-03 Thread Dave Angel
On 04/03/2013 07:05 AM, Neil Hodgson wrote: Dave Angel: That would seem to imply that the speed regression on your data is NOT caused by the differing size encodings. Perhaps it is the difference in MSC compiler version, or other changes made between 3.2 and 3.3 Its not caused by there ac

Re: Tkinter

2013-04-03 Thread Jason Swails
On Tue, Apr 2, 2013 at 10:04 PM, Renato Barbosa Pim Pereira < renato.barbosa.pim.pere...@gmail.com> wrote: > Thanks for the advices, I need now one scrollbar to roll under screen, I > created the scrollbar but cant roll, please help me on this. > > http://pastebin.com/L6XWY6cm > You need to bind

Re: Make python 3.3 the default one and not 2.7

2013-04-03 Thread Mark Lawrence
On 03/04/2013 09:44, D. Xenakis wrote: Hi there, i installed python 2.7 (windows 32bit version) from http://www.enthought.com/products/epd_free.php and after that i installed official 3.3 version too. So now i got two python folders like this.. c:/Python27 and c:/Python33 . My problem is that

Re: Creating a dictionary from a .txt file

2013-04-03 Thread Neil Cerutti
On 2013-04-01, Steven D'Aprano wrote: > On Mon, 01 Apr 2013 11:41:03 +, Neil Cerutti wrote: > > >> I tried searching for Frost*, an interesting artist I recently learned >> about. > > "Interesting artist" -- is that another term for "wanker"? > > *wink* hee-hee. It depends on how much of a h

Re: How to choose between ORMs?

2013-04-03 Thread Roy Smith
In article , Alec Taylor wrote: > SQLalchemy and Storm are a few of the popular ORMs out there. > > Personally I have been using web2py's DAL. > > Other than form generator availability, 'print as raw SQL', multiple > primary keys, widgets*, `check` conditions and compatibility with > OracleDB

Re: Make python 3.3 the default one and not 2.7

2013-04-03 Thread D. Xenakis
I tried to reinstall python 3.3 but there was not change :(. I selected to run all component from my PC. I'll give it a try with those registries. -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of int/long in Python 3

2013-04-03 Thread Roy Smith
In article <1f2dnfpbhy54embmnz2dnuvz_osdn...@westnet.com.au>, Neil Hodgson wrote: > Roy Smith: > > > On the other hand, how long did it take you to do the directory tree > > walk required to find those million paths? I'll bet a long longer than > > 0.78 seconds, so this gets lost in the noise.

Re: Performance of int/long in Python 3

2013-04-03 Thread Roy Smith
In article , Chris Angelico wrote: > On Wed, Apr 3, 2013 at 3:03 PM, Neil Hodgson wrote: > > rusi wrote: > >"Every program attempts to expand until it can read mail. Those programs > > which cannot so expand are replaced by ones which can." > > In my personal experience, it's calculators.

Re: Performance of int/long in Python 3

2013-04-03 Thread Chris Angelico
On Thu, Apr 4, 2013 at 12:28 AM, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> On Wed, Apr 3, 2013 at 3:03 PM, Neil Hodgson wrote: >> > rusi wrote: >> >"Every program attempts to expand until it can read mail. Those programs >> > which cannot so expand are replaced by ones wh

Re: Performance of int/long in Python 3

2013-04-03 Thread Chris Angelico
On Thu, Apr 4, 2013 at 12:25 AM, Roy Smith wrote: > > Fair enough. In fact, given that reading the file from disk is O(n) and > sorting it is O(n log n), at some point, the sort will totally swamp the > input time. But given the much larger fixed cost of disk access, that might take an awful lot

Threading within a GUI and OpenCV

2013-04-03 Thread Sam Berry
Hey, I'm fairly new to python, and have had no experience with threading. Iv made a small GUI App using the kivy module and OpenCV, i have currently got a button that when pressed runs a function that records from my webcam for 20 seconds. However i have two other buttons, that when pressed i

Re: Performance of int/long in Python 3

2013-04-03 Thread Roy Smith
In article <515be00e$0$29891$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Wed, 03 Apr 2013 18:24:25 +1100, Chris Angelico wrote: > > > On Wed, Apr 3, 2013 at 6:06 PM, Ian Kelly wrote: > >> On Wed, Apr 3, 2013 at 12:52 AM, Chris Angelico > >> wrote: > >>> Hmm. I was about t

Re: Performance of int/long in Python 3

2013-04-03 Thread Mark Lawrence
On 02/04/2013 10:28, Neil Hodgson wrote: jmfauth: 3.2.3 (default, Apr 11 2012, 07:15:24) [MSC v.1500 32 bit (Intel)] [0.8343414906182101, 0.8336184057396241, 0.8330473419738562] 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit [1.3840254166697845, 1.3933888932429768, 1.3916

Mixin way?

2013-04-03 Thread andrea crotti
I have some classes that have shared behaviours, for example in our scenario an object can be "visited", where something that is visitable would have some behaviour like --8<---cut here---start->8--- class Visitable(Mixin): FIELDS = { 'visits': [],

Re: Make python 3.3 the default one and not 2.7

2013-04-03 Thread D. Xenakis
Τη Τετάρτη, 3 Απριλίου 2013 12:43:43 μ.μ. UTC+3, ο χρήστης Wolfgang Maier έγραψε: > D. Xenakis hotmail.com> writes: > > > > > > > > Hi there, i installed python 2.7 (windows 32bit version) from > > > http://www.enthought.com/products/epd_free.php and after that i installed > > official 3.

Re: Performance of int/long in Python 3

2013-04-03 Thread Chris Angelico
On Thu, Apr 4, 2013 at 12:43 AM, Roy Smith wrote: > This has to inspect the entire string, no? I posted (essentially) this > a few days ago: > >if all(ord(c) <= 0x for c in s): > return "it's all bmp" > else: > return "it's got astral crap in it" > > I'

Re: Make python 3.3 the default one and not 2.7

2013-04-03 Thread Wolfgang Maier
D. Xenakis hotmail.com> writes: > > The Python.File entry mentioned > > there also has the information about the IDLE version to use. > > > > Best, > > > > Wolfgang > > I changed this too Python.CompiledFile to my 33 version. > Should i not touch this key? The [.CompiledFile\shell\open\comma

Sorting [was Re: Performance of int/long in Python 3]

2013-04-03 Thread Steven D'Aprano
On Wed, 03 Apr 2013 07:52:42 -0400, Dave Angel wrote: > I thought that the sort algorithm used a hash of all > the items to be sorted, and only reverted to a raw comparison of the > original values when the hash collided. Is that not the case? Or is > the code you post here only used when the ha

Re: Performance of int/long in Python 3

2013-04-03 Thread Steven D'Aprano
On Wed, 03 Apr 2013 09:43:06 -0400, Roy Smith wrote: [...] >> n = max(map(ord, s)) >> 4 if n > 0x else 2 if n > 0xff else 1 > > This has to inspect the entire string, no? Correct. A more efficient implementation would be: def char_size(s): for n in map(ord, s): if n > 0x: re

Re: Sorting [was Re: Performance of int/long in Python 3]

2013-04-03 Thread Roy Smith
In article <515c400e$0$29966$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > I seem to recall that "sort relies only on < operator" is a language > promise, but I can't seem to find it documented anywhere official. That's pretty typical for sort implementations in all languages.

Re: Performance of int/long in Python 3

2013-04-03 Thread Steven D'Aprano
On Thu, 04 Apr 2013 01:17:28 +1100, Chris Angelico wrote: > Probably, but it still has to scan the body of the string. It'd not be > too bad if it's all astral, but if it's all BMP, it has to scan the > whole string. In the max() case, it has to scan the whole string anyway, > as there's no other

Re: Mixin way?

2013-04-03 Thread Steven D'Aprano
On Wed, 03 Apr 2013 15:04:51 +0100, andrea crotti wrote: > I have some classes that have shared behaviours, for example in our > scenario an object can be "visited", where something that is visitable > would have some behaviour like [snip mixins] By the way, it's a common convention to name mixi

Re: Performance of int/long in Python 3

2013-04-03 Thread rusi
On Apr 3, 6:43 pm, Roy Smith wrote: > This has to inspect the entire string, no?  I posted (essentially) this > a few days ago: > >        if all(ord(c) <= 0x for c in s): >             return "it's all bmp" >         else: >             return "it's got astral crap in it" Astral crap? CRAP?

Re: Mixin way?

2013-04-03 Thread andrea crotti
2013/4/3 Steven D'Aprano > [snip] > > So, if you think of "Visitable" as a gadget that can be strapped onto > your MyObj as a component, then composition is probably a better design. > But if you think of "Visitable" as a mere collection of behaviour and > state, then a mixin is probably a better

Re: Performance of int/long in Python 3

2013-04-03 Thread Ian Kelly
On Wed, Apr 3, 2013 at 5:52 AM, Dave Angel wrote: > I'm also puzzled. I thought that the sort algorithm used a hash of all the > items to be sorted, and only reverted to a raw comparison of the original > values when the hash collided. Is that not the case? Or is the code you > post here only u

Re: Performance of int/long in Python 3

2013-04-03 Thread Ian Kelly
On Wed, Apr 3, 2013 at 9:02 AM, Steven D'Aprano wrote: > On Wed, 03 Apr 2013 09:43:06 -0400, Roy Smith wrote: > > [...] >>> n = max(map(ord, s)) >>> 4 if n > 0x else 2 if n > 0xff else 1 >> >> This has to inspect the entire string, no? > > Correct. A more efficient implementation would be: > >

Re: Performance of int/long in Python 3

2013-04-03 Thread Ian Kelly
On Wed, Apr 3, 2013 at 1:53 AM, Steven D'Aprano wrote: > (sys.getsizeof(s) - sys.getsizeof(''))/len(s) >>> s = '\x80\x81\x82\x83\x84\x85' >>> len(s) 6 >>> import sys >>> sys.getsizeof(s) 43 >>> sys.getsizeof(s) - sys.getsizeof('') 18 >>> (sys.getsizeof(s) - sys.getsizeof('')) / len(s) 3.0 I didn

Re: How to choose between ORMs?

2013-04-03 Thread Rodrick Brown
Pick the one you learn and know. Sent from my iPhone On Apr 3, 2013, at 2:17 AM, Alec Taylor wrote: > SQLalchemy and Storm are a few of the popular ORMs out there. > > Personally I have been using web2py's DAL. > > Other than form generator availability, 'print as raw SQL', multiple > primary k

Re: Performance of int/long in Python 3

2013-04-03 Thread Ethan Furman
On 04/03/2013 09:10 AM, rusi wrote: On Apr 3, 6:43 pm, Roy Smith wrote: This has to inspect the entire string, no? I posted (essentially) this a few days ago: if all(ord(c) <= 0x for c in s): return "it's all bmp" else: return "it's got astral cr

Re: Mixin way?

2013-04-03 Thread Neil Cerutti
On 2013-04-03, andrea crotti wrote: > Well I can explain better the situation to make it more clear. > > We are using CouchDb and so far it has been (sigh) a brutal > manipulation of dictionaries everywhere, with code duplication > and so on. > > Now I wanted to encapsulate all the entities in the

Re: Performance of int/long in Python 3

2013-04-03 Thread Steven D'Aprano
On Wed, 03 Apr 2013 10:38:20 -0600, Ian Kelly wrote: > On Wed, Apr 3, 2013 at 9:02 AM, Steven D'Aprano > wrote: >> On Wed, 03 Apr 2013 09:43:06 -0400, Roy Smith wrote: >> >> [...] n = max(map(ord, s)) 4 if n > 0x else 2 if n > 0xff else 1 >>> >>> This has to inspect the entire strin

Re: Performance of int/long in Python 3

2013-04-03 Thread Dave Angel
On 04/03/2013 12:30 PM, Ian Kelly wrote: On Wed, Apr 3, 2013 at 5:52 AM, Dave Angel wrote: I'm also puzzled. I thought that the sort algorithm used a hash of all the items to be sorted, and only reverted to a raw comparison of the original values when the hash collided. Is that not the case?

Re: Python install Win 7 Problem

2013-04-03 Thread Martin Schöön
On 2013-04-02, balasubramanian Achuthan wrote: > Try using Activestate python. The free version would suffice your > needs and it comes with a clean install. I have been travelling and have not had time to read this thread in detail so this may be old hat but on Windows (at work) I simply install

Re: Python install Win 7 Problem

2013-04-03 Thread Terry Jan Reedy
On 4/3/2013 1:51 PM, Martin Schöön wrote: On 2013-04-02, balasubramanian Achuthan wrote: Try using Activestate python. The free version would suffice your needs and it comes with a clean install. I have been travelling and have not had time to read this thread in detail so this may be old hat

Re: IDLE printing problem

2013-04-03 Thread Terry Jan Reedy
On 4/3/2013 12:24 PM, Joe Hill wrote: On 4/3/2013 12:24 PM, Joe Hill wrote: > I attempted to print about 10 pages of documentation from the help files > using IDLE. On all the pages the side of each page was missing about 1/4 > inch of text. You neglected to say what you actually did to have a p

Re: Time zone changing while Win app is running

2013-04-03 Thread CM
> 2013-04-03 14:41:13.124000     < WRONG >                    ^ (That carrot is supposed to be pointing to the 4 in 14, which should be 18.) -- http://mail.python.org/mailman/listinfo/python-list

Re: Time zone changing while Win app is running

2013-04-03 Thread CM
On Apr 3, 7:37 am, Steven D'Aprano wrote: > On Tue, 02 Apr 2013 17:04:12 -0700, CM wrote: > > To summarize the issue:  In an application, I have been using Python's > > datetime module to get the current time.  But it seems that, at least > > with Windows (XP), whatever time zone your computer is

Distributing a Python program hell

2013-04-03 Thread John Nagle
I'm struggling with radio hams who are trying to get my antique Teletype program running. I hate having to write instructions like this: Installation instructions (Windows): Download and install Python 2.7 (32-bit) if not already installed. (Python 2.6 or 2.7 is required; "pyserial" will n

Re: Make python 3.3 the default one and not 2.7

2013-04-03 Thread D. Xenakis
thx solved -- http://mail.python.org/mailman/listinfo/python-list

Re: Distributing a Python program hell

2013-04-03 Thread Ian Kelly
On Wed, Apr 3, 2013 at 1:41 PM, John Nagle wrote: > I'm struggling with radio hams who are trying to get my > antique Teletype program running. I hate having to write > instructions like this: > > Installation instructions (Windows): You should check out pyInstaller or py2exe or cx_Freeze. --

Re: Distributing a Python program hell

2013-04-03 Thread Neil Cerutti
On 2013-04-03, John Nagle wrote: > I'm struggling with radio hams who are trying to get my antique > Teletype program running. I hate having to write instructions > like this: > > Installation instructions (Windows): > > Download and install Python 2.7 (32-bit) if not already installed. > (

Re: Distributing a Python program hell

2013-04-03 Thread Grant Edwards
On 2013-04-03, Neil Cerutti wrote: > On 2013-04-03, John Nagle wrote: > >> I'm struggling with radio hams who are trying to get my antique >> Teletype program running. I hate having to write instructions >> like this: >> >> [...] > > Python programs can be distributed as binary-like packages,

Re: IDLE printing problem

2013-04-03 Thread Terry Jan Reedy
On 4/3/2013 2:50 PM, Joe Hill wrote: On Wed, 03 Apr 2013 14:40:38 -0400, Terry Jan Reedy wrote: On 4/3/2013 12:24 PM, Joe Hill wrote: I attempted to print about 10 pages of documentation from the help files using IDLE. On all the pages the side of each page was missing about 1/4 inch of te

Re: [Twisted-Python] Twisted 13.0.0 released

2013-04-03 Thread Glyph
On Apr 3, 2013, at 4:11 AM, Thomas Hervé wrote: > On behalf of Twisted Matrix Laboratories, I am pleased to announce the > release of Twisted 13.0. Thank you Thomas for managing yet another excellent release! > Among the 70 tickets closed, we can see: > > * A new "Introduction to Deferreds" do

Re: Time zone changing while Win app is running

2013-04-03 Thread Terry Jan Reedy
On 4/3/2013 2:46 PM, CM wrote: On Apr 3, 7:37 am, Steven D'Aprano wrote: On Tue, 02 Apr 2013 17:04:12 -0700, CM wrote: To summarize the issue: In an application, I have been using Python's datetime module to get the current time. But it seems that, at least with Windows (XP), whatever time z

Re: Performance of int/long in Python 3

2013-04-03 Thread Chris Angelico
On Thu, Apr 4, 2013 at 4:43 AM, Steven D'Aprano wrote: > On Wed, 03 Apr 2013 10:38:20 -0600, Ian Kelly wrote: > >> On Wed, Apr 3, 2013 at 9:02 AM, Steven D'Aprano >> wrote: >>> On Wed, 03 Apr 2013 09:43:06 -0400, Roy Smith wrote: >>> >>> [...] > n = max(map(ord, s)) > 4 if n > 0x else

Re: Performance of int/long in Python 3

2013-04-03 Thread Chris Angelico
On Thu, Apr 4, 2013 at 2:07 AM, Steven D'Aprano wrote: > On Thu, 04 Apr 2013 01:17:28 +1100, Chris Angelico wrote: > >> Probably, but it still has to scan the body of the string. It'd not be >> too bad if it's all astral, but if it's all BMP, it has to scan the >> whole string. In the max() case,

Re: [Twisted-Python] Twisted 13.0.0 released

2013-04-03 Thread Laurens Van Houtven
Yay! Thanks, Thomas and everyone who contributed to this release :) On Wed, Apr 3, 2013 at 1:11 PM, Thomas Hervé wrote: > On behalf of Twisted Matrix Laboratories, I am pleased to announce the > release of Twisted 13.0. > > Among the 70 tickets closed, we can see: > > * A new "Introduction to

Serpent, a serializer based on ast.literal_eval. Now also with Java and .net implementations

2013-04-03 Thread Irmen de Jong
Hi, I've made "serpent", a serializer based around ast.literal_eval(). You can find it on Pypi: http://pypi.python.org/pypi/serpent Serpent takes a Python object tree and turns it into a serialized form that can be safely read back by ast.literal_eval(). This avoids security issues that other

Your message to bind-users awaits moderator approval

2013-04-03 Thread bind-users-bounces
Your mail to 'bind-users' with the subject Delivery reports about your e-mail Is being held until the list moderator can review it for approval. The reason it is being held: Post by non-member to a members-only list Either the message will get posted to the list, or you will receive no

Re: IDLE printing problem

2013-04-03 Thread Terry Jan Reedy
On 4/3/2013 5:16 PM, Joe Hill wrote: On Wed, 03 Apr 2013 16:20:20 -0400, Terry Jan Reedy wrote: On 4/3/2013 2:50 PM, Joe Hill wrote: On Wed, 03 Apr 2013 14:40:38 -0400, Terry Jan Reedy wrote: On 4/3/2013 12:24 PM, Joe Hill wrote: I attempted to print about 10 pages of documentation from

Re: Performance of int/long in Python 3

2013-04-03 Thread Mark Lawrence
On 03/04/2013 22:55, Chris Angelico wrote: On Thu, Apr 4, 2013 at 4:43 AM, Steven D'Aprano wrote: On Wed, 03 Apr 2013 10:38:20 -0600, Ian Kelly wrote: On Wed, Apr 3, 2013 at 9:02 AM, Steven D'Aprano wrote: On Wed, 03 Apr 2013 09:43:06 -0400, Roy Smith wrote: [...] n = max(map(ord, s)) 4 i

Re: Data storage Py 3.3

2013-04-03 Thread Irmen de Jong
On 4-4-2013 0:33, Joe Hill wrote: > IDLE wants to use Python33 as the data storage folder - with exe files > etc. > Typically the 'default data storage' is in 'last used' directory or most > programs even have a browse setting that one can quickly set and reset. > > What do people here generally d

Re: Performance of int/long in Python 3

2013-04-03 Thread Neil Hodgson
Neil Hodgson, replying to self: The assembler (32-bit build) for each PyUnicode_READ looks like Don't have 64-bit MSVC 2010 set up but the code from 64-bit MSVC 2012 is better since there are an extra 8 registers in 64-bit mode: ; 10431: c1 = PyUnicode_READ(kind1, data1, i);

Re: Performance of int/long in Python 3

2013-04-03 Thread Roy Smith
In article , rusi wrote: > On Apr 3, 6:43 pm, Roy Smith wrote: > > This has to inspect the entire string, no?  I posted (essentially) this > > a few days ago: > > > >        if all(ord(c) <= 0x for c in s): > >             return "it's all bmp" > >         else: > >             return "it'

Re: Performance of int/long in Python 3

2013-04-03 Thread Roy Smith
In article <515c448c$0$29966$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Wed, 03 Apr 2013 09:43:06 -0400, Roy Smith wrote: > > [...] > >> n = max(map(ord, s)) > >> 4 if n > 0x else 2 if n > 0xff else 1 > > > > This has to inspect the entire string, no? > > Correct. A

Re: Decorating functions without losing their signatures

2013-04-03 Thread Michele Simionato
On Wednesday, April 3, 2013 3:05:31 AM UTC+2, Rotwang wrote: > After thinking about it for a while I've come up with the following > > abomination Alas, there is actually no good way to implement this feature in pure Python without abominations. Internally the decorator module does something s

question about csv.DictReader

2013-04-03 Thread Norman Clerman
Hello, I have the following python script (some of lines are wrapped): #! /usr/bin/env python import csv def dict_test_1(): """ csv test program """ # Open the file Holdings_EXA.csv HOLDING_FILE = 'Holdings_EXA.csv' try: csv_file = open(HOLDING_FILE, 'rt') except I

In defence of 80-char lines

2013-04-03 Thread Steven D'Aprano
Although PEP 8 is only compulsory for the Python standard library, many users like to stick to PEP 8 for external projects. http://www.python.org/dev/peps/pep-0008/ With perhaps one glaring exception: many people hate, or ignore, PEP 8's recommendation to limit lines to 80 characters. (Strictl

Re: Decorating functions without losing their signatures

2013-04-03 Thread Rotwang
On 03/04/2013 02:05, Rotwang wrote: [...] After thinking about it for a while I've come up with the following abomination: import inspect def sigwrapper(sig): if not isinstance(sig, inspect.Signature): sig = inspect.signature(sig) def wrapper(f): ps = 'args = []\n\t\t' ks

Re: Decorating functions without losing their signatures

2013-04-03 Thread Rotwang
On 03/04/2013 05:15, Steven D'Aprano wrote: On Wed, 03 Apr 2013 02:05:31 +0100, Rotwang wrote: Hi all, Here's a Python problem I've come up against and my crappy solution. Hopefully someone here can suggest something better. I want to decorate a bunch of functions with different signatures; [

Re: In defence of 80-char lines

2013-04-03 Thread Andrew Berg
While I agree that not having a line take up hundreds of characters is a good thing, 80 is really arbitrary in 2013 and having any self-imposed hard limit is silly. When you put a single 4- or 5-character word on a new line because you don't want to go over 80 (or 120 or whatever), the code is /les

Windows printing problem (was re; IDLE printing problem_

2013-04-03 Thread Terry Jan Reedy
On 4/3/2013 6:26 PM, Joe Hill wrote: In light of the fact that this is a new problem and has only occurred in Python - I shall just regard that as either a feature or flaw... Based on what you have said, the problem IS NOT OCCURRING IN PYTHON. It is occurring in the Microsoft HTML help viewer.

Re: Data storage Py 3.3

2013-04-03 Thread Terry Jan Reedy
On 4/3/2013 6:53 PM, Irmen de Jong wrote: On 4-4-2013 0:33, Joe Hill wrote: IDLE wants to use Python33 as the data storage folder - with exe files etc. Typically the 'default data storage' is in 'last used' directory or most programs even have a browse setting that one can quickly set and reset.

Re: Decorating functions without losing their signatures

2013-04-03 Thread Rotwang
On 04/04/2013 02:18, Michele Simionato wrote: On Wednesday, April 3, 2013 3:05:31 AM UTC+2, Rotwang wrote: After thinking about it for a while I've come up with the following abomination Alas, there is actually no good way to implement this feature in pure Python without abominations. Interna

Re: In defence of 80-char lines

2013-04-03 Thread Mitya Sirenef
On 04/03/2013 09:59 PM, Andrew Berg wrote: While I agree that not having a line take up hundreds of characters is a > good thing, 80 is really arbitrary in 2013 and having any self-imposed > hard limit is silly. When you put a single 4- or 5-character word on a > new line because you don't want

Re: question about csv.DictReader

2013-04-03 Thread MRAB
On 04/04/2013 02:26, Norman Clerman wrote: Hello, I have the following python script (some of lines are wrapped): #! /usr/bin/env python import csv def dict_test_1(): """ csv test program """ # Open the file Holdings_EXA.csv HOLDING_FILE = 'Holdings_EXA.csv' try:

Re: question about csv.DictReader

2013-04-03 Thread Tim Chase
On 2013-04-03 18:26, Norman Clerman wrote: > Can anyone explain the presence of the characters "\xref\xbb\xbf" > before the first field contents "Holdings" ? (you mean "\xef", not "\xref") This is a byte-order-mark (BOM), which you can read about at [1]. In this case, it denotes the file as UTF-

Python 3.3 Tkinter Fullscreen - Taskbar not Hiding

2013-04-03 Thread teslafrequency
Hi, I am working with Tkinter, and I have set up some simple code to run: import tkinter import re from tkinter import * global master master = Tk() # Start game Launcher def FormGUI(): master.title("GAME TITLE") SW = master.winfo_screenwidth() / 3.2 SH = master.winfo_screenheight()

Re: In defence of 80-char lines

2013-04-03 Thread llanitedave
I also tend to prefer a maximum between 110 and 120 characters. I find continuation lines confusing, and when you use some third-party tools, such as wxPython, for example, the boilerplate code leads to some long lines. I would hate to have to break up this line, for instance: self.mainLabel.S

Re: In defence of 80-char lines

2013-04-03 Thread rusi
On Apr 4, 6:36 am, Steven D'Aprano wrote: > Although PEP 8 is only compulsory for the Python standard library, many > users like to stick to PEP 8 for external projects. > > http://www.python.org/dev/peps/pep-0008/ > > http://blog.languager.org/2012/10/layout-imperative-in-functional.htmlith > pe

Re: Time zone changing while Win app is running

2013-04-03 Thread CM
> >> I am not the maintainer of the datetime module, but based purely on what > >> you have said, I would consider that a bug. > > I don't. Do you really want every time function slowed by > re-initializing the timezone? It depends; do you know what re-initializing entails and how costly that wo

Re: How to choose between ORMs?

2013-04-03 Thread Alec Taylor
I know None. Currently I use web2py's; which is a DAL not an ORM. On Thu, Apr 4, 2013 at 4:05 AM, Rodrick Brown wrote: > Pick the one you learn and know. > > Sent from my iPhone > > On Apr 3, 2013, at 2:17 AM, Alec Taylor wrote: > >> SQLalchemy and Storm are a few of the popular ORMs out there.

Re: In defence of 80-char lines

2013-04-03 Thread Steven D'Aprano
On Wed, 03 Apr 2013 21:32:33 -0700, llanitedave wrote: > I also tend to prefer a maximum between 110 and 120 characters. I find > continuation lines confusing, and when you use some third-party tools, > such as wxPython, for example, the boilerplate code leads to some long > lines. Excessive boi

Re: In defence of 80-char lines

2013-04-03 Thread Peter Otten
llanitedave wrote: > I also tend to prefer a maximum between 110 and 120 characters. I find > continuation lines confusing, and when you use some third-party tools, > such as wxPython, for example, the boilerplate code leads to some long > lines. > > I would hate to have to break up this line, f

Re: In defence of 80-char lines

2013-04-03 Thread gregor
Am Wed, 3 Apr 2013 21:32:33 -0700 (PDT) schrieb llanitedave : > I would hate to have to break up this line, for instance: > > self.mainLabel.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, > faceName = "FreeSans")) I think this is much more readable: self.mainLabel.SetFont(wx.Font(12,