Re: Performance of int/long in Python 3

2013-04-02 Thread Chris Angelico
On Wed, Apr 3, 2013 at 5:29 PM, Neil Hodgson  wrote:
> Chris Angelico:
>
>
>> I'd be curious to know the sorts of characters used. Given that it's
>> probably a narrow-vs-wide Python difference we're talking here, the
>> actual distribution of codepoints may well make a difference.
>
>
>I was going to upload it but then I thought of potential client
> -confidentiality problems and the need to audit a list that long.

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 it as a method of the string object, nor in
the string or sys modules. It ought to be easy enough at the C level -
just look up the two bits representing 'kind' - but I've not found it
exposed to Python. Is there anything?

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


Re: Performance of int/long in Python 3

2013-04-02 Thread Neil Hodgson

Chris Angelico:


I'd be curious to know the sorts of characters used. Given that it's
probably a narrow-vs-wide Python difference we're talking here, the
actual distribution of codepoints may well make a difference.


   I was going to upload it but then I thought of potential client 
-confidentiality problems and the need to audit a list that long.


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


Re: Performance of int/long in Python 3

2013-04-02 Thread Neil Hodgson

Terry Jan Reedy:


What system *and* what compiler and compiler options. Unless 3.2 and 3.3
are both compiler with the same compiler and settings, we do not know
the source of the difference.


   The version signatures are:

3.2.3 (default, Apr 11 2012, 07:15:24) [MSC v.1500 32 bit (Intel)]

3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit 
(Intel)]


   The machine is running Windows 8 64-bit (the Python installations 
are 32-bit though) and the processor is an i3 2350M running at 2.3 GHz.


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


Re: Performance of int/long in Python 3

2013-04-02 Thread Chris Angelico
On Wed, Apr 3, 2013 at 4:32 PM, Steven D'Aprano
 wrote:
> On Wed, 03 Apr 2013 14:31:03 +1100, Neil Hodgson wrote:
>
>> Sorting a million string list (all the file paths on a particular
>> computer) went from 0.4 seconds with Python 3.2 to 0.78 with 3.3 so
>> we're out of the 'not noticeable by humans' range. Perhaps this is still
>> a 'micro-benchmark' - I'd just like to avoid adding email access to get
>> this over the threshold.
>
> I cannot confirm this performance regression. On my laptop (Debian Linux,
> not Windows), I can sort a million file names in approximately 1.2
> seconds in both Python 3.2 and 3.3. There is no meaningful difference in
> speed between the two versions.

I'd be curious to know the sorts of characters used. Given that it's
probably a narrow-vs-wide Python difference we're talking here, the
actual distribution of codepoints may well make a difference.

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


Re: Performance of int/long in Python 3

2013-04-02 Thread Chris Angelico
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. I put command-line
calculators into *everything*... often in the form of more general
executors, and thus restricted to admins, but it's still a calculator.

For some reason, the ability to type "calc 1+2" and get back 3 is very
satisfying to me. You know, in case I ever forget what one plus two
makes.

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


Re: Performance of int/long in Python 3

2013-04-02 Thread Terry Jan Reedy

On 4/3/2013 1:32 AM, Steven D'Aprano wrote:

On Wed, 03 Apr 2013 14:31:03 +1100, Neil Hodgson wrote:


 Sorting a million string list (all the file paths on a particular
computer) went from 0.4 seconds with Python 3.2 to 0.78 with 3.3 so
we're out of the 'not noticeable by humans' range. Perhaps this is still
a 'micro-benchmark' - I'd just like to avoid adding email access to get
this over the threshold.


What system *and* what compiler and compiler options. Unless 3.2 and 3.3 
are both compiler with the same compiler and settings, we do not know 
the source of the difference.



I cannot confirm this performance regression. On my laptop (Debian Linux,
not Windows), I can sort a million file names in approximately 1.2
seconds in both Python 3.2 and 3.3. There is no meaningful difference in
speed between the two versions.


I am guessing that Neil's undisclosed system (that I can see) is 
Windows, since other benchmarks have been more different on Windows than 
on *nix. Given that we *know* that the 3.2 and 3.3 distribution are 
compiled with different compilers and run with different C runtimes, it 
is possible that some of the difference is from that and not from python 
at all.


tjr



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


How to choose between ORMs?

2013-04-02 Thread Alec Taylor
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, Postgres, SQLite and some of the NoSQL systems; what else
should I be looking for?

Thanks for all suggestions,

Alec Taylor

*not sure if widgets should be a requirement; by widgets I mean
annotation of db schema to specify which widget to use with the form
generator

PS: Will likely use this ORM with: Flask, Bottle or Twisted Matrix
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Performance of int/long in Python 3

2013-04-02 Thread Steven D'Aprano
On Wed, 03 Apr 2013 14:31:03 +1100, Neil Hodgson wrote:

> Sorting a million string list (all the file paths on a particular
> computer) went from 0.4 seconds with Python 3.2 to 0.78 with 3.3 so
> we're out of the 'not noticeable by humans' range. Perhaps this is still
> a 'micro-benchmark' - I'd just like to avoid adding email access to get
> this over the threshold.

I cannot confirm this performance regression. On my laptop (Debian Linux, 
not Windows), I can sort a million file names in approximately 1.2 
seconds in both Python 3.2 and 3.3. There is no meaningful difference in 
speed between the two versions.



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


Re: Performance of int/long in Python 3

2013-04-02 Thread rusi
On Apr 3, 9:03 am, Neil Hodgson  wrote:
> rusi wrote:
> > ...
> >> a 'micro-benchmark' - I'd just like to avoid adding email access to get
> >> this over the threshold.
>
> > What does that last statement mean?
>
>     Its a reference to a comment by Jamie Zawinski (relatively famous
> developer of Netscape Navigator and other things):

And Xemacs (which is famous in the free sw world for other things!)

>
>     "Every program attempts to expand until it can read mail. Those
> programs which cannot so expand are replaced by ones which can."

:-) Ok got it

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


Re: Decorating functions without losing their signatures

2013-04-02 Thread Jan Riechers

On 03.04.2013 04:05, 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; for example, I might
want to add some keyword-only arguments to all functions that return
instances of a particular class so that the caller can create instances
with additional attributes. So I do something like this:

[...]

It seems to work, but I don't like it. Does anyone know of a better way
of doing the same thing?


Hi,

I think you might want to check out that Pycon2013 Video about Metaclass 
Prgoramming of David Beazley:

http://www.pyvideo.org/video/1716/python-3-metaprogramming

He explains how to passing attributes, such creating custom classes on 
demand and returning there signatures even when wrapped.


I think that was what you wanted to archive?

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


Re: Decorating functions without losing their signatures

2013-04-02 Thread Steven D'Aprano
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;
[...]
> After thinking about it for a while I've come up with the following
> abomination:
[...]
> It seems to work, but I don't like it. Does anyone know of a better way
> of doing the same thing?


Wait until Python 3.4 or 3.5 (or Python 4000?) when functools.wraps 
automatically preserves the function signature?

Alas, I think this is a hard problem to solve with current Python. You 
might like to compare your solution with that of Michele Simionato's 
"decorator" module:

http://micheles.googlecode.com/hg/decorator/documentation.html


See this for some other ideas:

http://numericalrecipes.wordpress.com/2009/05/25/signature-preserving-
function-decorators/



Good luck!




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


Re: Performance of int/long in Python 3

2013-04-02 Thread Roy Smith
In article 
<5f8ed721-7c89-4ffd-8f2b-21979cc33...@kk11g2000pbb.googlegroups.com>,
 rusi  wrote:

> On Apr 3, 8:31 am, Neil Hodgson  wrote:
> 
> >     Sorting a million string list (all the file paths on a particular
> > computer) went from 0.4 seconds with Python 3.2 to 0.78 with 3.3 so
> > we're out of the 'not noticeable by humans' range.

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.

Still, it is unfortunate if sort performance got hurt significantly.  My 
mind was blown a while ago when I discovered that python could sort a 
file of strings faster than the unix command-line sort utility.  That's 
pretty impressive.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Performance of int/long in Python 3

2013-04-02 Thread Neil Hodgson

rusi wrote:

...

a 'micro-benchmark' - I'd just like to avoid adding email access to get
this over the threshold.


What does that last statement mean?


   Its a reference to a comment by Jamie Zawinski (relatively famous 
developer of Netscape Navigator and other things):


   "Every program attempts to expand until it can read mail. Those 
programs which cannot so expand are replaced by ones which can."


   One of the games played in bug reporting and avoidance is to deny 
that the report is a real problem. A short script is dismissed as 
unrepresentative of actual programs. Once it can read email though, it 
has to be a real program.


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


Re: Help with python code!

2013-04-02 Thread Jason Friedman
> Thanks for your replies. Just to be clear this is for a interview and they
> would like me to figure out what the code does and come back with some test
> cases. I don't need to code the tests, just give some high level tests. As
> far as I can make out it is some system where you input your name and it
> will bring back your details plus how much time you have left on your card.
> Have to say I find the code extremely confusing, hopefully all python isn't
> like this!!
>

This question causes me to recall this story.  I was interviewing college
student candidates for a Summer internship. The interview consisted of a
30-minute phone conversation followed by a 60-minute programming exercise
(performed offsite).  One candidate listed only VB and HTML as programming
languages, but the candidate was local and thought I'd give the person a
chance and some interviewing practice.  Only two of nine candidates "aced"
the programming exercise, and this candidate was one of them!  The
candidates could choose whatever programming language they liked, this
candidate chose C#.  I wrote back to acknowledge receiving the answers and
asked why C# was not listed on the resume.  The candidate replied that
three friends helped compose the answer!

I should have asked whether the candidate would, if offered the position,
be able to bring those three friends to work every day.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Performance of int/long in Python 3

2013-04-02 Thread rusi
On Apr 3, 8:31 am, Neil Hodgson  wrote:

>     Sorting a million string list (all the file paths on a particular
> computer) went from 0.4 seconds with Python 3.2 to 0.78 with 3.3 so
> we're out of the 'not noticeable by humans' range. Perhaps this is still
> a 'micro-benchmark' - I'd just like to avoid adding email access to get
> this over the threshold.

What does that last statement mean?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Performance of int/long in Python 3

2013-04-02 Thread Neil Hodgson

Ian Kelly:


Micro-benchmarks like the ones you have been reporting are *useful*
when it comes to determining what operations can be better optimized,
but they are not *important* in and of themselves.  What is important
is that actual, real-world programs are not significantly slowed by
these kinds of optimizations.  Until you can demonstrate that real
programs are adversely affected by PEP 393, there is not in my opinion
any regression that is worth worrying over.


   The problem with only responding to issues with real-world programs 
is that real-world programs are complex and their performance issues 
often difficult to diagnose. See, for example, scons which is written in 
Python and which has not been able to overcome performance problems over 
several years. 
(http://www.electric-cloud.com/blog/2010/07/21/a-second-look-at-scons-performance/)


   Bottom-up performance work has advantages in that a narrow focus 
area can be more easily analyzed and tested and can produce widely 
applicable benefits.


   The choice of comparison for the script wasn't arbitrary. Comparison 
is one of the main building blocks of higher-level code. Sorting, for 
example, depends strongly on comparison performance with a decrease in 
comparison speed multiplied when applied to sorting.


   Its unfortunate that stringbench.py does not contain any comparison 
or sorting tests.


   Sorting a million string list (all the file paths on a particular 
computer) went from 0.4 seconds with Python 3.2 to 0.78 with 3.3 so 
we're out of the 'not noticeable by humans' range. Perhaps this is still 
a 'micro-benchmark' - I'd just like to avoid adding email access to get 
this over the threshold.


   Here's some code. Replace the "if 1" with "if 0" on subsequent runs 
to avoid the costly file system walk.


import os, time
from os.path import join, getsize
paths = []
if 1:
for root, dirs, files in os.walk('c:\\'):
for name in files:
paths.append(join(root, name))
with open("filelist.txt", "w") as f:
f.write("\n".join(paths))
else:
with open("filelist.txt", "r") as f:
paths = f.read().split("\n")
print(len(paths))
timeStart = time.time()
paths.sort()
timeEnd = time.time()
print("Time taken=", timeEnd - timeStart)

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


Re: OSError: [Errno 127] Value too large to be stored in data type

2013-04-02 Thread Steven D'Aprano
On Tue, 02 Apr 2013 08:44:31 -0700, Chris Hulan wrote:

> On Tuesday, April 2, 2013 9:52:14 AM UTC-4, Chris Hulan wrote:
>> Running Python 2.3.2 on AIX
>> 
>> getting "OSError: [Errno 127] Value too large to be stored in data
>> type"
>> 
>> when executing:
>> 
>> os.listdir('/some/NFS/dir')
>> 
>> The error only happens on NFS mounted dirs
>> 
>> Anyone else seen this?
> 
> Looks like it may be a aix and  NFS config issue as it only affects 1
> NFS server and only on AIX



Thanks for responding on-list with a follow-up, and I'm sorry that nobody 
was able to give you any useful answers. If you do find a solution, work-
around or even just an explanation, please consider replying again with 
an answer.




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


Re: executor.map() TypeError: zip argument #2 must support iteration

2013-04-02 Thread iMath
在 2013年4月1日星期一UTC+8下午3时48分34秒,Steven D'Aprano写道:
> On Sun, 31 Mar 2013 21:45:21 -0700, iMath wrote:
> 
> 
> 
> > executor.map()TypeError: zip argument #2 must support iteration
> 
> > 
> 
> > when I run it ,just generated TypeError: zip argument #2 must support
> 
> > iteration. can anyone help me fix this problem ?
> 
> 
> 
> Yes. Read the error message, and inspect the line that is in error. You 
> 
> have:
> 
> 
> 
> > future_to_url = executor.map(str,lst100, 60)
> 
> 
> 
> executor.map has three arguments:
> 
> 
> 
> Arg 0: str
> 
> Arg 1: list of 100 ints
> 
> Arg 2: int 60
> 
> 
> 
> Argument 2, the number 60, does not support iteration, since it is an int.
> 
> 
> 
> Now read the docs for map. At the interactive interpreter, do this:
> 
> 
> 
> py> from concurrent.futures import ThreadPoolExecutor
> 
> py> help(ThreadPoolExecutor.map)
> 
> 
> 
> 
> 
> and you will see the following documentation:
> 
> 
> 
> map(self, fn, *iterables, timeout=None)
> 
> Returns a iterator equivalent to map(fn, iter).
> 
> 
> 
> Args:
> 
> fn: A callable that will take take as many arguments as there are
> 
> passed iterables.
> 
> timeout: The maximum number of seconds to wait. If None, then
> 
> there is no limit on the wait time.
> 
> 
> 
> 
> 
> Notice that the iterables argument is prefixed with * symbol. That means 
> 
> that it collects all the remaining positional arguments, which means that 
> 
> the timeout argument is keyword only.
> 
> 
> 
> So try this:
> 
> 
> 
> 
> 
> future_to_url = executor.map(str, lst100, timeout=60)
> 
> 
> 
> 
> 
> -- 
> 
> Steven

thanks for  clarification.I thought argument 2 is lst100
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter

2013-04-02 Thread Renato Barbosa Pim Pereira
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


2013/4/2 Jason Swails 

> Please keep response replies to the Python list (e.g., use 'reply all' or
> just send the email to python-list).
>
> Also, you should tell people what Python version you are using. I assume
> you are using Python 2 since Tkinter was renamed to tkinter in Python 3.
>
> Finally, do not top-post.  Type your responses inside the body of the
> email you are responding to.  That gives people context for your responses.
>
> On Tue, Apr 2, 2013 at 11:48 AM, Renato Barbosa Pim Pereira <
> renato.barbosa.pim.pere...@gmail.com> wrote:
>
>> Sorry for my inconsistence:
>>
>> I need a textbox to get one number and pass for variable called numero
>> with one click of button. Thanks .
>>
>> I have this:
>>
>> import numpy as np
>> import matplotlib.pyplot as plt
>> from Tkinter import *
>> import tkMessageBox
>>
>> prefixo = "vetor"
>> numero = 10
>> numeroVetores = 0
>>
>> def makeWidgets(numero):
>> global entries
>> window = Tk()
>> window.title('Vetores')
>> form = Frame(window)
>> form.pack()
>> entries = {}
>> for ix in range(numero):
>> label = "%s %s" % (prefixo , ix + 1)
>> lab = Label(form, text=label)
>> ent = Entry(form)
>> lab.grid(row=ix, column=0)
>> ent.grid(row=ix, column=1)
>> entries[label] = ent
>>
>>
>>
>>
>>
>> Button(window, text="Calcular",  command=calcular).pack(side=LEFT)
>> Button(window, text="Media",  command=media).pack(side=LEFT)
>>
>>
>>
>> return window
>>
>>
>>
>> def pegavalores():
>> valores = []
>> for chave, entrada in sorted(entries.items()):
>> valores.append(entrada.get())
>>
>> return valores
>>
>>
>> def calcular():
>> calcular = pegavalores()
>> plt.plot(calcular)
>> plt.show()
>>
>> def media():
>> media = pegavalores()
>> elementos = len(media)
>> media = np.asarray(media, dtype=np.float64)
>> valormedio = np.sum(media)/elementos
>> tkMessageBox.showinfo("Media", valormedio)
>>
>>
>> window = makeWidgets(numero)
>> window.mainloop()
>>
>
> I'm not sure exactly what you are trying to do.  My guess is that you want
> to get "numero" from user input.  Luckily, the tkSimpleDialog module
> contains a handy function that does just this: askinteger.  So add a call:
>
> numero = tkSimpleDialog.askinteger('Window Title', 'Please insert the
> number of input values you want')
> window = makeWidgets(numero)
> window.mainloop()
>
> I leave to you the task of bringing tkSimpleDialog into your namespace.
>
> Good luck,
> Jason
> --
> Jason M. Swails
> Quantum Theory Project,
> University of Florida
> Ph.D. Candidate
> 352-392-4032
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Decorating functions without losing their signatures

2013-04-02 Thread Rotwang

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; for example, I might 
want to add some keyword-only arguments to all functions that return 
instances of a particular class so that the caller can create instances 
with additional attributes. So I do something like this:


import functools

def mydecorator(f):
@functools.wraps(f)
def wrapped(*args, attribute = None, **kwargs):
result = f(*args, **kwargs)
result.attribute = attribute
return result
return wrapped

@mydecorator
def f(x, y = 1, *a, z = 2, **k):
return something

The problem with this is, when I subsequently type 'f(' in IDLE, the 
signature prompt that appears is not very useful; it looks like this:


(*args, attribute=None, **kwargs)

whereas I'd like it to look like this:

(x, y=1, *a, z=2, attribute=None, **k)


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 = 'kwargs = {}\n\t\t'
for p in sig.parameters.values():
  if p.kind in (p.POSITIONAL_ONLY, p.POSITIONAL_OR_KEYWORD):
ps = '%sargs.append(%s)\n\t\t' % (ps, p.name)
  elif p.kind == p.VAR_POSITIONAL:
ps = '%sargs.extend(%s)\n\t\t' % (ps, p.name)
  elif p.kind == p.KEYWORD_ONLY:
ks = '%skwargs[%r] = %s\n\t\t' % (ks, p.name, p.name)
  elif p.kind == p.VAR_KEYWORD:
ks = '%skwargs.update(%s)\n\t\t' % (ks, p.name)
loc = {'wrapped': f}
defstring = ('def wrapouter(wrapped = wrapped):'
 '\n\tdef wrapinner%s:'
 '\n\t\t%s%sreturn wrapped(*args, **kwargs)'
 '\n\treturn wrapinner' % (sig, ps, ks))
exec(defstring, f.__globals__, loc)
return loc['wrapouter']()
  return wrapper

The function sigwrapper() may be passed an inspect.Signature object sig 
(or function, if that function has the right signature) and returns a 
decorator that gives any function the signature sig. I can then replace 
my original decorator with something like


def mydecorator(f):
sig = inspect.signature(f)
sig = do_something(sig) # add an additional kw-only argument to sig
@functools.wraps(f)
@sigwrapper(sig)
def wrapped(*args, attribute = None, **kwargs):
result = f(*args, **kwargs)
result.attribute = attribute
return result
return wrapped

It seems to work, but I don't like it. Does anyone know of a better way 
of doing the same thing?

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


Time zone changing while Win app is running

2013-04-02 Thread CM
Although there is an answer to my concern posted on Stack Overflow[1],
I thought I'd run this by the Python group to just get a read on it,
since it strikes me as a concern.

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 what datetime will use--the time zone
will *not* be updated in the application when you update it manually
with Windows.  So, if you change the time zone (say, after traveling
with your laptop), all datetimes will be incorrect as compared to your
system clock.

The S.O. page has an answer that uses ctypes and Kernel32's
GetLocalTime, and I've found I could do that, though it seems it would
require me to substitute this for all uses of Python's datetime...and
that is not a happy consideration at all.  If I'm not using datetime,
I am not using dateutil, not doing the same kind of date math, tons of
rewriting... Not good.

I haven't thought things through too well yet, but I was thinking I
could get the correct system time via this ctypes based approach and
then take that and turn it into a Python datetime to preserve all the
benefits of datetime, but even that is going to be a lot of work for
this corner case.

Are things regarding this issue basically as I've understood them?  I
hope not.

[1] 
http://stackoverflow.com/questions/4360981/make-python-respond-to-windows-timezone-changes)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help

2013-04-02 Thread Walter Hurry
On Tue, 02 Apr 2013 02:02:58 +0100, Mark Lawrence wrote:

> On 02/04/2013 00:56, Walter Hurry wrote:
>> On Mon, 01 Apr 2013 15:12:20 -0700, khaosyt wrote:
>>
>> 
>>
>> Sigh. Another one for the bozo bin.
>>
>>
> I say old chap you're setting yourself up for attacks from the Python
> Mailing List Police for using the word bozo, so expect a visit from
> Vicar Sergeant or Detective Parsons.  Oh sorry they're from the Church
> Police, but please be cautious anyway.

Righty ho, old boy. I'll be more careful in future. Thanks! ;-)
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2013-04-02 Thread Ned Deily
In article 
,
 Sven  wrote:
> I am using Python 2.7 with pyobjc on Lion and NSNotification center to
> monitor any inserted USB volumes. This works fine.
[...]

Since your question really is about OS X APIs and not Python or even 
PyObjC, you're more likely to get a meaningful answer elsewhere.  Try 
StackOverflow or one of the OS X lists.

-- 
 Ned Deily,
 n...@acm.org

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


Re: distutils without a compiler

2013-04-02 Thread Ned Deily
In article <515aa9bf.4010...@chamonix.reportlab.co.uk>,
 Robin Becker  wrote:
> Is there a neat way to get distutils to report compiler absence? Most windows 
> users don't have a compiler so building extensions usually doesn't work.
> 
> However, python's builtin batteries would allow pre-built pyds to be 
> downloaded 
> in lieu of an actual build.
> 
> Has anyone created a fallback download compiler or similar?

I'm not totally sure I understand what you are asking but here's a 
guess.  Today, probably the most widely-used solution to provide 
packages with pre-built C extension modules is to use setuptools or its 
Distribute fork and build a bdist egg which can then be downloaded and 
installed with the easy_install command.

Note the whole area of binary distributions for Python is one that is 
now under intense active development.  The standard library replacement 
for binary eggs will be wheels;  various tools to support building and 
installing them are being designed and implemented and are expected to 
be part of Python 3.4 with downloadable support for selected earlier 
releases.  It's all happening on the distutils-sig and in various PEPs.  
Nick Coughlan, the core developer leading the design effort, gives an 
overview of the current plans here:

http://python-notes.boredomandlaziness.org/en/latest/pep_ideas/core_packa
ging_api.html

-- 
 Ned Deily,
 n...@acm.org

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


Re: Installation on Mac OSX 10.6.8 doesn't create the folder: /System/Library/Frameworks/Python.framework/Versions/2.7/

2013-04-02 Thread Ned Deily
In article 
,
 Jason Swails  wrote:

> On Tue, Apr 2, 2013 at 6:22 AM, kramer65  wrote:
> 
> > Hello people,
> >
> >
> > I installed python 2.7 on Mac OSX 10.6.8 with no problems  and it is
> > working fine. When I try to install Kivy however (www.kivy.org), I get an
> > error saying:
> >
> 
> How did you install Python 2.7?  How did you install Kivy?  Note that Kivy
> states 10.7 or 10.8 is required.

> 
> /> /usr/local/bin/kivy: line 24: 
> > /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7: No 
> > such file or directory
> > /usr/local/bin/kivy: line 24: exec: 
> > /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7: 
> > cannot execute: No such file or directory
> > 
> > Upon inspection the there are folders named 2.3, 2.5 and 2.6 in the 
> > Versions 
> > folder, but indeed no folder named "2.7". When I log into the interactive 
> > python command line however, it clearly says I've got python 2.7.3 
> > installed.

/System/Library/Frameworks is the location for Apple-supplied system 
Pythons.  OS X 10.6 ships with complete versions of Python 2.6 and 2.5 
(and the shared libs for 2.3).  So you won't find a 2.7 folder there in 
10.6.8.  In OS X 10.7 and 10.8, Apple ships 2.7, 2.6, and 2.5.

If you used one of the python.org installers to install 2.7, it will be 
installed into /Library/Frameworks and, by default, symlinks will be 
installed in /usr/local/bin for python, python2.7, etc.  Since 
/usr/local/bin/kivy appears to be a script of some sort, examine it and 
see exactly what command is on line 24.  The solution might be as simple 
as editing a line there to remove the "/System" part.

> Another option is to grok the MacPorts Portfile for Python 2.7 to figure
> out how they compile it using the Mac Framework and emulate that process
> when you build Python 2.7 from source (but don't install to /opt/local).

I'm not sure what you are proposing there.  But you should never attempt 
to install anything into /System/Library: that's part of OS X and 
controlled by Apple.

-- 
 Ned Deily,
 n...@acm.org

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


Re: Performance of int/long in Python 3

2013-04-02 Thread Lele Gaifax
jmfauth  writes:

> Now replace i by a char, a representent of each "subset"
> of the FSR, select a method where this FST behave badly
> and take a look of what happen.

You insist in cherry-picking a single "method where this FST behave
badly", even when it is so obviously a corner case (IMHO it is not
reasonably a common case when you have relatively big chunks of ASCII
characters where you are adding one single non-ASCII char...)

Anyway, these are my results on the opposite case, where you have a big
chunk of non-ASCII characters and a single ASCII char added:

Python 2.7.3 (default, Jan  2 2013, 13:56:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import timeit
>>> timeit.repeat("'€' * 1000 + 'z'")
[0.2817099094390869, 0.2811391353607178, 0.2811310291290283]
>>> timeit.repeat("u'œ' * 1000 + u'\U00010001'")
[0.549591064453125, 0.5502040386199951, 0.5490291118621826]
>>> timeit.repeat("u'\U00010001' * 1000 + u'œ'")
[0.3823568820953369, 0.3823089599609375, 0.3820679187774658]
>>> timeit.repeat("u'\U00010002' * 1000 + 'a'")
[0.45046305656433105, 0.45000195503234863, 0.44980502128601074]

Python 3.3.0 (default, Mar 18 2013, 12:00:52) 
[GCC 4.7.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import timeit
>>> timeit.repeat("'€' * 1000 + 'z'")
[0.23264244200254325, 0.23299441300332546, 0.2325888039995334]
>>> timeit.repeat("'œ' * 1000 + '\U00010001'")
[0.3760241370036965, 0.37552819900156464, 0.3755163860041648]
>>> timeit.repeat("'\U00010001' * 1000 + 'œ'")
[0.28259182300098473, 0.2825558360054856, 0.2824251129932236]
>>> timeit.repeat("'\U00010002' * 1000 + 'a'")
[0.28227063300437294, 0.2815949220021139, 0.2829978369991295]

IIUC, while it may be true that Py3 is slightly slower than Py2 when the
string operation involves an internal representation change (all your
examples, and the second operation above), in the much more common case
it is considerably faster. This, and the fact that Py3 actually handles
the whole Unicode space without glitches, make it a better environment
in my eyes. Kudos to the core team!

Just my 0.45-0.28 cents,
ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
l...@metapensiero.it  | -- Fortunato Depero, 1929.

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


Re: Performance of int/long in Python 3

2013-04-02 Thread Joshua Landau
The initial post posited:
"The Python 3 merge of int and long has effectively penalized
small-number arithmetic by removing an optimization. As we've seen
from PEP 393 strings (jmf aside), there can be huge benefits from
having a single type with multiple representations internally. Is
there value in making the int type have a machine-word optimization in
the same way?"

Thanks to the fervent response jmf has gotten, the point above has been
mostly abandoned  May I request that next time such an obvious diversion
(aka. jmf) occurs, responses happen in a different thread?
-- 
http://mail.python.org/mailman/listinfo/python-list


Getting USB volume serial number from inserted device on OSX

2013-04-02 Thread Sven
Hello,

I am using Python 2.7 with pyobjc on Lion and NSNotification center to
monitor any inserted USB volumes. This works fine.

I've also got some ideas how to get a device's serial number, but these
involve just parsing all the USB devices ('system_profiler SPUSBDataType'
command). However I'd like to specifically query the inserted device only
(the one creating the notification) rather than checking the entire USB
device list. The latter seems a little inefficient and "wrong".

Can this be accomplished in a sensible way? The NSNotification object
passed to my handler function doesn't have that kind of information and
I've not been able to find any information on doing the above with the
information provided by the NSNotification object.

I've tried DBus (I use this for the linux handler) but I've not had much
luck getting it to work reliably on OS X and installing it wasn't as
straightforward as I hoped.

I have no requirement to use pyobjc so other suggestions welcome as long as
it's straightforward to install and without too many other dependencies.
I'd like to keep installation straightforward for the end users.
Thanks

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


Re: Fwd: Python subdomains https

2013-04-02 Thread Terry Jan Reedy

On 4/2/2013 12:52 PM, Terry Jan Reedy wrote:

On 4/2/2013 7:05 AM, Jakub Muszynski wrote:

Hi,

I need to add python.org  https to my company
firewall policy, but I'm not allowed to add rule for
https://*.python.org  subdomains.

Can You give me/publish list of important subdomains (like
https://pypi.python.org) so I won't miss important sites?


docs - for the online docs
bugs - for the issue tracker
hg   - for the source repository
svn  - for the external dependencies for building python

mail - for the mailing lists and archives


You could also try all the links on python.org to see if there is
anything else. psf.python.org? or is it only python.org/psf?

Python.org is getting a facelift under a paid contract, so things might
change in the future. I believe the trend is toward more sugdomains.

--Terry






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


Re: Performance of int/long in Python 3

2013-04-02 Thread Terry Jan Reedy

On 4/2/2013 11:12 AM, jmfauth wrote:

On 2 avr, 16:03, Steven D'Aprano  wrote:



I'm sure you didn't intend to be insulting, but some of us *have* taken
JMF seriously, at least at first. His repeated overblown claims of how
Python is destroying Unicode ...


... = 'usability in Python" or some variation on that.


Sorrry I never claimed this, I'm just seeing on how Python is becoming
less Unicode friendly.


Let us see what Jim has claimed, starting in 2012 August.

http://mail.python.org/pipermail/python-list/2012-August/628826.html
"Devs are developing sophisticed tools based on a non working basis."

http://mail.python.org/pipermail/python-list/2012-August/629514.html
"This "Flexible String Representation" fails."

http://mail.python.org/pipermail/python-list/2012-August/629554.html
"This flexible representation is working absurdly."

Reader can decide whether 'non-working', 'fails', 'working absurdly' are 
closer to 'destroying Unicode usability or just 'less friendly'.


On speed:

http://mail.python.org/pipermail/python-list/2012-August/628781.html
"Python 3.3 is "slower" than Python 3.2."

http://mail.python.org/pipermail/python-list/2012-August/628762.html
"I can open IDLE with Py 3.2 ou Py 3.3 and compare strings 
manipulations. Py 3.3 is always slower. Period."


False. Period. Here is my followup at the time.
python.org/pipermail/python-list/2012-August/628779.html
"You have not tried enough tests ;-).

On my Win7-64 system:
from timeit import timeit

print(timeit(" 'a'*1 "))
3.3.0b2: .5
3.2.3: .8

print(timeit("c in a", "c  = '…'; a = 'a'*1"))
3.3: .05 (independent of len(a)!)
3.2: 5.8  100 times slower! Increase len(a) and the ratio can be made as
high as one wants!

print(timeit("a.encode()", "a = 'a'*1000"))
3.2: 1.5
3.3:  .26"

If one runs stringbency.ph with its 40 or so tests, 3.2 is sometimes 
faster and 3.3 is sometimes faster.


http://mail.python.org/pipermail/python-list/2012-September/630736.html

On to September:

"http://mail.python.org/pipermail/python-list/2012-September/630736.html";
"Avoid Py3.3"

In other words, ignore all the benefits and reject because a couple of 
selected microbenchmarks show a slowdown.


http://mail.python.org/pipermail/python-list/2012-September/631730.html
"Py 3.3 succeeded to somehow kill unicode"

I will stop here and let Jim explain how 'kill unicode' is different 
from 'destroy unicode'.


--
Terry Jan Reedy


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


Re: Reseller Host with Python 3 support

2013-04-02 Thread nagia . retsina
An offer someone please?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help installing latest PyQT

2013-04-02 Thread D. Xenakis
Τη Τρίτη, 2 Απριλίου 2013 10:44:43 μ.μ. UTC+3, ο χρήστης Sibylle Koczian έγραψε:
> Am 02.04.2013 18:10, schrieb David Robinow:
> 
> >
> 
> > 3)Downloaded and installed "PyQt4-4.10-gpl-Py3.3-Qt5.0.1-x64-2.exe"
> 
> > from http://www.riverbankcomputing.com/software/pyqt/download ,
> 
> > here: "C:\Python33" (It was the setup's default choice so i assumed
> 
> > it was also the right one).
> 
> >
> 
> > Yes.
> 
> >
> 
> >
> 
> > And thats it..
> 
> >
> 
> > What should i do exactly now foks :)
> 
> >
> 
> > You should be done.Start an interactive python and enter:
> 
> >  >>>import PyQt4
> 
> >
> 
> > If there's no traceback you're good to go.
> 
> >
> 
> 
> 
> I'd try one thing more from that interactive python prompt:
> 
> 
> 
> from PyQt4 import QtCore
> 
> from PyQt4 import QtGui
> 
> 
> 
> Do you get tracebacks with this? (I do, that's why I ask.)
> 
> 
> 
> The examples that come with the installation usually do both imports in 
> 
> one line, but for a first test this may be better: if you get an error, 
> 
> you see a little more.
> 
> 
> 
> HTH
> 
> Sibylle

from PyQt4 import QtCore 
from PyQt4 import QtGui

I get no error using those on IDLE 3.3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help installing latest PyQT

2013-04-02 Thread D. Xenakis
I had also installed in the past python 2.7 . Now when im trying to run a .py, 
interpreter 2.7 is always being called.. (also when im right clicking and 
sellecting to run in IDLE, 2.7 is agai
n starting instead of 3.3) so PyQt4 is crashing. Any tip to make 3.3 the 
default interpreter plz?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help installing latest PyQT

2013-04-02 Thread D. Xenakis
Τη Τρίτη, 2 Απριλίου 2013 6:39:07 μ.μ. UTC+3, ο χρήστης D. Xenakis έγραψε:
> Hi there im trying to install PyQT (version 
> PyQt4-4.10-gpl-Py3.3-Qt5.0.1-x64-2.exe) but i dont know how to make sure i 
> have installed everything correctly. I tried to find documentation about this 
> but most links were very dead..
> 
> 
> 
> So far so good.. i have:
> 
> 1)Downloaded and installed "Python 3.3.0 Windows X86-64 MSI Installer" from 
> http://www.python.org/download/ , here: "C:\Python33" (i have 64 bit Win7 pro 
> Greek edition)
> 
> 
> 
> 2)Downloaded and unzipped "sip-4.14.5.zip" from 
> http://www.riverbankcomputing.com/software/sip/download , here: 
> "D:\Downloads\sip-4.14.5" (other than that, haven't played with this folder 
> any further, cause i dont know what exactly i should do with that so 
> everything is get properly done..) I suppose after having it unzipped, i 
> should then move that somewhere (maybe here "C:\Python33") and then maybe run 
> some commands but.. help needed here so i dont do something wrong, as this 
> link http://goo.gl/UuLjz doesnt make that clear to me what exact steps i 
> should follow :( .
> 
> 
> 
> 3)Downloaded and installed "PyQt4-4.10-gpl-Py3.3-Qt5.0.1-x64-2.exe" from 
> http://www.riverbankcomputing.com/software/pyqt/download , here: 
> "C:\Python33" (It was the setup's default choice so i assumed it was also the 
> right one).
> 
> 
> 
> And thats it.. 
> 
> 
> 
> What should i do exactly now foks :)
> 
> Thx in advance

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


Re: Performance of int/long in Python 3

2013-04-02 Thread Ian Kelly
On Tue, Apr 2, 2013 at 3:20 AM, jmfauth  wrote:
> It is somehow funny to see, the FSR "fails" precisely
> on problems Unicode will solve/handle, eg normalization or
> sorting [3].

Neither of these problems have anything to do with the FSR.  Can you
give us an example of normalization or sorting where Python 3.3 fails
and Python 3.2 does not?

> [3] I only test and tested these "chars" blindly with the help
> of the doc I have. Btw, when I test complicated "Arabic chars",
> I noticed, Py33 "crashes", it does not really crash, it get stucked
> in some king of infinite loop (or is it due to "timeit"?).

Without knowing what the actual test that you ran was, we have no way
of answering that.  Unless you give us more detail, my assumption
would be that the number of repetitions that you passed to timeit was
excessively large for the particular test case.

> [4] Am I the only one who test this kind of stuff?

No, you're just the only one who considers it important.
Micro-benchmarks like the ones you have been reporting are *useful*
when it comes to determining what operations can be better optimized,
but they are not *important* in and of themselves.  What is important
is that actual, real-world programs are not significantly slowed by
these kinds of optimizations.  Until you can demonstrate that real
programs are adversely affected by PEP 393, there is not in my opinion
any regression that is worth worrying over.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help installing latest PyQT

2013-04-02 Thread Sibylle Koczian

Am 02.04.2013 18:10, schrieb David Robinow:

On Tue, Apr 2, 2013 at 11:39 AM, D. Xenakis mailto:gouzouna...@hotmail.com>> wrote:

3)Downloaded and installed "PyQt4-4.10-gpl-Py3.3-Qt5.0.1-x64-2.exe"
from http://www.riverbankcomputing.com/software/pyqt/download ,
here: "C:\Python33" (It was the setup's default choice so i assumed
it was also the right one).

Yes.


And thats it..

What should i do exactly now foks :)

You should be done.Start an interactive python and enter:
 >>>import PyQt4

If there's no traceback you're good to go.



I'd try one thing more from that interactive python prompt:

from PyQt4 import QtCore
from PyQt4 import QtGui

Do you get tracebacks with this? (I do, that's why I ask.)

The examples that come with the installation usually do both imports in 
one line, but for a first test this may be better: if you get an error, 
you see a little more.


HTH
Sibylle




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


Re: Python install Win 7 Problem

2013-04-02 Thread David Robinow
On Tue, Apr 2, 2013 at 12:45 PM, Joe Hill  wrote:

> On Tue, 2 Apr 2013 11:44:55 -0400, David Robinow 
> >Download the Windows executables.
> >
> >3.3.0 is the current version
>
> Is "numpy" an option that is needed (guess for math?)?
>
No, it's not needed to run Python. It can be useful. I only mentioned it
because you did.

>
> Assuming 3.3 the current version - what are the "Download the Windows
> executables." files?  and in which order must they be installed?
>
The 32 bit version is at
http://www.python.org/ftp/python/3.3.0/python-3.3.0.msi
The 64 bit version is at
 http://www.python.org/ftp/python/3.3.0/python-3.3.0.amd64.msi

Install one or the other. That's it. If you want to install numpy, do it
after you install python.
 [The suggestion to install the Activestate version is reasonable. I've
never used it. Please use a search engine if you decide to look for it.]


> I never claimed to be a mind reader .
>
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: HTTP GET REQUEST WITH PARAMETERS

2013-04-02 Thread Mark Lawrence

On 02/04/2013 19:39, io wrote:

HI, everyone,

how can i make a HTTP GET REQUEST using python and passing parameters?

I would like to recall my script from within openoffice basic and pass
parameters to it.

Some of the GET or POST are here : https://www.bitstamp.net/api/

thanks for anyhelp



Easiest way I know is to use the highly rated requests module 
http://docs.python-requests.org/en/latest/ which is available on pypi.


--
If you're using GoogleCrap™ please read this 
http://wiki.python.org/moin/GoogleGroupsPython.


Mark Lawrence

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


Re: Performance of int/long in Python 3

2013-04-02 Thread rusi
On Apr 2, 11:22 pm, jmfauth  wrote:
> On 2 avr, 18:57, rusi  wrote:
>
>
>
>
>
>
>
>
>
> > On Apr 2, 8:17 pm, Ethan Furman  wrote:
>
> > > Simmons (too many Steves!), I know you're new so don't have all the 
> > > history with jmf that many
> > > of us do, but consider that the original post was about numbers, had 
> > > nothing to do with
> > > characters or unicode *in any way*, and yet jmf still felt the need to 
> > > bring unicode up.
>
> > Just for reference, here is the starting para of Chris' original mail
> > that started this thread.
>
> > > The Python 3 merge of int and long has effectively penalized
> > > small-number arithmetic by removing an optimization. As we've seen
> > > from PEP 393 strings (jmf aside), there can be huge benefits from
> > > having a single type with multiple representations internally. Is
> > > there value in making the int type have a machine-word optimization in
> > > the same way?
>
> > ie it mentions numbers, strings, PEP 393 *AND jmf.*  So while it is
> > true that jmf has been butting in with trollish behavior into
> > completely unrelated threads with his unicode rants, that cannot be
> > said for this thread.
>
> -
>
> That's because you did not understand the analogy, int/long <-> FSR.
>
> One another illustration,
>
> >>> def AddOne(i):
>
> ...     if 0 < i <= 100:
> ...         return i + 10 + 10 + 10 - 10 - 10 - 10 + 1
> ...     elif 100 < i <= 1000:
> ...         return i + 100 + 100 + 100  + 100 - 100 - 100 - 100 - 100
> + 1
> ...     else:
> ...         return i + 1
> ...
>
> Do it work? yes.
> Is is "correct"? this can be discussed.
>
> Now replace i by a char, a representent of each "subset"
> of the FSR, select a method where this FST behave badly
> and take a look of what happen.
>
> >>> timeit.repeat("'a' * 1000 + 'z'")
>
> [0.6532032148133153, 0.6407248807756699, 0.6407264561239894]>>> 
> timeit.repeat("'a' * 1000 + '9'")
>
> [0.6429508479509245, 0.6242782443215589, 0.6240490311410927]
>
>
>
> >>> timeit.repeat("'a' * 1000 + '€'")
>
> [1.095694927496563, 1.0696347279235603, 1.0687741939041082]>>> 
> timeit.repeat("'a' * 1000 + 'ẞ'")
>
> [1.0796421281222877, 1.0348612767961853, 1.035325216876231]>>> 
> timeit.repeat("'a' * 1000 + '\u2345'")
>
> [1.0855414137412112, 1.0694677410017164, 1.0688096392412945]
>
>
>
> >>> timeit.repeat("'œ' * 1000 + '\U00010001'")
>
> [1.237314015362017, 1.2226262553064657, 1.21994619397816]>>> 
> timeit.repeat("'œ' * 1000 + '\U00010002'")
>
> [1.245773635836997, 1.2303978424029651, 1.2258257877430765]
>
> Where does it come from? Simple, the FSR breaks the
> simple rules used in all coding schemes (unicode or not).
> 1) a unique set of chars
> 2) the "same" algorithm for all chars.

Can you give me a source for this requirement?
Numbers are after all numbers. SO we should use the same code/
algorithms/machine-instructions for floating-point and integers?

>
> And again that's why utf-8 is working very smoothly.

How wonderful. Heres a suggestion.
Code up the UTF-8 and any of the python string reps in C and profile
them.
Please come back and tell us if UTF-8 outperforms any of the python
representations for strings on any operation (except straight copy).

>
> The "corporates" which understood this very well and
> wanted to incorporate, let say, the used characters
> of the French language had only the choice to
> create new coding schemes (eg mac-roman, cp1252).
>
> In unicode, the "latin-1" range is real plague.
>
> After years of experience, I'm still fascinated to see
> the corporates has solved this issue easily and the "free
> software" is still relying on latin-1.
> I never succeed to find an explanation.
>
> Even, the TeX folks, when they shifted to the Cork
> encoding in 199?, were aware of this and consequently
> provides special package(s).
>
> No offense, this is in my mind why "corporate software"
> will always be "corporate software" and "hobbyist software"
> will always stay at the level of "hobbyist software".
>
> A French windows user, understanding nothing in the
> coding of characters, assuming he is aware of its
> existence (!), has certainly no problem.
>
> Fascinating how it is possible to use Python to teach,
> to illustrate, to explain the coding of the characters. No?
>
> jmf

You troll with eclat and elan!
-- 
http://mail.python.org/mailman/listinfo/python-list


HTTP GET REQUEST WITH PARAMETERS

2013-04-02 Thread io
HI, everyone,

how can i make a HTTP GET REQUEST using python and passing parameters?

I would like to recall my script from within openoffice basic and pass 
parameters to it.

Some of the GET or POST are here : https://www.bitstamp.net/api/

thanks for anyhelp
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Performance of int/long in Python 3

2013-04-02 Thread jmfauth
On 2 avr, 18:57, rusi  wrote:
> On Apr 2, 8:17 pm, Ethan Furman  wrote:
>
> > Simmons (too many Steves!), I know you're new so don't have all the history 
> > with jmf that many
> > of us do, but consider that the original post was about numbers, had 
> > nothing to do with
> > characters or unicode *in any way*, and yet jmf still felt the need to 
> > bring unicode up.
>
> Just for reference, here is the starting para of Chris' original mail
> that started this thread.
>
> > The Python 3 merge of int and long has effectively penalized
> > small-number arithmetic by removing an optimization. As we've seen
> > from PEP 393 strings (jmf aside), there can be huge benefits from
> > having a single type with multiple representations internally. Is
> > there value in making the int type have a machine-word optimization in
> > the same way?
>
> ie it mentions numbers, strings, PEP 393 *AND jmf.*  So while it is
> true that jmf has been butting in with trollish behavior into
> completely unrelated threads with his unicode rants, that cannot be
> said for this thread.

-

That's because you did not understand the analogy, int/long <-> FSR.

One another illustration,

>>> def AddOne(i):
... if 0 < i <= 100:
... return i + 10 + 10 + 10 - 10 - 10 - 10 + 1
... elif 100 < i <= 1000:
... return i + 100 + 100 + 100  + 100 - 100 - 100 - 100 - 100
+ 1
... else:
... return i + 1
...

Do it work? yes.
Is is "correct"? this can be discussed.

Now replace i by a char, a representent of each "subset"
of the FSR, select a method where this FST behave badly
and take a look of what happen.


>>> timeit.repeat("'a' * 1000 + 'z'")
[0.6532032148133153, 0.6407248807756699, 0.6407264561239894]
>>> timeit.repeat("'a' * 1000 + '9'")
[0.6429508479509245, 0.6242782443215589, 0.6240490311410927]
>>>

>>> timeit.repeat("'a' * 1000 + '€'")
[1.095694927496563, 1.0696347279235603, 1.0687741939041082]
>>> timeit.repeat("'a' * 1000 + 'ẞ'")
[1.0796421281222877, 1.0348612767961853, 1.035325216876231]
>>> timeit.repeat("'a' * 1000 + '\u2345'")
[1.0855414137412112, 1.0694677410017164, 1.0688096392412945]
>>>

>>> timeit.repeat("'œ' * 1000 + '\U00010001'")
[1.237314015362017, 1.2226262553064657, 1.21994619397816]
>>> timeit.repeat("'œ' * 1000 + '\U00010002'")
[1.245773635836997, 1.2303978424029651, 1.2258257877430765]

Where does it come from? Simple, the FSR breaks the
simple rules used in all coding schemes (unicode or not).
1) a unique set of chars
2) the "same" algorithm for all chars.

And again that's why utf-8 is working very smoothly.

The "corporates" which understood this very well and
wanted to incorporate, let say, the used characters
of the French language had only the choice to
create new coding schemes (eg mac-roman, cp1252).

In unicode, the "latin-1" range is real plague.

After years of experience, I'm still fascinated to see
the corporates has solved this issue easily and the "free
software" is still relying on latin-1.
I never succeed to find an explanation.

Even, the TeX folks, when they shifted to the Cork
encoding in 199?, were aware of this and consequently
provides special package(s).

No offense, this is in my mind why "corporate software"
will always be "corporate software" and "hobbyist software"
will always stay at the level of "hobbyist software".

A French windows user, understanding nothing in the
coding of characters, assuming he is aware of its
existence (!), has certainly no problem.


Fascinating how it is possible to use Python to teach,
to illustrate, to explain the coding of the characters. No?


jmf

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


Re: Python install Win 7 Problem

2013-04-02 Thread balasubramanian Achuthan
Try using Activestate python. The free version would suffice your needs and it 
comes with a clean install. 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: L'applicazione e approvato.

2013-04-02 Thread Ghita

Su vostra richiesta, ha lasciato sul forum inviare una nuova legge.
http://ftp.heljemo.com/Debito.zip?NRzXa4efa7Dut

==
Tel./Fax.: (070) 354 67 54 


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


Re: Performance of int/long in Python 3

2013-04-02 Thread rusi
On Apr 2, 8:12 pm, jmfauth  wrote:
>
> Sorrry I never claimed this, I'm just seeing on how Python is becoming
> less Unicode friendly.

jmf: I suggest you try to use less emotionally loaded and more precise
language if you want people to pay heed to your technical observations/
contributions.
In particular, while you say unicode, your examples always (as far as
I remember) refer to BMP.
Also words like 'friendly' are so emotionally charged that people stop
being friendly :-)

So may I suggest that you rephrase your complaint as
"I am seeing python is becoming poorly performant on BMP-chars at the
expense of correct support for the whole (6.0?) charset"

(assuming thats what you want to say)

In any case PLEASE note that 'performant' and 'correct' are different
for most practical purposes.
If you dont respect this semantics, people are unlikely to pay heed to
your complaints.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Performance of int/long in Python 3

2013-04-02 Thread rusi
On Apr 2, 8:17 pm, Ethan Furman  wrote:

> Simmons (too many Steves!), I know you're new so don't have all the history 
> with jmf that many
> of us do, but consider that the original post was about numbers, had nothing 
> to do with
> characters or unicode *in any way*, and yet jmf still felt the need to bring 
> unicode up.

Just for reference, here is the starting para of Chris' original mail
that started this thread.

> The Python 3 merge of int and long has effectively penalized
> small-number arithmetic by removing an optimization. As we've seen
> from PEP 393 strings (jmf aside), there can be huge benefits from
> having a single type with multiple representations internally. Is
> there value in making the int type have a machine-word optimization in
> the same way?

ie it mentions numbers, strings, PEP 393 *AND jmf.*  So while it is
true that jmf has been butting in with trollish behavior into
completely unrelated threads with his unicode rants, that cannot be
said for this thread.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Fwd: Python subdomains https

2013-04-02 Thread Terry Jan Reedy

On 4/2/2013 7:05 AM, Jakub Muszynski wrote:

Hi,

I need to add python.org  https to my company
firewall policy, but I'm not allowed to add rule for
https://*.python.org  subdomains.

Can You give me/publish list of important subdomains (like
https://pypi.python.org) so I won't miss important sites?


docs - for the online docs
bugs - for the issue tracker
hg   - for the source repository
svn  - for the external dependencies for building python

You could also try all the links on python.org to see if there is 
anything else. psf.python.org? or is it only python.org/psf?


Python.org is getting a facelift under a paid contract, so things might 
change in the future. I believe the trend is toward more sugdomains.


--Terry



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


Re: Tkinter

2013-04-02 Thread Jason Swails
Please keep response replies to the Python list (e.g., use 'reply all' or
just send the email to python-list).

Also, you should tell people what Python version you are using. I assume
you are using Python 2 since Tkinter was renamed to tkinter in Python 3.

Finally, do not top-post.  Type your responses inside the body of the email
you are responding to.  That gives people context for your responses.

On Tue, Apr 2, 2013 at 11:48 AM, Renato Barbosa Pim Pereira <
renato.barbosa.pim.pere...@gmail.com> wrote:

> Sorry for my inconsistence:
>
> I need a textbox to get one number and pass for variable called numero
> with one click of button. Thanks .
>
> I have this:
>
> import numpy as np
> import matplotlib.pyplot as plt
> from Tkinter import *
> import tkMessageBox
>
> prefixo = "vetor"
> numero = 10
> numeroVetores = 0
>
> def makeWidgets(numero):
> global entries
> window = Tk()
> window.title('Vetores')
> form = Frame(window)
> form.pack()
> entries = {}
> for ix in range(numero):
> label = "%s %s" % (prefixo , ix + 1)
> lab = Label(form, text=label)
> ent = Entry(form)
> lab.grid(row=ix, column=0)
> ent.grid(row=ix, column=1)
> entries[label] = ent
>
>
>
>
>
> Button(window, text="Calcular",  command=calcular).pack(side=LEFT)
> Button(window, text="Media",  command=media).pack(side=LEFT)
>
>
>
> return window
>
>
>
> def pegavalores():
> valores = []
> for chave, entrada in sorted(entries.items()):
> valores.append(entrada.get())
>
> return valores
>
>
> def calcular():
> calcular = pegavalores()
> plt.plot(calcular)
> plt.show()
>
> def media():
> media = pegavalores()
> elementos = len(media)
> media = np.asarray(media, dtype=np.float64)
> valormedio = np.sum(media)/elementos
> tkMessageBox.showinfo("Media", valormedio)
>
>
> window = makeWidgets(numero)
> window.mainloop()
>

I'm not sure exactly what you are trying to do.  My guess is that you want
to get "numero" from user input.  Luckily, the tkSimpleDialog module
contains a handy function that does just this: askinteger.  So add a call:

numero = tkSimpleDialog.askinteger('Window Title', 'Please insert the
number of input values you want')
window = makeWidgets(numero)
window.mainloop()

I leave to you the task of bringing tkSimpleDialog into your namespace.

Good luck,
Jason

-- 
Jason M. Swails
Quantum Theory Project,
University of Florida
Ph.D. Candidate
352-392-4032
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python install Win 7 Problem

2013-04-02 Thread David Robinow
On Mon, Apr 1, 2013 at 9:02 PM, Joe Hill  wrote:

> ...
>
> In a Windows 7 environment (even a 64-bit Windows 7 environment), you
> must install the 32-bit version of Python 3. The 64-bit version will not
> work with NumPy 1.6.
>
1.7 is the current version. I use 32-bit Python myself.

> Furthermore, the 32-bit version of Python 3 must be installed 'just
> for me', and not 'for everyone on this computer'.
>
Nonsense.

> Finally, make sure you select the proper NumPy version (for Python
> 3.2), not the default version from SourceForge (which is for Python 2.6).
>
Use
http://sourceforge.net/projects/numpy/files/NumPy/1.7.0/numpy-1.7.0-win32-superpack-python3.2.exe/download

>
> In this post I'm assuming you have already installed Python 3 and that
> you're running Windows 7. Specifically, I'm running Windows 7
> Professional, 64-bit, Service Pack 1. What follows is the whole story of
> the troubleshooting, in case it helps out anyone else having the same
> issues.
> etc.
>
I'm running Windows 7 Home Premium

>
>
> http://docs.python.org/3.2/install/
> More alternatives than an encyclopedia!
> See no reference to Win 7.
> This is NO help
>
I'm not aware of any peculiarities due to use of Win 7 (except it's not
Linux)

>
> http://www.python.org/getit/releases/3.2.3/
> got
> Gzipped source tar ball (3.2.3) (sig), ~ 13 MB
> which was a file:
> Python-3.2.3.tgz
>
Download the Windows executables.

> ...
>
> I'm a total novice - my last program writing was 35+ years ago.  My reason
> for wanting Python is purely for fun an recreation.  I used to just love
> code writing.
>
> Questions:
> 1.  is 3.2.3 the correct version for me?  On April 6 I see that additional
> releases will become available.  I see value in having the latest stable
> programs.  Is any of this for me - I can wait 5 days?
>
3.3.0 is the current version

>
> 2.  Would it make sense to install Python on the D: drive or will that
> just further confuse matters?
>
It shouldn't hurt anything but why would you want to?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help installing latest PyQT

2013-04-02 Thread David Robinow
On Tue, Apr 2, 2013 at 11:39 AM, D. Xenakis  wrote:

> Hi there im trying to install PyQT (version
> PyQt4-4.10-gpl-Py3.3-Qt5.0.1-x64-2.exe) but i dont know how to make sure i
> have installed everything correctly. I tried to find documentation about
> this but most links were very dead..
>
> So far so good.. i have:
> 1)Downloaded and installed "Python 3.3.0 Windows X86-64 MSI Installer"
> from http://www.python.org/download/ , here: "C:\Python33" (i have 64 bit
> Win7 pro Greek edition)
>
> 2)Downloaded and unzipped "sip-4.14.5.zip" from
> http://www.riverbankcomputing.com/software/sip/download , here:
> "D:\Downloads\sip-4.14.5" (other than that, haven't played with this folder
> any further, cause i dont know what exactly i should do with that so
> everything is get properly done..) I suppose after having it unzipped, i
> should then move that somewhere (maybe here "C:\Python33") and then maybe
> run some commands but.. help needed here so i dont do something wrong, as
> this link http://goo.gl/UuLjz doesnt make that clear to me what exact
> steps i should follow :( .
>
sip is not required unless you're building PyQt from sources. You don't
need to do anything with this.

>
> 3)Downloaded and installed "PyQt4-4.10-gpl-Py3.3-Qt5.0.1-x64-2.exe" from
> http://www.riverbankcomputing.com/software/pyqt/download , here:
> "C:\Python33" (It was the setup's default choice so i assumed it was also
> the right one).
>
Yes.

>
> And thats it..
>
> What should i do exactly now foks :)
>
You should be done.Start an interactive python and enter:
>>>import PyQt4

If there's no traceback you're good to go.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OSError: [Errno 127] Value too large to be stored in data type

2013-04-02 Thread Chris Hulan
On Tuesday, April 2, 2013 9:52:14 AM UTC-4, Chris Hulan wrote:
> Running Python 2.3.2 on AIX 
> 
> getting "OSError: [Errno 127] Value too large to be stored in data type"
> 
> when executing:
> 
> 
> 
> os.listdir('/some/NFS/dir')
> 
> 
> 
> The error only happens on NFS mounted dirs
> 
> Anyone else seen this?

Looks like it may be a aix and  NFS config issue as it only affects 1 NFS 
server and only on AIX
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Performance of int/long in Python 3

2013-04-02 Thread Ethan Furman

On 04/02/2013 07:39 AM, Steve Simmons wrote:


On 02/04/2013 15:03, Steven D'Aprano wrote:

On Tue, 02 Apr 2013 11:58:11 +0100, Steve Simmons wrote:


It seems to me that jmf *might* be moving towards a vindicated position.
  There is some interest now in duplicating, understanding and
(hopefully!) extending his test results, which can only be a Good Thing
- whatever the outcome and wherever the facepalm might land.

Some interest "now"? Oh please.

http://mail.python.org/pipermail/python-list/2012-September/629810.html

Mark Lawrence even created a bug report to track this, also back in
September.

http://bugs.python.org/issue16061

I'm sure you didn't intend to be insulting, but some of us *have* taken
JMF seriously, at least at first. His repeated overblown claims of how
Python is destroying Unicode, his lack of acknowledgement that other
people have seen string handling *speed up* not slow down, and his
refusal to assist in diagnosing this performance regression except to
repeatedly quote the same artificial micro-benchmarks over and over again
have lost him whatever credibility he started with.

This feature is a *memory optimization*, not a speed optimization, and
yet as a side-effect of saving memory, it also saves time. Real-world
benchmarks of actual applications demonstrate this. One or two trivial
slowdowns of artificial micro-benchmarks simply are not important, even
if they are genuine. I believe they are genuine, but likely operating
system and hardware dependent.



First off, no insult intended and I haven't been part of this list long enough 
to be fully immersed in the history of
this so I'm sure there are events of which I am unaware.


Yes, that would be his months of trollish behavior on this subject.



However, it seems to me that, for whatever reason, JMF has reached the end of 
his capacity


His capacity, maybe; his time?  Not by a long shot.  I am positive we will continue to see his uncooperative, bratty* 
behavior continue ad nauseum.


--
~Ethan~

*I was going to say childish, but I know plenty of better behaved children.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Performance of int/long in Python 3

2013-04-02 Thread Mark Lawrence

On 02/04/2013 16:12, jmfauth wrote:


Sorrry I never claimed this, I'm just seeing on how Python is becoming
less Unicode friendly.


Please explain this.  I see no justification for this comment.  How can 
an implementation that fixes bugs be less Unicode friendly than its 
earlier, buggier equivalents?




jmf



--
If you're using GoogleCrap™ please read this 
http://wiki.python.org/moin/GoogleGroupsPython.


Mark Lawrence

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


Help installing latest PyQT

2013-04-02 Thread D. Xenakis
Hi there im trying to install PyQT (version 
PyQt4-4.10-gpl-Py3.3-Qt5.0.1-x64-2.exe) but i dont know how to make sure i have 
installed everything correctly. I tried to find documentation about this but 
most links were very dead..

So far so good.. i have:
1)Downloaded and installed "Python 3.3.0 Windows X86-64 MSI Installer" from 
http://www.python.org/download/ , here: "C:\Python33" (i have 64 bit Win7 pro 
Greek edition)

2)Downloaded and unzipped "sip-4.14.5.zip" from 
http://www.riverbankcomputing.com/software/sip/download , here: 
"D:\Downloads\sip-4.14.5" (other than that, haven't played with this folder any 
further, cause i dont know what exactly i should do with that so everything is 
get properly done..) I suppose after having it unzipped, i should then move 
that somewhere (maybe here "C:\Python33") and then maybe run some commands 
but.. help needed here so i dont do something wrong, as this link 
http://goo.gl/UuLjz doesnt make that clear to me what exact steps i should 
follow :( .

3)Downloaded and installed "PyQt4-4.10-gpl-Py3.3-Qt5.0.1-x64-2.exe" from 
http://www.riverbankcomputing.com/software/pyqt/download , here: "C:\Python33" 
(It was the setup's default choice so i assumed it was also the right one).

And thats it.. 

What should i do exactly now foks :)
Thx in advance
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter

2013-04-02 Thread Demian Brecht
...And your question is?...

If you're looking for people to just do your work for you, you'll
likely get little assistance and will instead project a negative image
of yourself here. What have you tried? Where are you stuck? What,
/specifically/, do you need help with or what do you not understand?

Questions with that kind of information and showing that you've done
/some/ work will likely get you helpful answers.

--

Demian Brecht
http://demianbrecht.github.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: extending class static members and inheritance

2013-04-02 Thread Arnaud Delobelle
On 2 April 2013 14:27, Fabian PyDEV  wrote:
> Hi All,
>
> I have a question.
>
> Let says I have the following two classes:
>
> class Base(object):
> __mylist__ = ["value1", "value2"]
>
> def somemethod(self):
> pass
>
>
> class Derived(Base):
> __mylist__ = ["value3", "value4"]
>
> def anothermethod(self):
> pass
>
>
>
>
> what I would like to accomplish is that the class Derived has the member 
> __mylist__ extended or merged as ["value1", "value2", "value3", "value4"].
>
> Is there anyway I could accomplish this?
>
> I was thinking on accomplishing this as follows:
>
>
> class Derived(Base):
> __mylist__ = Base.__mylist__ + ["value3", "value4"]
>
> def anothermethod(self):
> pass
>
>
> Is there a better way? Perhaps a decorator?

class Base(object):

mybits = ["value1", "value2"]

@classmethod
def mylist(cls):
return sum((getattr(p, 'mybits', []) for p in cls.mro()[::-1]), 
[])


class Derived(Base):

mybits = ["value3", "value4"]


class FurtherDerived(Derived):

mybits = ["value5"]


>>> Derived.mylist()
['value1', 'value2', 'value3', 'value4']
>>> FurtherDerived.mylist()
['value1', 'value2', 'value3', 'value4', 'value5']

HTH

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


Re: Tkinter

2013-04-02 Thread Jason Swails
On Mon, Apr 1, 2013 at 5:12 PM, Renato Barbosa Pim Pereira <
renato.barbosa.pim.pere...@gmail.com> wrote:

> I need to create a button and a text box follows the text box to enter a
> number, and this number is expected to create the same screen text boxes, and
> these text boxes need to be referenced, ie if I enter 30 in the first
> text box and click the button to be created 30 text boxes so that I can
> then "call" each of the boxes, eg box1, box2, box3, etc. .. .
>
> This all-in Tkinter.
>
> I thank you all for understanding and help.
>

First, you have not asked a question.  You have just said you need
something.

Second, we are not here to do your homework.  If you want help with your
programming, you have to at least demonstrate an initial effort.

What have you programmed so far?  What does it do?  What errors are you
getting when you run your code?  Annotating your code with what you expect
each segment to do is even better -- it lets us quickly correct
misconceptions.

The more information you can provide, the more targeted help we can give.
 Simply saying "I need a program to do X" is unlikely to get a response any
more helpful than mine.

Good luck,
Jason
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help: pickle module unable to load "rb" mode files in linux

2013-04-02 Thread Peter Otten
Surya Kasturi wrote:

> Hi, hope you can help me on it..
> 
> with open(pickle_f, 'r') as fhand:
> obj = pickle.load(fhand)
> 
> 
> This works on linux but not in windows until  I use "rb" mode while
> creating file object. Surprisingly, the "rb" mode is not working on
> Linux.. raising EOFError.
> 
> Why is this happening?

I don't know.

Please give a complete self-contained example that uses "wb" to write the 
file and "rb" to read it, and that fails on Linux. Don't forget to tell us 
the version of Python you used to run that script.

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


Re: Performance of int/long in Python 3

2013-04-02 Thread Ethan Furman

On 04/02/2013 08:03 AM, Steve Simmons wrote:

On 02/04/2013 15:12, Mark Lawrence wrote:

I've already raised an issue about performance and Neil Hodgson has raised a 
new one.

Recognised in a separate post


To balance this out perhaps we should have counter issues asking for the amount 
of memory being used to be increased
to old levels and the earlier buggier behaviour of Python to be reintroduced? 
Swings and roundabouts?


I don't think I came anywhere near suggesting that we should regress correct 
functionality or memory usage
improvements.  I just don't believe that we can't have good performance 
alongside it.


It's always a trade-off between time and memory.

However, as it happens, there are plenty of instances where the new FSR is faster -- and this in real world code, not 
useless micro-benchmarks.


Simmons (too many Steves!), I know you're new so don't have all the history with jmf that many of us do, but consider 
that the original post was about numbers, had nothing to do with characters or unicode *in any way*, and yet jmf still 
felt the need to bring unicode up.


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


Re: Performance of int/long in Python 3

2013-04-02 Thread jmfauth
On 2 avr, 16:03, Steven D'Aprano  wrote:
> On Tue, 02 Apr 2013 11:58:11 +0100, Steve Simmons wrote:
>
> I'm sure you didn't intend to be insulting, but some of us *have* taken
> JMF seriously, at least at first. His repeated overblown claims of how
> Python is destroying Unicode ...


Sorrry I never claimed this, I'm just seeing on how Python is becoming
less Unicode friendly.

>
> This feature is a *memory optimization*, not a speed optimization,

I totaly agree, and utf-8 is doing that with a great art. (see Neil
Hodgson
comment).
(Do not interpret this as if i'm saying "Python should use utf-8, as
I'have read).

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


Reseller Host with Python 3 support

2013-04-02 Thread Νίκος Γκρ33κ
I'am looking for this:

Reseller Plan with 200$ per year

α) 20 GB ftp quota
b) 200 GB traffic
c) cPanel
d) Python 3
e) Python MySQLdb module
f) ssh support


Please make the best offer possible.
Thank you.
-- 
http://mail.python.org/mailman/listinfo/python-list


Help

2013-04-02 Thread khaosyt
If I wanted to get the sum of some numbers (for example: 1 + 2 + 3 + 4 + 5 = 
15) from the attached program what do I do? Keep in mind that the print 
statement prints the integers individually. 

integer = 0 
denom = 10 
again = "y" #sentinel: 
while again == "y" or again == "Y": 
integer = input("Enter a positive integer: ") 
while denom <= integer: 
denom = denom*10 
while denom > 1: 
denom = denom/10 
number = integer/denom 
integer = integer%denom 
print str(number) 
again = raw_input("Again? (Y/N): ") 
-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter

2013-04-02 Thread Renato Barbosa Pim Pereira
I need to create a button and a text box follows the text box to enter a
number, and this number is expected to create the same screen text boxes, and
these text boxes need to be referenced, ie if I enter 30 in the first text
box and click the button to be created 30 text boxes so that I can then "
call" each of the boxes, eg box1, box2, box3, etc. .. .

This all-in Tkinter.

I thank you all for understanding and help.
-- 
http://mail.python.org/mailman/listinfo/python-list


Help

2013-04-02 Thread khaosyt
If I wanted to get the sum of some numbers (for example: 1 + 2 + 3 + 4 + 5 = 
15) from the attached program what do I do? Keep in mind that the print 
statement prints the integers individually.

integer = 0
denom = 10
again = "y" #sentinel:
while again == "y" or again == "Y":
integer = input("Enter a positive integer: ")
while denom <= integer:
denom = denom*10
while denom > 1:
denom = denom/10
number = integer/denom
integer = integer%denom
print str(number)
again = raw_input("Again? (Y/N): ")
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Performance of int/long in Python 3

2013-04-02 Thread Steve Simmons


On 02/04/2013 15:12, Mark Lawrence wrote:
I've already raised an issue about performance and Neil Hodgson has 
raised a new one. 

Recognised in a separate post
To balance this out perhaps we should have counter issues asking for 
the amount of memory being used to be increased to old levels and the 
earlier buggier behaviour of Python to be reintroduced? Swings and 
roundabouts?
I don't think I came anywhere near suggesting that we should regress 
correct functionality or memory usage improvements.  I just don't 
believe that we can't have good performance alongside it.


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


Re: Reseller Hosting Plan with Python 3 support

2013-04-02 Thread Νίκος Γκρ33κ
it's me Nikos i just posted under the wrong gmail account againsorry for 
that.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Performance of int/long in Python 3

2013-04-02 Thread Mark Lawrence

On 02/04/2013 15:39, Steve Simmons wrote:


My post was primarily aimed at recognising the work that people like
Mark, Neil and others have done to move the problem forward and was
intended to help shift the focus to a more productive approach. Again,
my apologies if it was ill timed or ill-directed.

Steve Simmons



I must point out that I only raised issue 16061 based on data provided 
by Steven D'Aprano and Serhiy Storchaka.


--
If you're using GoogleCrap™ please read this 
http://wiki.python.org/moin/GoogleGroupsPython.


Mark Lawrence

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


Reseller Hosting Plan with Python 3 support

2013-04-02 Thread nagia . retsina
I'am looking for this:

Reseller Plan with 200$ per year

α) 20 GB ftp quota
b) 200 GB traffic
c) cPanel
d) Python 3
e) Python MySQLdb module
f) ssh support


Please make the best offer possible.
Thank you.
-- 
http://mail.python.org/mailman/listinfo/python-list


Help: pickle module unable to load "rb" mode files in linux

2013-04-02 Thread Surya Kasturi
Hi, hope you can help me on it..

with open(pickle_f, 'r') as fhand:
obj = pickle.load(fhand)


This works on linux but not in windows until  I use "rb" mode while
creating file object. Surprisingly, the "rb" mode is not working on Linux..
raising EOFError.

Why is this happening?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Performance of int/long in Python 3

2013-04-02 Thread Steve Simmons


On 02/04/2013 15:03, Steven D'Aprano wrote:

On Tue, 02 Apr 2013 11:58:11 +0100, Steve Simmons wrote:


It seems to me that jmf *might* be moving towards a vindicated position.
  There is some interest now in duplicating, understanding and
(hopefully!) extending his test results, which can only be a Good Thing
- whatever the outcome and wherever the facepalm might land.

Some interest "now"? Oh please.

http://mail.python.org/pipermail/python-list/2012-September/629810.html

Mark Lawrence even created a bug report to track this, also back in
September.

http://bugs.python.org/issue16061

I'm sure you didn't intend to be insulting, but some of us *have* taken
JMF seriously, at least at first. His repeated overblown claims of how
Python is destroying Unicode, his lack of acknowledgement that other
people have seen string handling *speed up* not slow down, and his
refusal to assist in diagnosing this performance regression except to
repeatedly quote the same artificial micro-benchmarks over and over again
have lost him whatever credibility he started with.

This feature is a *memory optimization*, not a speed optimization, and
yet as a side-effect of saving memory, it also saves time. Real-world
benchmarks of actual applications demonstrate this. One or two trivial
slowdowns of artificial micro-benchmarks simply are not important, even
if they are genuine. I believe they are genuine, but likely operating
system and hardware dependent.


First off, no insult intended and I haven't been part of this list long 
enough to be fully immersed in the history of this so I'm sure there are 
events of which I am unaware.


However, it seems to me that, for whatever reason, JMF has reached the 
end of his capacity (time, capability, patience, ...) to extend his 
benchmarks into a more credible test set - i.e. one that demonstrates an 
acceptably 'real life' profile with a marked drop in performance.  As a 
community we have choices.  We can brand him a Troll - and some of his 
behaviour may mandate that - or we can put some additional energy into 
drawing this 'disagreement' to a more amicable and constructive conclusion.


My post was primarily aimed at recognising the work that people like 
Mark, Neil and others have done to move the problem forward and was 
intended to help shift the focus to a more productive approach. Again, 
my apologies if it was ill timed or ill-directed.


Steve Simmons


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


Re: Performance of int/long in Python 3

2013-04-02 Thread Mark Lawrence

On 02/04/2013 11:58, Steve Simmons wrote:


On 02/04/2013 10:43, Mark Lawrence wrote:

On 02/04/2013 10:24, jmfauth wrote:

On 2 avr, 10:35, Steven D'Aprano  wrote:

On Tue, 02 Apr 2013 19:03:17 +1100, Chris Angelico wrote:

So what? Who cares if it takes 0.2 second to insert a character
instead of 0.1 second? That's still a hundred times faster than you
can type.


-

This not the problem. The interesting point is that they
are good and "less good" Unicode implementations.

jmf



The interesting point is that the Python 3.3 unicode implementation is
correct, that of most other languages is buggy. Or have I fallen
victim to the vicious propaganda of the various Pythonistas who
frequent this list?


Mark,

Thanks for asking this question.

It seems to me that jmf *might* be moving towards a vindicated
position.  There is some interest now in duplicating, understanding and
(hopefully!) extending his test results, which can only be a Good Thing
- whatever the outcome and wherever the facepalm might land.



The position that is already documented in PEP393, how so?


However, as you rightly point out, there is only value in following this
through if the functionality is (at least near) 100% correct. I am sure
there are some that will disagree but in most cases, functionality is
the primary requirement and poor performance can be managed initially
and fixed in due time.


I've already raised an issue about performance and Neil Hodgson has 
raised a new one.  To balance this out perhaps we should have counter 
issues asking for the amount of memory being used to be increased to old 
levels and the earlier buggier behaviour of Python to be reintroduced? 
Swings and roundabouts?




Steve



--
If you're using GoogleCrap™ please read this 
http://wiki.python.org/moin/GoogleGroupsPython.


Mark Lawrence

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


Re: Performance of int/long in Python 3

2013-04-02 Thread Steven D'Aprano
On Tue, 02 Apr 2013 11:58:11 +0100, Steve Simmons wrote:

> It seems to me that jmf *might* be moving towards a vindicated position.
>  There is some interest now in duplicating, understanding and
> (hopefully!) extending his test results, which can only be a Good Thing
> - whatever the outcome and wherever the facepalm might land.

Some interest "now"? Oh please.

http://mail.python.org/pipermail/python-list/2012-September/629810.html

Mark Lawrence even created a bug report to track this, also back in 
September.

http://bugs.python.org/issue16061

I'm sure you didn't intend to be insulting, but some of us *have* taken 
JMF seriously, at least at first. His repeated overblown claims of how 
Python is destroying Unicode, his lack of acknowledgement that other 
people have seen string handling *speed up* not slow down, and his 
refusal to assist in diagnosing this performance regression except to 
repeatedly quote the same artificial micro-benchmarks over and over again 
have lost him whatever credibility he started with.

This feature is a *memory optimization*, not a speed optimization, and 
yet as a side-effect of saving memory, it also saves time. Real-world 
benchmarks of actual applications demonstrate this. One or two trivial 
slowdowns of artificial micro-benchmarks simply are not important, even 
if they are genuine. I believe they are genuine, but likely operating 
system and hardware dependent.


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


OSError: [Errno 127] Value too large to be stored in data type

2013-04-02 Thread Chris Hulan
Running Python 2.3.2 on AIX 
getting "OSError: [Errno 127] Value too large to be stored in data type"
when executing:

os.listdir('/some/NFS/dir')

The error only happens on NFS mounted dirs
Anyone else seen this?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Installation on Mac OSX 10.6.8 doesn't create the folder: /System/Library/Frameworks/Python.framework/Versions/2.7/

2013-04-02 Thread Jason Swails
On Tue, Apr 2, 2013 at 6:22 AM, kramer65  wrote:

> Hello people,
>
>
> I installed python 2.7 on Mac OSX 10.6.8 with no problems  and it is
> working fine. When I try to install Kivy however (www.kivy.org), I get an
> error saying:
>

How did you install Python 2.7?  How did you install Kivy?  Note that Kivy
states 10.7 or 10.8 is required.

My suggestion is to use MacPorts to build Python 2.7 (or something similar,
like HomeBrew or Fink), then build Kivy from source, rather than using the
Mac installer.  The Mac installer for Kivy would be reasonable in expecting
Python 2.7 to be installed in the standard Frameworks directory since it
requires Python 2.7.

Another option is to grok the MacPorts Portfile for Python 2.7 to figure
out how they compile it using the Mac Framework and emulate that process
when you build Python 2.7 from source (but don't install to /opt/local).

If all else fails, upgrade to 10.7 ;).

Good luck,
Jason
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Performance of int/long in Python 3

2013-04-02 Thread rusi
On Apr 2, 3:58 pm, Steve Simmons  wrote:
> On 02/04/2013 10:43, Mark Lawrence wrote:
>
>
>
>
>
>
>
> > On 02/04/2013 10:24, jmfauth wrote:
> >> On 2 avr, 10:35, Steven D'Aprano  >> +comp.lang.pyt...@pearwood.info> wrote:
> >>> On Tue, 02 Apr 2013 19:03:17 +1100, Chris Angelico wrote:
>
> >>> So what? Who cares if it takes 0.2 second to insert a character
> >>> instead of 0.1 second? That's still a hundred times faster than you
> >>> can type.
>
> >> -
>
> >> This not the problem. The interesting point is that they
> >> are good and "less good" Unicode implementations.
>
> >> jmf
>
> > The interesting point is that the Python 3.3 unicode implementation is
> > correct, that of most other languages is buggy. Or have I fallen
> > victim to the vicious propaganda of the various Pythonistas who
> > frequent this list?
>
> Mark,
>
> Thanks for asking this question.
>
> It seems to me that jmf *might* be moving towards a vindicated
> position.  There is some interest now in duplicating, understanding and
> (hopefully!) extending his test results, which can only be a Good Thing
> - whatever the outcome and wherever the facepalm might land.

Whew! Very reassuring to hear some sanity in this discussion at long
last!

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


Re: extending class static members and inheritance

2013-04-02 Thread Dave Angel

On 04/02/2013 09:27 AM, Fabian PyDEV wrote:

Hi All,

I have a question.

Let says I have the following two classes:

class Base(object):
__mylist__ = ["value1", "value2"]

def somemethod(self):
pass


class Derived(Base):
__mylist__ = ["value3", "value4"]

def anothermethod(self):
pass




what I would like to accomplish is that the class Derived has the member __mylist__ extended or merged as 
["value1", "value2", "value3", "value4"].

Is there anyway I could accomplish this?

I was thinking on accomplishing this as follows:


class Derived(Base):
__mylist__ = Base.__mylist__ + ["value3", "value4"]

def anothermethod(self):
pass


Is there a better way? Perhaps a decorator?



This is already done the best (clearest) way I know of.

However, I'd like to point out two things:
1) they're not called class members, but class attributes.  You have 
class attributes and instance attributes.


2) dunder methods should only be used to fulfill special methods defined 
by the language.  If it's a public attribute, just leave off the 
underscores entirely. And if it's private, put just one leading underscore.




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


extending class static members and inheritance

2013-04-02 Thread Fabian PyDEV
Hi All,

I have a question.

Let says I have the following two classes:

class Base(object):
__mylist__ = ["value1", "value2"]

def somemethod(self):
pass


class Derived(Base):
__mylist__ = ["value3", "value4"]

def anothermethod(self):
pass




what I would like to accomplish is that the class Derived has the member 
__mylist__ extended or merged as ["value1", "value2", "value3", "value4"].

Is there anyway I could accomplish this?

I was thinking on accomplishing this as follows:


class Derived(Base):
__mylist__ = Base.__mylist__ + ["value3", "value4"]

def anothermethod(self):
pass


Is there a better way? Perhaps a decorator?


Thanks in advance and regards,
Fabian

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


Re: Why does 1**2**3**4**5 raise a MemoryError?

2013-04-02 Thread Dan Sommers
On Mon, 01 Apr 2013 21:45:30 -0700, Tim Roberts wrote:

> morphex  wrote:
>>
>>While we're on the subject, wouldn't it be nice to have some cap there
>>so that it isn't possible to more or less block the system with large
>>exponentiation?
> 
> There IS a cap.  It's called the "MemoryError" exception.
> 
> But, seriously, what would you have it do instead?

One day late:

http://developers.slashdot.org/story/13/04/01/2230220/erlang-getting-too-
big-to-fail-process-flag
-- 
http://mail.python.org/mailman/listinfo/python-list


Fwd: Python subdomains https

2013-04-02 Thread Jakub Muszynski
Hi,

I need to add python.org https to my company firewall policy, but I'm not
allowed to add rule for https://*.python.org subdomains.

Can You give me/publish list of important subdomains (like
https://pypi.python.org) so I won't miss important sites?



Greetings

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


Re: Performance of int/long in Python 3

2013-04-02 Thread Steve Simmons


On 02/04/2013 10:43, Mark Lawrence wrote:

On 02/04/2013 10:24, jmfauth wrote:

On 2 avr, 10:35, Steven D'Aprano  wrote:

On Tue, 02 Apr 2013 19:03:17 +1100, Chris Angelico wrote:

So what? Who cares if it takes 0.2 second to insert a character
instead of 0.1 second? That's still a hundred times faster than you
can type.


-

This not the problem. The interesting point is that they
are good and "less good" Unicode implementations.

jmf



The interesting point is that the Python 3.3 unicode implementation is 
correct, that of most other languages is buggy. Or have I fallen 
victim to the vicious propaganda of the various Pythonistas who 
frequent this list?



Mark,

Thanks for asking this question.

It seems to me that jmf *might* be moving towards a vindicated 
position.  There is some interest now in duplicating, understanding and 
(hopefully!) extending his test results, which can only be a Good Thing 
- whatever the outcome and wherever the facepalm might land.


However, as you rightly point out, there is only value in following this 
through if the functionality is (at least near) 100% correct. I am sure 
there are some that will disagree but in most cases, functionality is 
the primary requirement and poor performance can be managed initially 
and fixed in due time.


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


Installation on Mac OSX 10.6.8 doesn't create the folder: /System/Library/Frameworks/Python.framework/Versions/2.7/

2013-04-02 Thread kramer65
Hello people,


I installed python 2.7 on Mac OSX 10.6.8 with no problems  and it is working 
fine. When I try to install Kivy however (www.kivy.org), I get an error saying:

/usr/local/bin/kivy: line 24: 
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7: No such 
file or directory
/usr/local/bin/kivy: line 24: exec: 
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7: cannot 
execute: No such file or directory

Upon inspection the there are folders named 2.3, 2.5 and 2.6 in the Versions 
folder, but indeed no folder named "2.7". When I log into the interactive 
python command line however, it clearly says I've got python 2.7.3 installed.

Does anybody know what the problem might be here?


Kind regards,
kramer
-- 
http://mail.python.org/mailman/listinfo/python-list


distutils without a compiler

2013-04-02 Thread Robin Becker
Is there a neat way to get distutils to report compiler absence? Most windows 
users don't have a compiler so building extensions usually doesn't work.


However, python's builtin batteries would allow pre-built pyds to be downloaded 
in lieu of an actual build.


Has anyone created a fallback download compiler or similar?
--
Robin Becker

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


Re: Performance of int/long in Python 3

2013-04-02 Thread Mark Lawrence

On 02/04/2013 10:24, jmfauth wrote:

On 2 avr, 10:35, Steven D'Aprano  wrote:

On Tue, 02 Apr 2013 19:03:17 +1100, Chris Angelico wrote:

So what? Who cares if it takes 0.2 second to insert a character
instead of 0.1 second? That's still a hundred times faster than you
can type.


-

This not the problem. The interesting point is that they
are good and "less good" Unicode implementations.

jmf



The interesting point is that the Python 3.3 unicode implementation is 
correct, that of most other languages is buggy.  Or have I fallen victim 
to the vicious propaganda of the various Pythonistas who frequent this list?


--
If you're using GoogleCrap™ please read this 
http://wiki.python.org/moin/GoogleGroupsPython.


Mark Lawrence

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


Re: python mock Requests and the response

2013-04-02 Thread Jean-Michel Pichavant
- Original Message -
> I am a beginner to using mock in python and trying to use
> http://www.voidspace.org.uk/python/mock.
> 
> Please tell me the basic calls to get me working in below scenario. I
> am using python's Requests module
> (http://docs.python-requests.org/en/latest/) .
> 
> In my views.py, I have a function that makes variety of
> requests.get() calls with different response each time
> 
> def myview(request):
>   res1 = requests.get('aurl')
>   res2 = request.get('burl')
>   res3 = request.get('curl')
> 
> In my test class I want to do something like this but cannot figure
> out exact method calls
> 
> Step 1:
> 
> //Mock the requests module
> //when mockedRequests.get('aurl') is called then return 'a
> response'
> //when mockedRequests.get('burl') is called then return 'b
> response'
> //when mockedRequests.get('curl') is called then return 'C
> response'
> 
> Step 2:
> 
> Call my view
> 
> Step 3:
> 
> verify response contains 'a response', 'b response' , 'c response'
> 
> Please help me to complete Step 1.
> --
> http://mail.python.org/mailman/listinfo/python-list
> 

Hi,

Why are you passing the requests (with typo ?) module to the function ? anyway, 
the code could look like this:

!! untested code, I don't have the requests module installed !!

import requests
import mock

def myView():
res1 = requests.get('aurl')
res2 = requests.get('burl')
res3 = requests.get('curl')

@mock.patch('requests.get', mock.Mock(side_effect = lambda k:{'aurl': 'a 
response', 'burl' : 'b response'}.get(k, 'unhandled request %s'%k)))
def testMyView(mockedGet):
# you can further customize the mock object here
mockedGet.whatever()
myView()

testMyView()


side_effect is the mock way of returning multiple values.

Hope it helps,

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: Performance of int/long in Python 3

2013-04-02 Thread Neil Hodgson

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.391664674507438]


   That's a larger performance decrease than the 64-bit version.

   Reported the issue as
http://bugs.python.org/issue17615

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


Re: Performance of int/long in Python 3

2013-04-02 Thread jmfauth
On 2 avr, 10:03, Chris Angelico  wrote:
> On Tue, Apr 2, 2013 at 6:24 PM, jmfauth  wrote:
> > An editor may reflect very well the example a gave. You enter
> > thousand ascii chars, then - boum - as you enter a non ascii
> > char, your editor (assuming is uses a mechanism like the FSR),
> > has to internally reencode everything!
>
> That assumes that the editor stores the entire buffer as a single
> Python string. Frankly, I think this unlikely; the nature of
> insertions and deletions makes this impractical. (I've known editors
> that do function this way. They're utterly unusable on large files.)
>
> ChrisA



No, no, no, no, ... as we say in French (this is a kindly
form).

The length of a string may have its importance. This
bad behaviour may happen on every char. The most
complicated chars are the chars with diacritics and
ligatured [1, 2] chars, eg chars used in Arabic script [2].

It is somehow funny to see, the FSR "fails" precisely
on problems Unicode will solve/handle, eg normalization or
sorting [3].

No really a problem for those you are endorsing the good
work Unicode does [5].


[1] A point which was not, in my mind, very well understood
when I read the PEP393 discussion.

[2] Take a unicode "TeX" compliant engine and toy with
the decomposed form of these chars. A very good way, to
understand what can be really a char, when you wish to
process text "seriously".

[3] I only test and tested these "chars" blindly with the help
of the doc I have. Btw, when I test complicated "Arabic chars",
I noticed, Py33 "crashes", it does not really crash, it get stucked
in some king of infinite loop (or is it due to "timeit"?).

[4] Am I the only one who test this kind of stuff?

[5] Unicode is a fascinating construction.

jmf

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


Re: Performance of int/long in Python 3

2013-04-02 Thread jmfauth
On 2 avr, 10:35, Steven D'Aprano  wrote:
> On Tue, 02 Apr 2013 19:03:17 +1100, Chris Angelico wrote:
>
> So what? Who cares if it takes 0.2 second to insert a character
> instead of 0.1 second? That's still a hundred times faster than you
> can type.
>
-

This not the problem. The interesting point is that they
are good and "less good" Unicode implementations.

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


Re: Performance of int/long in Python 3

2013-04-02 Thread Steven D'Aprano
On Tue, 02 Apr 2013 19:03:17 +1100, Chris Angelico wrote:

> On Tue, Apr 2, 2013 at 6:24 PM, jmfauth  wrote:
>> An editor may reflect very well the example a gave. You enter thousand
>> ascii chars, then - boum - as you enter a non ascii char, your editor
>> (assuming is uses a mechanism like the FSR), has to internally reencode
>> everything!
> 
> That assumes that the editor stores the entire buffer as a single Python
> string. Frankly, I think this unlikely; the nature of insertions and
> deletions makes this impractical. (I've known editors that do function
> this way. They're utterly unusable on large files.)

Nevertheless, for *some* size of text block (a word? line? paragraph?) an 
implementation may need to re-encode the block as characters are inserted 
or deleted.

So what? Who cares if it takes 0.2 second to insert a character 
instead of 0.1 second? That's still a hundred times faster than you 
can type.


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


ANN: eGenix mxODBC Zope/Plone Database Adapter 2.1.1

2013-04-02 Thread eGenix Team: M.-A. Lemburg


ANNOUNCEMENT

  mxODBC Zope/Plone Database Adapter

Version 2.1.1

 for Zope and the Plone CMS

Available for Plone 4.0, 4.1 and 4.2,
Zope 2.12 and 2.13, on
Windows, Linux, Mac OS X, FreeBSD and other platforms

This announcement is also available on our web-site for online reading:
http://www.egenix.com/company/news/eGenix-mxODBC-Zope-DA-2.1.1-GA.html



INTRODUCTION

The eGenix mxODBC Zope DA allows you to easily connect your Zope or
Plone CMS installation to just about any database backend on the
market today, giving you the reliability of the commercially supported
eGenix product mxODBC and the flexibility of the ODBC standard as
middle-tier architecture.

The mxODBC Zope Database Adapter is highly portable, just like Zope
itself and provides a high performance interface to all your ODBC data
sources, using a single well-supported interface on Windows, Linux,
Mac OS X, FreeBSD and other platforms.

This makes it ideal for deployment in ZEO Clusters and Zope hosting
environments where stability and high performance are a top priority,
establishing an excellent basis and scalable solution for your Plone
CMS.

Product page:

http://www.egenix.com/products/zope/mxODBCZopeDA/



NEWS

We are pleased to announce the new version 2.1.1 of our mxODBC
Zope/Plone Database Adapter product.

Feature Enhancements


 * Added a new connection property "ODBC cursor type" which allows
   easily adjusting the ODBC cursor type to be used for mxODBC Zope DA
   connection objects.

   This new property allows enhancing the performance of the adapter
   significantly, when using it with MS SQL Server or IBM DB2 database
   backends. Please see below for details.

Driver Compatibility


 * MS SQL Server performance can now be much enhanced, and increased
   to levels beyond that of previous mxODBC Zope DA releases, by
   adjusting the connection ODBC cursor type to "Forward only
   cursors".

   The performance increase compared to mxODBC Zope DA 2.1.0 is
   enormous: from 2-3x faster executes/fetches for average queries, up
   to 300x faster for simple cases.

   In mxODBC Zope DA 2.2, we will switch to using "Forward only
   cursors" per default for all database backends.

 * IBM DB2 can benefit from the same performance enhancements using
   "Forward only cursors".

   The effect is a lot smaller, but still noticeable: up to 2x faster
   executes/fetches with forward-only cursors, compared to mxODBC Zope
   DA 2.1.0.

 * Added documentation to explain the different cursor types,
   compatibility with different database backends and effects on
   performance.

Fixes
-

 * Fixed the installation instructions to be more generic and easily
   adaptable to Plone and Zope installations on both Windows and Unix
   platforms.

For the full set of changes please check the change log:

http://www.egenix.com/products/zope/mxODBCZopeDA/changelog.html



FEATURES

Version 2.1.0 of our mxODBC Zope/Plone Database Adapter product
was released on 2012-09-18. Please see the full
announcement for highlights of the 2.1 release:

http://www.egenix.com/company/news/eGenix-mxODBC-Zope-DA-2.1.0-GA.html

For the full set of features mxODBC has to offer, please see:

http://www.egenix.com/products/zope/mxODBCZopeDA/#Features



UPGRADING

Users are encouraged to upgrade to this latest mxODBC Zope/Plone DA
release to benefit from the new features and updated ODBC driver
support.

We have taken special care not to introduce backwards incompatible
changes, making the upgrade experience as smooth as possible.

As always, patch level upgrades (e.g. from 2.1.0 to 2.1.1) are free of
charge. The licenses you have purchased for 2.1 will continue to work
with this new release.

For major and minor upgrade purchases, we will give out 20% discount
coupons going from mxODBC Zope DA 1.x to 2.1 and 50% coupons for
upgrades from mxODBC 2.x to 2.1. After upgrade, use of the original
license from which you upgraded is no longer permitted.

Please contact the eGenix.com Sales Team with your existing license
serials for details for an upgrade discount coupon.

If you want to try the new release before purchace, you can request
30-day evaluation licenses by visiting our web-site or writing to
sa...@egenix.com, stating your name (or the name of the company) and
the number of eval licenses that you need.

___

SUPPORT

Commercial support for this product is available from eGenix.c

Re: Performance of int/long in Python 3

2013-04-02 Thread Chris Angelico
On Tue, Apr 2, 2013 at 6:24 PM, jmfauth  wrote:
> An editor may reflect very well the example a gave. You enter
> thousand ascii chars, then - boum - as you enter a non ascii
> char, your editor (assuming is uses a mechanism like the FSR),
> has to internally reencode everything!

That assumes that the editor stores the entire buffer as a single
Python string. Frankly, I think this unlikely; the nature of
insertions and deletions makes this impractical. (I've known editors
that do function this way. They're utterly unusable on large files.)

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


Re: Why does 1**2**3**4**5 raise a MemoryError?

2013-04-02 Thread Nobody
On Mon, 01 Apr 2013 00:39:56 +, Alex wrote:

> Given that
> 
>   3
>  5
> 4
> 
> (i.e.: 4**5**3) is transitive,

I think you meant "associative", and exponentiation isn't associative,
i.e. (x**y)**z is not, in general, equal to x**(y**z). In fact, (x**y)**z
is equal to x**(y*z).

Conventional mathematical notation interprets the above example as
4**(5**3). (4**5)**3 would be written with 4**5 parenthesised. Python
follows that convention, as do most languages which have an infix
exponentiation operator.

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


Re: Performance of int/long in Python 3

2013-04-02 Thread jmfauth
On 2 avr, 01:43, Neil Hodgson  wrote:
> Mark Lawrence:
>
> > You've given many examples of the same type of micro benchmark, not many
> > examples of different types of benchmark.
>
>     Trying to work out what jmfauth is on about I found what appears to
> be a performance regression with '<' string comparisons on Windows
> 64-bit. Its around 30% slower on a 25 character string that differs in
> the last character and 70-100% on a 100 character string that differs at
> the end.
>
>     Can someone else please try this to see if its reproducible? Linux
> doesn't show this problem.
>
>  >c:\python32\python -u "charwidth.py"
> 3.2 (r32:88445, Feb 20 2011, 21:30:00) [MSC v.1500 64 bit (AMD64)]
> a=['C:/Users/Neil/Documents/b','C:/Users/Neil/Documents/z']176
> [0.7116295577956576, 0.7055591343157613, 0.7203483026429418]
>
> a=['C:/Users/Neil/Documents/λ','C:/Users/Neil/Documents/η']176
> [0.7664397841378787, 0.7199902325464409, 0.713719289812504]
>
> a=['C:/Users/Neil/Documents/b','C:/Users/Neil/Documents/η']176
> [0.7341851791817691, 0.6994205901833599, 0.7106807593741005]
>
> a=['C:/Users/Neil/Documents/𠀀','C:/Users/Neil/Documents/𠀁']180
> [0.7346812372666784, 0.699543377914, 0.7064768417728411]
>
>  >c:\python33\python -u "charwidth.py"
> 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:57:17) [MSC v.1600 64 bit
> (AMD64)]
> a=['C:/Users/Neil/Documents/b','C:/Users/Neil/Documents/z']108
> [0.9913326076446045, 0.9455845241056282, 0.9459076605341776]
>
> a=['C:/Users/Neil/Documents/λ','C:/Users/Neil/Documents/η']192
> [1.0472289217234318, 1.0362342484091207, 1.0197109728048384]
>
> a=['C:/Users/Neil/Documents/b','C:/Users/Neil/Documents/η']192
> [1.0439643704533834, 0.9878581050301687, 0.9949265834034335]
>
> a=['C:/Users/Neil/Documents/𠀀','C:/Users/Neil/Documents/𠀁']312
> [1.0987483965446412, 1.0130257167690004, 1.024832248526499]
>
>     Here is the code:
>
> # encoding:utf-8
> import os, sys, timeit
> print(sys.version)
> examples = [
> "a=['$b','$z']",
> "a=['$λ','$η']",
> "a=['$b','$η']",
> "a=['$\U0002','$\U00020001']"]
> baseDir = "C:/Users/Neil/Documents/"
> #~ baseDir = "C:/Users/Neil/Documents/Visual Studio
> 2012/Projects/Sigma/QtReimplementation/HLFKBase/Win32/x64/Debug"
> for t in examples:
>      t = t.replace("$", baseDir)
>      # Using os.write as simple way get UTF-8 to stdout
>      os.write(sys.stdout.fileno(), t.encode("utf-8"))
>      print(sys.getsizeof(t))
>      print(timeit.repeat("a[0] < a[1]",t,number=500))
>      print()
>
>     For a more significant performance difference try replacing the
> baseDir setting with (may be wrapped):
> baseDir = "C:/Users/Neil/Documents/Visual Studio
> 2012/Projects/Sigma/QtReimplementation/HLFKBase/Win32/x64/Debug"
>
>     Neil



Hi,

>c:\python32\pythonw -u "charwidth.py"
3.2.3 (default, Apr 11 2012, 07:15:24) [MSC v.1500 32 bit (Intel)]
a=['D:\jm\jmpy\py3app\stringbenchb','D:\jm\jmpy\py3app
\stringbenchz']168
[0.8343414906182101, 0.8336184057396241, 0.8330473419738562]

a=['D:\jm\jmpy\py3app\stringbenchλ','D:\jm\jmpy\py3app
\stringbenchη']168
[0.818378092261062, 0.8180854713107406, 0.8192279926793571]

a=['D:\jm\jmpy\py3app\stringbenchb','D:\jm\jmpy\py3app
\stringbenchη']168
[0.8131353330542339, 0.8126985677326912, 0.8122744051977042]

a=['D:\jm\jmpy\py3app\stringbenchð €€','D:\jm\jmpy\py3app
\stringbench𠀁']172
[0.8271094603211102, 0.82704053883214, 0.8265781741004083]

>Exit code: 0
>c:\Python33\pythonw -u "charwidth.py"
3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit
(Intel)]
a=['D:\jm\jmpy\py3app\stringbenchb','D:\jm\jmpy\py3app
\stringbenchz']94
[1.3840254166697845, 1.3933888932429768, 1.391664674507438]

a=['D:\jm\jmpy\py3app\stringbenchλ','D:\jm\jmpy\py3app
\stringbenchη']176
[1.6217970707185678, 1.6279369907932706, 1.6207041728220117]

a=['D:\jm\jmpy\py3app\stringbenchb','D:\jm\jmpy\py3app
\stringbenchη']176
[1.5150522562729396, 1.5130369919353992, 1.5121890607025037]

a=['D:\jm\jmpy\py3app\stringbenchð €€','D:\jm\jmpy\py3app
\stringbench𠀁']316
[1.6135375194801664, 1.6117739170366434, 1.6134331526540109]

>Exit code: 0

- win7 32-bits
- The file is in utf-8
- Do not be afraid by this output, it is just a copy/paste for your
excellent editor, the coding output pane is configured to use the
locale
coding.
- Of course and as expected, similar behaviour from a console. (Which
btw
show, how good is you application).

==

Something different.

From a previous msg, on this thread.

---

> Sure. And over a different set of samples, it is less compact. If you
> write a lot of Latin-1, Python will use one byte per character, while
> UTF-8 will use two bytes per character.

I think you mean writing a lot of Latin-1 characters outside
ASCII.
However, even people writing texts in, say, French will find that only
a
small proportion of their text is outside ASCII and so the cost of
UTF-8
is correspondingly small.

The counter-problem is that a French document that needs to
include
one math