PyCon Argentina 2012 - Community Voting Process has begun Registration is Open!

2012-07-21 Thread Mariano Reingart
PyCon Argentina 2012 - Community Voting Process has begun 
Registration is Open!
===

We're glad to announce that Community Voting Process has started for
PyCon Argentina 2012.
You can select your preferences among more than 82 talks proposed and
11 tutorials/workshops.
This year, we're opening the Scientific and Extreme tracks, with more
than 12 proposals each!

Please help us voting your prefered talks for the conference following
the next link (registration required):

http://ar.pycon.org/2012/activity/vote

Admittance is free of charge (gratis), to register, please complete
the following form:

http://ar.pycon.org/2012/user/register

PyCon Argentina 2012 Keynotes
---

This year, the pre-confirmed keynote presenters are:

 * Massimo Di Pierro (US) - De Paul University: web2py / FermiQCD
 * Andrea Gavana (DK) - Maersk Oil: wx.lib.agw  2D/3D visualization
 * Brett Cannon (CA) - Google: python core developer: importlib py3k pypy
 * Christophe Pettus (US) - PostgreSQL Experts: Django  ORMs
 * Thiago Avelino (BR) - Mochii: MongoDB - London
 * Craig Kerstiens (US) - Heroku: Tools, django, Postgres

We also have talks submitted from speakers around the world (Chile,
Peru, Brasil, Spain, US), with many attendees already registered from
nearby countries (including Venezuela, Uruguay, Paraguay, Colombia,
Ecuador, Mexico).

For more information please see our main webpage:

http://ar.pycon.org/2012?lang=en

PgDay Argentina 2012 - in parallel!
--

This year, the the Argentina's PostgreSQL mini-conference will be held
in parallel to PyConAR sprints for first time, trying to share
resources and bring the communities together.

http://www.pgday.com.ar

PyCon Argentina 2012 Sponsors


We wish to thank the following Sponsors that made PyCon Argentina possible:

* Diamond: MSA Group: http://www.msa.com.ar/
* Diamond: Machinalis: http://www.machinalis.com/
* Gold: Urban Station: http://argentina.enjoyurbanstation.com/
* Silver: Fierro, Onapsis, Core Security, Grupo 42, Datatec
* Bronze: Thymbira, Liricus, WingWare

Our special thanks goes to the Python Software Fundation, the
PostgreSQL community, Google Inc., Maersk Oil, 10gen, Heroku, Packt
and Python Brazil, who make possible to bring the renowned speakers to
the conference and provides several other facilities.

Call for sponsors is still open, for more information see:

http://ar.pycon.org/2012/sponsors/prospectus?lang=en

PyCon Argentina 2012 Important Dates:
-

* 20-Jul-2012 to 27-Jul-2012: Community Voting
* 1-Ago-2012: Notification of talk/tutorial acceptance
* 12-Ago-2012: Schedule Publication
* 12-Sep-2012: Deadline for Call for Posters and Workshops
* 12-Oct-2012: Deadline for Call for Sponsors, Stands, etc.

PyCon Argentina 2012 Main Events:


* November 12th - 14th, 2012: Sprints and Workshops!
* November 15th, 2012: Tutorials
* November 16th - 17th, 2012: Main Conference talks

November 18th will be a tourist day with social activities.

About PyCon Argentina 2012:
==

PyCon Argentina is the largest annual worldwide community gathering of
Spanish-speaking users and developers of the Python programming
language.
It is a community conference organized by volunteers of Python
Argentina community (PyAr), lasting several days which will bring
short courses and lectures related to this language that incipiently
makes its place among the developers.
We intended to make a space where anyone interested can come to ask,
learn and experiment with these tools.
This year, the event will be held at Buenos Aires, Argentina's capital
and one of the most important cities in Latin America.

Best regards,


Mariano Reingart
PyCon Argentina 2012 Chair
http://ar.pycon.org/2012
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


Basic question about speed/coding style/memory

2012-07-21 Thread Jan Riechers

Hello Pythonlist,

I have one very basic question about speed,memory friendly coding, and 
coding style of the following easy if-statement in Python 2.7, but Im 
sure its also the same in Python 3.x


Block
#--
if statemente_true:
doSomething()
else:
doSomethingElseInstead()

#--

versus this block:
#--
if statement_true:
doSomething()
return

doSomethingElseInstead()

#--


I understand the first pattern that I tell the interpreter to do:
Check if the conditional is true, run doSomething() else go inside the 
else block and doSomethingElseInstead().


while the 2nd does only checks:
doSomething() if statement_true, if not, just go directly to 
doSomethingElseInstead()



Now, very briefly, what is the better way to proceed in terms of 
execution speed, readability, coding style?
Letting out the fact that, in order to prevent 
doSomethingElseInstead-Block to execute, a return has to provided.


Thank you for reading and hope someone brings light into that.

Your fellow python programmer
Jan
--
http://mail.python.org/mailman/listinfo/python-list


Re: Basic question about speed/coding style/memory

2012-07-21 Thread Andrew Berg
On 7/21/2012 2:33 AM, Jan Riechers wrote:
 Block
 ...
 versus this block:
 ...
 Now, very briefly, what is the better way to proceed in terms of 
 execution speed, readability, coding style?
Using if/else is the most readable in the general sense. Using return
(or break or continue as applicable) in this manner would indicate (at
least to me) that it's an exceptional or otherwise special case and that
the function can't do what it's supposed to. In that case, I would try
to catch an exception rather than use if/else whenever possible. I
highly doubt there is a significant performance difference between them.
-- 
CPython 3.3.0b1 | Windows NT 6.1.7601.17803
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: dbf.py 0.94

2012-07-21 Thread Ethan Furman

Steven D'Aprano wrote:
This mailing list is about helping our fellow Python developers improve 
their skills and solve problems. That doesn't just mean *coding* 
problems, it also means helping them to write better documentation and 
promote their software better.


Indeed it is, and your reminder is appreciated.  Hopefully my 
followup-post was more explanatory.



Unless the software is so well-known that everybody knows what it is, 
failure to mention what the software does gives the impression that: 

1) the software is so niche, or so ill-thought out, that the developer 
*can't* describe it succinctly;


Nah -- just the end of a long week, needed to go get my daughter, and 
wanted it out there for those few who actually need the bug fixes (which 
I neglected to mention).


2) the developer has such poor communication skills that trying to get 
support will be a nightmare;


My support is pretty good.  :)



3) that he just doesn't give a monkey's toss for anyone else's time


See point one.


or all three. Ethan is a good, helpful member of this community, and
so I'm pretty sure that neither 2) nor 3) are true, but others may get
the wrong impression.


Thank you.  The project is kinda niche, but very useful if you happen to 
be in that niche.




Here are a few randomly selected examples of good release announcements:

http://mail.python.org/pipermail/python-announce-list/2012-June/009528.html

http://mail.python.org/pipermail/python-announce-list/2012-June/009509.html

http://mail.python.org/pipermail/python-announce-list/2012-June/009524.html


Those are good.  My announcement will be better next time.

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


Re: ANN: dbf.py 0.94

2012-07-21 Thread Ethan Furman

Simon Cropper wrote:


Question 1 - What version of VFP will dbf work with? Is VFP9 OK?


As long as you don't use auto-incrementing fields nor varchar fields 
you'll be fine.




Question 2 - You statement of compatibility is unclear.


Works with CPython 2.4 - 2.7. (Tested)

Works with PyPy 1.8. (Tested)

Should work with the others.  (Not tested)


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


Re: Basic question about speed/coding style/memory

2012-07-21 Thread Jan Riechers

On 21.07.2012 11:02, Andrew Berg wrote:

On 7/21/2012 2:33 AM, Jan Riechers wrote:

Block
...
versus this block:
...
Now, very briefly, what is the better way to proceed in terms of
execution speed, readability, coding style?

Using if/else is the most readable in the general sense. Using return
(or break or continue as applicable) in this manner would indicate (at
least to me) that it's an exceptional or otherwise special case and that
the function can't do what it's supposed to. In that case, I would try
to catch an exception rather than use if/else whenever possible. I
highly doubt there is a significant performance difference between them.



Hello Andrew,

Your answer is right, in other circumstances I also would stick to 
try/except, break-statements in loops and so forth.

But the question was a bit more elementary.

Cause, as I understand the interpreter chooses either the else (1st 
block) or just proceeds with following code outside the if.


So if there is some overhead in some fashion in case we don't offer the 
else, assuming the interpreter has to exit the evaluation of the 
if-statement clause and return to a normal parsing code-state 
outside the if statement itself.


I hope this explanation makes more sense in what I want to ask ;)

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


Re: A thread import problem

2012-07-21 Thread Dieter Maurer
Bruce Sherwood bruce.sherw...@gmail.com writes:
 ...
 from visual import box, rate
 b = box()
 while True:
 rate(100) # no more than 100 iterations per second
 b.pos.x += .01

 This works because a GUI environment is invoked by the visual module
 in a secondary thread (written mainly in C++, connected to Python by
 Boost). The OpenGL rendering of the box in its current position is
 driven by a 30-millisecond timer. This works fine with any environment
 other than Mac Cocoa.

 However, the Mac Cocoa GUI environment and interact loop are required
 to be the primary thread, so the challenge is to have the visual
 module set up the Cocoa environment, with the user's program running
 in a secondary thread. Any ideas?

The usual approach to this situation is to invoke the user code via
a callback from the UI main loop or invoke it explicitely
after the UI system has been set up immediately before its main loop
is called. Might look somehow like this:

main thread:

from thread import start_new_thread
from visual import setup_gui, start_main_loop
setup_gui() # sets up the GUI subsystem
start_new_thread(lambda: __import__(your module), ())
start_main_loop()




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


Re: Basic question about speed/coding style/memory

2012-07-21 Thread Chris Angelico
On Sat, Jul 21, 2012 at 5:33 PM, Jan Riechers janpet...@freenet.de wrote:
 Block
 #--
 if statemente_true:
 doSomething()
 else:
 doSomethingElseInstead()

 #--

This means, to me, that the two options are peers - you do this or you do that.

 versus this block:
 #--
 if statement_true:
 doSomething()
 return

 doSomethingElseInstead()

 #--

This would be for an early abort. Don't bother doing most of this
function's work, just doSomething. Might be an error condition, or
perhaps an optimized path.

Definitely for error conditions, I would use the second option. The
fail and bail notation keeps the entire error handling in one place:

def func(x,y,z):
  if x0:
y+=5
return
  if y0:
raise PEBKAC(There's an idiot here somewhere)
  # ... do the rest of the work

Note the similarity between the control structures. Raising an
exception immediately terminates processing, without polluting the
rest of the function with an unnecessary indentation level. Early
aborting through normal function return can do the same thing.

But this is purely a matter of style. I don't think there's any
significance in terms of processing time or memory usage, and even if
there is, it would be dwarfed by considerations of readability. Make
your code look like what it's doing, and let the execution take care
of itself.

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


Re: Basic question about speed/coding style/memory

2012-07-21 Thread Andrew Berg
On 7/21/2012 3:13 AM, Jan Riechers wrote:
 Cause, as I understand the interpreter chooses either the else (1st 
 block) or just proceeds with following code outside the if.
If none of the if/elif statements evaluate to something true, the else
block is executed.

 So if there is some overhead in some fashion in case we don't offer the 
 else, assuming the interpreter has to exit the evaluation of the 
 if-statement clause and return to a normal parsing code-state 
 outside the if statement itself.
I really don't understand. You can look into the dis module if you want
to look at how CPython bytecode is executed and the timeit module to
measure speed. In any case, I don't see how there would be any
significant difference.

http://docs.python.org/py3k/library/dis.html
http://docs.python.org/py3k/library/timeit.html
-- 
CPython 3.3.0b1 | Windows NT 6.1.7601.17803
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: dbf.py 0.94

2012-07-21 Thread Chris Angelico
On Sat, Jul 21, 2012 at 6:02 PM, Ethan Furman et...@stoneleaf.us wrote:
 Works with CPython 2.4 - 2.7. (Tested)

Have you considered supporting 3.2/3.3 at all? It's often not
difficult to make your code compatible with both. Or is there some
dependency that is locked to 2.X?

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


Re: Basic question about speed/coding style/memory

2012-07-21 Thread Steven D'Aprano
On Sat, 21 Jul 2012 10:33:27 +0300, Jan Riechers wrote:

 Hello Pythonlist,
 
 I have one very basic question about speed,memory friendly coding, and
 coding style of the following easy if-statement in Python 2.7, but Im
 sure its also the same in Python 3.x

I assume that the following is meant to be inside a function, otherwise 
the return in the second example is illegal.

But in general, you're worrying too much about trivia. One way or the 
other, any speed difference will be trivial. Write whatever style reads 
and writes most naturally, and only worry about what's faster where it 
actually counts.

To give it an analogy that might be clear, this question is not too far 
from worrying about whether your car will be faster with the radio aerial 
up or down. Yes, technically the car will be slower with the aerial up, 
due to air resistance, but you'd have a job measuring it, and it makes no 
difference whether you are zooming down the highway at 120mph or stuck in 
traffic crawling along at 5mph.


Here's a minimal example:


def with_else(x):
if x:
a = x
else:
a = x+1
return a


def without_else(x):
if x:
a = x
return a
a = x+1
return a


Notice that I try to make each function do the same amount of work, so 
that we're seeing only the difference between else vs no else.

Now let's test the speed difference with Python 2.7. Because this is 
timing small code snippets, we should use the timeit module to time the 
code:

from timeit import Timer
setup = from __main__ import with_else, without_else
t1 = Timer(for i in (0, 1): result = with_else(i), setup)
t2 = Timer(for i in (0, 1): result = without_else(i), setup)

Each snippet calls the function twice, once to take the if branch, then 
to take the else branch.

Now we time how long it takes to run each code snippet 100 times. We 
do that six times each, and print the best (lowest) speed:

py min(t1.repeat(repeat=6))
0.9761919975280762
py min(t2.repeat(repeat=6))
0.9494419097900391

So there is approximately 0.03 second difference per TWO MILLION 
if...else blocks, or about 15 nanoseconds each. This is highly unlikely 
to be the bottleneck in your code. Assuming the difference is real, and 
not just measurement error, the difference is insignificant.

So, don't worry about which is faster. Write whichever is more natural, 
easier to read and write.


 Block
 #--
 if statemente_true:
   doSomething()
 else:
   doSomethingElseInstead()

This style is especially recommended when the two clauses are equal in 
importance.


 versus this block:
 #--
 if statement_true:
   doSomething()
   return
 doSomethingElseInstead()

This style is especially recommended when the doSomethingElseInstead() 
block is the normal procedure, and the doSomething() block is a special 
case. Not necessarily rare, but nevertheless special in some sense.

Of course, the decision as to which is the special case and which is 
the normal case is often entirely arbitrary.



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


Re: Basic question about speed/coding style/memory

2012-07-21 Thread Jan Riechers

On 21.07.2012 12:06, Steven D'Aprano wrote:


But in general, you're worrying too much about trivia. One way or the
other, any speed difference will be trivial. Write whatever style reads
and writes most naturally, and only worry about what's faster where it
actually counts.





Notice that I try to make each function do the same amount of work, so
that we're seeing only the difference between else vs no else.

Now let's test the speed difference with Python 2.7. Because this is
timing small code snippets, we should use the timeit module to time the
code:

from timeit import Timer
setup = from __main__ import with_else, without_else
t1 = Timer(for i in (0, 1): result = with_else(i), setup)
t2 = Timer(for i in (0, 1): result = without_else(i), setup)

Each snippet calls the function twice, once to take the if branch, then
to take the else branch.

Now we time how long it takes to run each code snippet 100 times. We
do that six times each, and print the best (lowest) speed:

py min(t1.repeat(repeat=6))
0.9761919975280762
py min(t2.repeat(repeat=6))
0.9494419097900391

So there is approximately 0.03 second difference per TWO MILLION
if...else blocks, or about 15 nanoseconds each. This is highly unlikely
to be the bottleneck in your code. Assuming the difference is real, and
not just measurement error, the difference is insignificant.

So, don't worry about which is faster. Write whichever is more natural,
easier to read and write.




Hello Steven,

very nice example and thank you very much for also for the Timeit test!
Actually it confirms my assumption in some way:

[SNIP myself]
So if there is some overhead in some fashion in case we don't offer the
else, assuming the interpreter has to exit the evaluation of the
if-statement clause and return to a normal parsing code-state
outside the if statement itself.
[SNAP]

Without having looked at Andrew's bytecode excecution hint, using the 
dis module, to see how the interpreter handles the task on lower level.


But fare enough for me :)

But I agree, the return in my example is misleading and it would be 
illegal outside of a function call. I just added it to make clear that 
the fellow code below the return should not be executed in comparison to 
the 2nd example.


Thank you very much
Jan
--
http://mail.python.org/mailman/listinfo/python-list


Re: PyPy, is it a 1:1 replacement for CPython?

2012-07-21 Thread Terry Reedy

On 7/20/2012 11:52 PM, Alec Taylor wrote:

ask on PyPy's list

But yes, it is designed as a 1:1 replacement of CPython


It is a replacement for some late 2.x versions but not, at present, for 
Python 3.



--
Terry Jan Reedy



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


Sudden doubling of nearly all messages

2012-07-21 Thread Dave Angel
Has anybody else noticed the sudden double-posting of nearly all
messages in the python mailing list?

Previously, I've seen some messages double posted, and it was nearly
always a newbie, presumably posting via some low-end gateway.  But now
i'm noticing nearly every message appears twice, identical datestamps,
and usually one message considered a reply to the other.

Deleting these locally is not only a pain, but if I get the wrong one,
it messes up the threading.

I'm using Thunderbird 14.0 on Linux 11.04, with mail configured for
non-digest mode.  I read the messages in threaded mode.

Probably related, I've had a serious spate of messages are obvious Re:
types, but not threaded to the original set.  I'm guessing because it's
because I earlier deleted one of a pair.

-- 

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


Re: Sudden doubling of nearly all messages

2012-07-21 Thread Andrew Berg
On 7/21/2012 5:48 AM, Dave Angel wrote:
 Has anybody else noticed the sudden double-posting of nearly all
 messages in the python mailing list?
I am also using the mailing list, but I haven't experienced this.
-- 
CPython 3.3.0b1 | Windows NT 6.1.7601.17803
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sudden doubling of nearly all messages

2012-07-21 Thread Mark Lawrence

On 21/07/2012 11:48, Dave Angel wrote:

Has anybody else noticed the sudden double-posting of nearly all
messages in the python mailing list?


No.



Previously, I've seen some messages double posted, and it was nearly
always a newbie, presumably posting via some low-end gateway.  But now
i'm noticing nearly every message appears twice, identical datestamps,
and usually one message considered a reply to the other.

Deleting these locally is not only a pain, but if I get the wrong one,
it messes up the threading.


I have noticed some problems with threading.



I'm using Thunderbird 14.0 on Linux 11.04, with mail configured for
non-digest mode.  I read the messages in threaded mode.


Windows Vista, rest the same.



Probably related, I've had a serious spate of messages are obvious Re:
types, but not threaded to the original set.  I'm guessing because it's
because I earlier deleted one of a pair.



Could well be.

Just sorry I can't be of more help. :(

--
Cheers.

Mark Lawrence.

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


Re: Sudden doubling of nearly all messages

2012-07-21 Thread Dave Angel
On 07/21/2012 07:05 AM, Andrew Berg wrote:
 On 7/21/2012 5:48 AM, Dave Angel wrote:
 Has anybody else noticed the sudden double-posting of nearly all
 messages in the python mailing list?
 I am also using the mailing list, but I haven't experienced this.
Well, my own message was doubled, but not your reply.

When I look at the message sources, they definitely are different.  The
one looks to me like an ordinary email. The other is much longer, but I
don't claim to know what all the fields mean.

One pair of fields that looks interesting is:

...X-Original-To: python-list@python.org
...Delivered-To: python-l...@mail.python.org

I sent to  python-list@python.org, and when I do a reply-all that's what
gets filled in.  But what about the other address?


The pervasive doubling just started in the last day or two;  I saw 50
new messages overnight, between about 10pm and 4am, EDT.   I haven't
changed any settings on purpose, and the only new software is whatever
the Linux update manager changes.

-- 

DaveA

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


Re: Sudden doubling of nearly all messages

2012-07-21 Thread Colin J. Williams

On 21/07/2012 6:48 AM, Dave Angel wrote:

Has anybody else noticed the sudden double-posting of nearly all
messages in the python mailing list?



No.

Colin W.

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


Calling Java jar class with parameter from Python

2012-07-21 Thread Jason Veldicott
Hi,

I have read a number of posts on how this can be done, but I have not been
able to replicate success with the particular command I'm wishing to
execute.

I am wanting to execute the following Java command from Python in Windows:

java -cp c:\antlr\antlr-3.4-complete.jar org.antlr.Tool
C:\Users\Jason\Documents\antlr\java grammar\Java.g


This command works outside of Python at the command prompt.

So I do the same using Python's os.system:

os.system(C:\\Program Files (x86)\\Java\\jdk1.7.0_05\\bin\\java.exe -cp
c:\\antlr\\antlr-3.4-complete.jar org.antlr.Tool
'C:\\Users\\Jason\\Documents\\antlr\\java grammar\\Java.g')


The return value is 1, which presumably indicates error.

Another variation using subprocess.call, one of many tried, gives the same
result:

subprocess.call([C:\\Program Files
(x86)\\Java\\jdk1.7.0_05\\bin\\java.exe, -cp
c:\\antlr\\antlr-3.4-complete.jar org.antlr.Tool,
C:\\Users\\Jason\\Documents\\antlr\\java grammar\\Java.g]  )

This variation using subprocess.Popen, gives a result, but it's ('', None).

subprocess.Popen([C:\\Program Files
(x86)\\Java\\jdk1.7.0_05\\bin\\java.exe, -cp
c:\\antlr\\antlr-3.4-complete.jar org.antlr.Tool,
C:\\Users\\Jason\\Documents\\antlr\\java grammar\\Java.g],
stdout=subprocess.PIPE, shell=True ).communicate()


Obviously, some trick is being missed.  Could anyone shed light on what it
may be?

Thanks

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


Re: Calling Java jar class with parameter from Python

2012-07-21 Thread Peter Otten
Jason Veldicott wrote:

 subprocess.Popen([C:\\Program Files
 (x86)\\Java\\jdk1.7.0_05\\bin\\java.exe, -cp
 c:\\antlr\\antlr-3.4-complete.jar org.antlr.Tool,
 C:\\Users\\Jason\\Documents\\antlr\\java grammar\\Java.g],
 stdout=subprocess.PIPE, shell=True ).communicate()
 
 
 Obviously, some trick is being missed.  Could anyone shed light on what it
 may be?

File names with spaces can be tricky. Try thoroughly separating the 
individual arguments and let subprocess do the necessary escaping. 
I think it should be

subprocess.Popen([
  C:\\Program Files (x86)\\Java\\jdk1.7.0_05\\bin\\java.exe,
  -cp,
  C:\\antlr\\antlr-3.4-complete.jar,
  org.antlr.Tool,
  C:\\Users\\Jason\\Documents\\antlr\\java grammar\\Java.g],
   stdout=subprocess.PIPE).communicate()


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


Re: Calling Java jar class with parameter from Python

2012-07-21 Thread Roy Smith
In article mailman.2380.1342873263.4697.python-l...@python.org,
 Peter Otten __pete...@web.de wrote:

 subprocess.Popen([
   C:\\Program Files (x86)\\Java\\jdk1.7.0_05\\bin\\java.exe,
   -cp,
   C:\\antlr\\antlr-3.4-complete.jar,
   org.antlr.Tool,
   C:\\Users\\Jason\\Documents\\antlr\\java grammar\\Java.g],
stdout=subprocess.PIPE).communicate()

You might also want to try raw strings.  This should be identical to 
Peter's version, but easier to read:

subprocess.Popen([
  rC:\Program Files (x86)\Java\jdk1.7.0_05\bin\java.exe,
  r-cp,
  rC:\antlr\antlr-3.4-complete.jar,
  rorg.antlr.Tool,
  rC:\Users\Jason\Documents\antlr\java grammar\Java.g],
   stdout=subprocess.PIPE).communicate()

although I would probably refactor it like:

args = [rC:\Program Files (x86)\Java\jdk1.7.0_05\bin\java.exe,
r-cp,
rC:\antlr\antlr-3.4-complete.jar,
rorg.antlr.Tool,
rC:\Users\Jason\Documents\antlr\java grammar\Java.g,
   ]
proc = subprocess.Popen(args, stdout=subprocess.PIPE)
proc.communicate()
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A thread import problem

2012-07-21 Thread Bruce Sherwood
Thanks much for this suggestion. I'm not sure I've correctly
understood the operation start_new_thread(lambda: __import__(your
module), ()). By your module do you mean the user program which
imported the module that will execute start_new_thread? It hadn't
occurred to me to have A import B and B import A, though now that you
describe this (if that's indeed what you mean) it makes sense. The
original instance of A won't get past its initial import statement
because the main loop won't return to it.

Bruce Sherwood

On Sat, Jul 21, 2012 at 2:32 AM, Dieter Maurer die...@handshake.de wrote:
 Bruce Sherwood bruce.sherw...@gmail.com writes:
 ...
 from visual import box, rate
 b = box()
 while True:
 rate(100) # no more than 100 iterations per second
 b.pos.x += .01

 This works because a GUI environment is invoked by the visual module
 in a secondary thread (written mainly in C++, connected to Python by
 Boost). The OpenGL rendering of the box in its current position is
 driven by a 30-millisecond timer. This works fine with any environment
 other than Mac Cocoa.

 However, the Mac Cocoa GUI environment and interact loop are required
 to be the primary thread, so the challenge is to have the visual
 module set up the Cocoa environment, with the user's program running
 in a secondary thread. Any ideas?

 The usual approach to this situation is to invoke the user code via
 a callback from the UI main loop or invoke it explicitely
 after the UI system has been set up immediately before its main loop
 is called. Might look somehow like this:

 main thread:

 from thread import start_new_thread
 from visual import setup_gui, start_main_loop
 setup_gui() # sets up the GUI subsystem
 start_new_thread(lambda: __import__(your module), ())
 start_main_loop()
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: can someone teach me this?

2012-07-21 Thread Devin Jeanpierre
On Fri, Jul 20, 2012 at 11:15 PM, hamilton hamil...@nothere.com wrote:
 You are an idiot, or a scammer.

Please be nice.

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


Re: Calling Java jar class with parameter from Python

2012-07-21 Thread jasonveldicott
On Saturday, July 21, 2012 5:20:48 AM UTC-7, Peter Otten wrote:
 Jason Veldicott wrote:
 
 gt; subprocess.Popen([quot;C:\\Program Files
 gt; (x86)\\Java\\jdk1.7.0_05\\bin\\java.exequot;, quot;-cp
 gt; c:\\antlr\\antlr-3.4-complete.jar org.antlr.Toolquot;,
 gt; quot;C:\\Users\\Jason\\Documents\\antlr\\java grammar\\Java.gquot;],
 gt; stdout=subprocess.PIPE, shell=True ).communicate()
 gt; 
 gt; 
 gt; Obviously, some trick is being missed.  Could anyone shed light on what 
 it
 gt; may be?
 
 File names with spaces can be tricky. Try thoroughly separating the 
 individual arguments and let subprocess do the necessary escaping. 
 I think it should be
 
 subprocess.Popen([
   quot;C:\\Program Files (x86)\\Java\\jdk1.7.0_05\\bin\\java.exequot;,
   quot;-cpquot;,
   quot;C:\\antlr\\antlr-3.4-complete.jarquot;,
   quot;org.antlr.Toolquot;,
   quot;C:\\Users\\Jason\\Documents\\antlr\\java grammar\\Java.gquot;],
stdout=subprocess.PIPE).communicate()

That did the trick, thanks.  

I had the impression from another post that the breaking up of command strings 
into subprocess arguments could be done arbitrarily as needed to deal with 
nested inverted commas.  Obviously as you've shown, this is not the case, at 
least for Popen.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A thread import problem

2012-07-21 Thread Bruce Sherwood
I couldn't get a simple test case to work. I append a listing of the
little test files, all in the same folder. The diagnostic statement
print('after start_new_thread\n') works, but then nothing. Originally
I tried importing testABA.py but was worried that the circular
importing (A imports B which imports A) would be a problem, hence the
test of importing a version of the test program without the import.

The failure of this test case suggests that one cannot do imports
inside secondary threads started in imported modules, something I keep
tripping over. But I hope you'll be able to tell me that I'm doing
something wrong!

Incidentally, a simple test is to execute the file ABA.py, in which
case everything works.

Bruce Sherwood

---
testABA.py -- execute this file

from ABA import *
print('exec testABA')
from math import sin
print(sin(3.14159/6))


testABA_noimport.py -- a version of testABA.py without the import of ABA

print('exec testABA_noimport')
from math import sin
print(sin(3.14159/6))

-
ABA.py

from thread import start_new_thread
from time import sleep
import sys

user = 'testABA_noimport'
start_new_thread(lambda: __import__(user), ())
print('after start_new_thread\n')

while True:
sleep(1)

On Sat, Jul 21, 2012 at 2:32 AM, Dieter Maurer die...@handshake.de wrote:
 The usual approach to this situation is to invoke the user code via
 a callback from the UI main loop or invoke it explicitely
 after the UI system has been set up immediately before its main loop
 is called. Might look somehow like this:

 main thread:

 from thread import start_new_thread
 from visual import setup_gui, start_main_loop
 setup_gui() # sets up the GUI subsystem
 start_new_thread(lambda: __import__(your module), ())
 start_main_loop()
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie question on python programming

2012-07-21 Thread Tom P

On 07/21/2012 02:30 AM, Ian Kelly wrote:

On Fri, Jul 20, 2012 at 5:38 PM, Chris Williams
purplewel...@googlemail.com wrote:

Hello

I hope this is the right newsgroup for this post.

I am just starting to learn python programming and it seems very
straightforward so far. It seems, however, geared toward doing the sort of
programming for terminal output.

Is it possible to write the sort of applications you can create in something
like c-sharp or visual c++, or should I be looking at some other programming
language? I am using ubuntu 12.04.


There are plenty of options for GUI programming in Python.  Among the
most popular are Tkinter, wxPython, PyGTK, and PyQT, all of which are
cross-platform and free.  Also, since you specifically mention the
.NET languages, IronPython runs on .NET and so is able to make full
use of the .NET APIs including Windows Forms and WPF.  A more
comprehensive list can be found at:

http://wiki.python.org/moin/GuiProgramming



Another platform independent approach is to write the program as a web 
server something like this-

def application(environ, start_response):
start_response(200 OK, [(Content-type, text/plain)])
return [Hello World!]

if __name__ == '__main__':
from wsgiref.simple_server import make_server
server = make_server('localhost', 8080, application)
server.serve_forever()

Run this and then use your browser to connect to localhost:8080
You can then use html features such as forms for input/output.

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


Re: A thread import problem

2012-07-21 Thread Dave Angel
On 07/21/2012 10:54 AM, Bruce Sherwood wrote:
 Thanks much for this suggestion. I'm not sure I've correctly
 understood the operation start_new_thread(lambda: __import__(your
 module), ()). By your module do you mean the user program which
 imported the module that will execute start_new_thread? It hadn't
 occurred to me to have A import B and B import A, though now that you
 describe this (if that's indeed what you mean) it makes sense. The
 original instance of A won't get past its initial import statement
 because the main loop won't return to it.

 Bruce Sherwood


Two of the things you mustn't do during an import:

1) start or end any threads
2) import something that's already in the chain of pending imports. 
(otherwise known as recursive imports, or import loop).  And there's a
special whammy reserved for those who import the script as though it
were a module.

Like any rule, there are possible exceptions.  But you're much better
off factoring your code better.

I haven't managed to understand your software description, so i'm not
making a specific suggestion.  But I know others have pointed out that
you should do as little as possible in top-level code of an imported
module.  Make the work happen in a function, and call that function from
the original script, not from inside some import.  An imported module's
top-level code should do nothing more complex than initialize module
constants.


-- 

DaveA


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


Re: Calling Java jar class with parameter from Python

2012-07-21 Thread jasonveldicott
On Saturday, July 21, 2012 6:57:48 AM UTC-7, Roy Smith wrote:
 In article lt;mailman.2380.1342873263.4697.python-l...@python.orggt;,
  Peter Otten lt;__pete...@web.degt; wrote:
 
 gt; subprocess.Popen([
 gt;   quot;C:\\Program Files (x86)\\Java\\jdk1.7.0_05\\bin\\java.exequot;,
 gt;   quot;-cpquot;,
 gt;   quot;C:\\antlr\\antlr-3.4-complete.jarquot;,
 gt;   quot;org.antlr.Toolquot;,
 gt;   quot;C:\\Users\\Jason\\Documents\\antlr\\java grammar\\Java.gquot;],
 gt;stdout=subprocess.PIPE).communicate()
 
 You might also want to try raw strings.  This should be identical to 
 Peter#39;s version, but easier to read:
 
 subprocess.Popen([
   rquot;C:\Program Files (x86)\Java\jdk1.7.0_05\bin\java.exequot;,
   rquot;-cpquot;,
   rquot;C:\antlr\antlr-3.4-complete.jarquot;,
   rquot;org.antlr.Toolquot;,
   rquot;C:\Users\Jason\Documents\antlr\java grammar\Java.gquot;],
stdout=subprocess.PIPE).communicate()
 
 although I would probably refactor it like:
 
 args = [rquot;C:\Program Files (x86)\Java\jdk1.7.0_05\bin\java.exequot;,
 rquot;-cpquot;,
 rquot;C:\antlr\antlr-3.4-complete.jarquot;,
 rquot;org.antlr.Toolquot;,
 rquot;C:\Users\Jason\Documents\antlr\java grammar\Java.gquot;,
]
 proc = subprocess.Popen(args, stdout=subprocess.PIPE)
 proc.communicate()

The r string notation at least saves having to double type a bunch of 
backslashes, although the appearance prepended to the string takes a little 
getting used to.

Visually the separate array to handle arguments is perhaps cleaner, having more 
resemblance to the original command.

Thanks for the tips.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: can someone teach me this?

2012-07-21 Thread hamilton

On 7/21/2012 9:06 AM, Devin Jeanpierre wrote:

On Fri, Jul 20, 2012 at 11:15 PM, hamilton hamil...@nothere.com wrote:

You are an idiot, or a scammer.


Please be nice.

-- Devin


Devin,

When someone asks me to download a compressed file, its just like the 
SCAM junk email I get all too often.


If the OP would learn how to post on usenet, I would have been happy to 
help out.


I apologize to the group, but the OP needs to learn how to post.

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


Re: Sudden doubling of nearly all messages

2012-07-21 Thread Dave Angel
On 07/21/2012 06:48 AM, Dave Angel wrote:
 Has anybody else noticed the sudden double-posting of nearly all
 messages in the python mailing list?

 Previously, I've seen some messages double posted, and it was nearly
 always a newbie, presumably posting via some low-end gateway.  But now
 i'm noticing nearly every message appears twice, identical datestamps,
 and usually one message considered a reply to the other.

 Deleting these locally is not only a pain, but if I get the wrong one,
 it messes up the threading.

 I'm using Thunderbird 14.0 on Linux 11.04, with mail configured for
 non-digest mode.  I read the messages in threaded mode.

 Probably related, I've had a serious spate of messages are obvious Re:
 types, but not threaded to the original set.  I'm guessing because it's
 because I earlier deleted one of a pair.


Well, since nobody else (so far) saw it, and I don't see it any more
(except for messages from a relatively few individuals), I'll drop it.

Sorry for the noise.

-- 

DaveA

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


Sudden doubling of nearly all messages

2012-07-21 Thread Sergi Pasoev

 I'm using Thunderbird 14.0 on Linux 11.04, with mail configured for
 non-digest mode.  I read the messages in threaded mode.

I wonder how many decades should pass for linux to reach its 11.04
version. OK, I know you mean Ubuntu. There is already a lot of wrong use
of names connected to Gnu, Linux, POSIX, etc. Don't make it worse,
please. 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sudden doubling of nearly all messages

2012-07-21 Thread Rick Johnson
On Saturday, July 21, 2012 5:48:29 AM UTC-5, Dave Angel wrote:
 Has anybody else noticed the sudden double-posting of nearly all
 messages in the python mailing list?
 
 Previously, I#39;ve seen some messages double posted, and it was nearly
 always a newbie, presumably posting via some low-end gateway.  But now
 i#39;m noticing nearly every message appears twice, identical datestamps,
 and usually one message considered a reply to the other.

It's due to the new Google Groups interface. They started forcing everyone to 
use the new buggy version about a week ago EVEN THOUGH the old interface is 
just fine. Another bug: If you look at the text i quoted you will see HTML 
character references. Usually i clean the text before posting but sometimes i 
forget.

Google is starting to SUCK!

You know, i really went out of my way to support Google for many years even 
though i knew they were spying on me. But since they were giving me 
interesting software for free, i did not mind so much. But now they have 
dropped great software and refuse to maintain the software they do have.

Their online docs were a great idea, but have you ever tried to use the docs 
interface for anything serious? S-U-C-K-S! 

Seriously, i can see Google going the way of yahoo soon. Heck, i even use Bing 
as my search engine now. I MUST be a disgruntled customer if i am using the 
search engine of the evil empire!

It was a nice run Google. We had good times and bad times. A few smiles and 
cries. 

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


Re: ANN: dbf.py 0.94

2012-07-21 Thread Ethan Furman

Chris Angelico wrote:

On Sat, Jul 21, 2012 at 6:02 PM, Ethan Furman et...@stoneleaf.us wrote:

Works with CPython 2.4 - 2.7. (Tested)


Have you considered supporting 3.2/3.3 at all? It's often not
difficult to make your code compatible with both. Or is there some
dependency that is locked to 2.X?


I'll support 3.3+, but not with the same code base:  I want to use all 
the cool features that 3.3 has!  :)


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


Re: Sudden doubling of nearly all messages

2012-07-21 Thread Chris Angelico
On Sun, Jul 22, 2012 at 4:16 AM, Rick Johnson
rantingrickjohn...@gmail.com wrote:
 It was a nice run Google. We had good times and bad times. A few smiles and 
 cries.

 LMBTFY

So, what... you reckon Microsoft is going to be the paragon of
righteousness against the squalor of Google's information-grubbing
tactics? Fascinating.

Oh, and make sure you get yourself a new email address Rick, can't
have you connected with *Google* mail now can we.

Use whichever service you like, but don't seriously expect anything
that you don't pay money for to be perfectly featured AND not spy on
you.

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


Re: ANN: dbf.py 0.94

2012-07-21 Thread Chris Angelico
On Sun, Jul 22, 2012 at 4:15 AM, Ethan Furman et...@stoneleaf.us wrote:
 I'll support 3.3+, but not with the same code base:  I want to use all the
 cool features that 3.3 has!  :)

The trouble with double-codebasing is that you have double
maintenance. But sure. So long as your time isn't under great
pressure, it can be quite effective.

Recommendation: Figure out a way to minimize double-handling of
things. One way might be to have source control manage it for you -
apply a patch to your 3.3+ source tree, then merge it into your 2.4+
tree and see if it applies cleanly. I dunno how successful that'd be,
but I really dread the idea of maintaining, unassisted, two identical
projects in two dialects of the same language. Recipe for burnout I'd
predict.

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


Re: ANN: dbf.py 0.94

2012-07-21 Thread Matej Cepl

On 21/07/12 05:26, Ethan Furman wrote:

dbf (also known as python dbase) is a module for reading/writing
dBase III, FP, VFP, and soon Clipper, .dbf database files. It's
an ancient format that still finds lots of use.


Other than the caring for the ancient legacy data, it is still widely 
used in GIS, because shapefiles (http://en.wikipedia.org/wiki/Shapefile) 
are based on it.


Matěj
--
http://mail.python.org/mailman/listinfo/python-list


My first ever Python program, comments welcome

2012-07-21 Thread Lipska the Kat

Greetings Pythoners

A short while back I posted a message that described a task I had set 
myself. I wanted to implement the following bash shell script in Python


Here's the script

sort -nr $1 | head -${2:-10}

this script takes a filename and an optional number of lines to display
and sorts the lines in numerical order, printing them to standard out.
if no optional number of lines are input the script prints 10 lines

Here's the file.

50  Parrots
12  Storage Jars
6   Lemon Currys
2   Pythons
14  Spam Fritters
23  Flying Circuses
1   Meaning Of Life
123 Holy Grails
76  Secret Policemans Balls
8   Something Completely Differents
12  Lives of Brian
49  Spatulas


... and here's my very first attempt at a Python program
I'd be interested to know what you think, you can't hurt my feelings
just be brutal (but fair). There is very little error checking as you 
can see and I'm sure you can crash the program easily.

'Better' implementations most welcome

#! /usr/bin/env python3.2

import fileinput
from sys import argv
from operator import itemgetter

l=[]
t = tuple
filename=argv[1]
lineCount=10

with fileinput.input(files=(filename)) as f:
for line in f:
t=(line.split('\t'))
t[0]=int(t[0])
l.append(t)
l=sorted(l, key=itemgetter(0))

try:
inCount = int(argv[2])
lineCount = inCount
except IndexError:
#just catch the error and continue  
None

for c in range(lineCount):
t=l[c]
print(t[0], t[1], sep='\t', end='')

Thanks

Lipska


--
Lipska the Kat: Troll hunter, Sandbox destroyer
and Farscape dreamer of Aeryn Sun.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Basic question about speed/coding style/memory

2012-07-21 Thread Thomas 'PointedEars' Lahn
Jan Riechers wrote:

 I have one very basic question about speed,memory friendly coding, and
 coding style of the following easy if-statement in Python 2.7, but Im
 sure its also the same in Python 3.x
 
 Block
 #--
 if statemente_true:
 doSomething()
 else:
 doSomethingElseInstead()
 
 #--
 
 versus this block:
 #--
 if statement_true:
 doSomething()
 return
 
 doSomethingElseInstead()
 
 #--
 
 
 I understand the first pattern that I tell the interpreter to do:

A common misconception.  As a writer of Python source code, (usually) you 
never tell the (CPython) interpreter anything (but to start working on the 
source code).  Python source code is automatically *compiled* into bytecode 
by the (CPython) interpreter, and that bytecode is executed by a virtual 
machine.¹  So at most, you are telling that virtual machine to do something, 
through the bytecode created from your source code.

 Check if the conditional is true, run doSomething() else go inside the
 else block and doSomethingElseInstead().
 
 while the 2nd does only checks:
 doSomething() if statement_true, if not, just go directly to
 doSomethingElseInstead()
 
 
 Now, very briefly, what is the better way to proceed in terms of
 execution speed, readability, coding style?

Since this is comp.lang.python, you just need to check against the Zen of 
Python to know what you should do ;-)

http://www.python.org/dev/peps/pep-0020/

For me, this boils down in this case to the common recommendation return 
early, return often as explicit is better than implicit and readability 
counts.  If there is nothing else than the `else' block in the function, 
there is no use for you to continue in the function, so you should return 
explicitly at this point.

On the other hand, if you can *avoid repeating code* in each branch by _not_ 
returning in the first branch, you should do that instead (practicality 
beats purity).

HTH

_
¹  This is not unlike in other so-called scripting languages; although for
   reasons that escape me, the software that compiles the source code – the
   compiler – is called the (C)Python *interpreter*, even in
   http://docs.python.org/faq/general.html.
-- 
PointedEars

Please do not Cc: me. / Bitte keine Kopien per E-Mail.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: My first ever Python program, comments welcome

2012-07-21 Thread Ian Foote

On 21/07/12 20:08, Lipska the Kat wrote:

Greetings Pythoners

A short while back I posted a message that described a task I had set 
myself. I wanted to implement the following bash shell script in Python


Here's the script

sort -nr $1 | head -${2:-10}

this script takes a filename and an optional number of lines to display
and sorts the lines in numerical order, printing them to standard out.
if no optional number of lines are input the script prints 10 lines

Here's the file.

50Parrots
12Storage Jars
6Lemon Currys
2Pythons
14Spam Fritters
23Flying Circuses
1Meaning Of Life
123Holy Grails
76Secret Policemans Balls
8Something Completely Differents
12Lives of Brian
49Spatulas


... and here's my very first attempt at a Python program
I'd be interested to know what you think, you can't hurt my feelings
just be brutal (but fair). There is very little error checking as you 
can see and I'm sure you can crash the program easily.

'Better' implementations most welcome

#! /usr/bin/env python3.2

import fileinput
from sys import argv
from operator import itemgetter

l=[]
t = tuple
What is this line supposed to do? If you're trying to make an empty 
tuple, you can write:

t = ()
But I don't think this is needed at all.

filename=argv[1]
lineCount=10

with fileinput.input(files=(filename)) as f:
for line in f:
t=(line.split('\t'))
t[0]=int(t[0])
l.append(t)
l=sorted(l, key=itemgetter(0))

try:
inCount = int(argv[2])
lineCount = inCount

I don't think you need to split this into two lines here.
try:
lineCount = int(argv[2])
should work.

except IndexError:
#just catch the error and continue
None
I would use pass instead of None here - I want to do nothing rather 
than create a None object.

for c in range(lineCount):
t=l[c]
print(t[0], t[1], sep='\t', end='')

Thanks

Lipska



My only other point is that you might find it helpful to use slightly 
more verbose names than l or t - its not immediately obvious to the 
reader what these are intended to represent.


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


Re: My first ever Python program, comments welcome

2012-07-21 Thread MRAB

On 21/07/2012 20:08, Lipska the Kat wrote:

Greetings Pythoners

A short while back I posted a message that described a task I had set
myself. I wanted to implement the following bash shell script in Python

Here's the script

sort -nr $1 | head -${2:-10}

this script takes a filename and an optional number of lines to display
and sorts the lines in numerical order, printing them to standard out.
if no optional number of lines are input the script prints 10 lines

Here's the file.

50  Parrots
12  Storage Jars
6   Lemon Currys
2   Pythons
14  Spam Fritters
23  Flying Circuses
1   Meaning Of Life
123 Holy Grails
76  Secret Policemans Balls
8   Something Completely Differents
12  Lives of Brian
49  Spatulas


... and here's my very first attempt at a Python program
I'd be interested to know what you think, you can't hurt my feelings
just be brutal (but fair). There is very little error checking as you
can see and I'm sure you can crash the program easily.
'Better' implementations most welcome

#! /usr/bin/env python3.2

import fileinput
from sys import argv
from operator import itemgetter

l=[]
t = tuple

What's the purpose of this line?


filename=argv[1]
lineCount=10

with fileinput.input(files=(filename)) as f:
for line in f:
t=(line.split('\t'))
t[0]=int(t[0])
l.append(t)
l=sorted(l, key=itemgetter(0))

Short is:

l.sort(key=itemgetter(0))



try:
inCount = int(argv[2])
lineCount = inCount

You may as well say:

lineCount = int(argv[2])


except IndexError:
#just catch the error and continue  
None

The do-nothing statement is:

pass



for c in range(lineCount):
t=l[c]

If there are fewer than 'lineCount' lines, this will raise IndexError.
You could do this instead:

for t in l[ : lineCount]:


print(t[0], t[1], sep='\t', end='')



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


Re: My first ever Python program, comments welcome

2012-07-21 Thread Dave Angel
On 07/21/2012 03:08 PM, Lipska the Kat wrote:
 Greetings Pythoners

 A short while back I posted a message that described a task I had set
 myself. I wanted to implement the following bash shell script in Python


You already have comments from Ian and MRAB, and I'll try to point out
only things that they did not.

Congratulations on getting your first program running.  And when reading
the following, remember that getting it right is more important than
getting it pretty.

 Here's the script

 sort -nr $1 | head -${2:-10}

 this script takes a filename and an optional number of lines to display
 and sorts the lines in numerical order, printing them to standard out.
 if no optional number of lines are input the script prints 10 lines

 Here's the file.

 50Parrots
 12Storage Jars
 6Lemon Currys
 2Pythons
 14Spam Fritters
 23Flying Circuses
 1Meaning Of Life
 123Holy Grails
 76Secret Policemans Balls
 8Something Completely Differents
 12Lives of Brian
 49Spatulas


 ... and here's my very first attempt at a Python program
 I'd be interested to know what you think, you can't hurt my feelings
 just be brutal (but fair). There is very little error checking as you
 can see and I'm sure you can crash the program easily.
 'Better' implementations most welcome

 #! /usr/bin/env python3.2

 import fileinput
 from sys import argv
 from operator import itemgetter

 l=[]

I prefer to initialize an empty collection just before the loop that's
going to fill it.  Then if you later decide to generalize some other
part of the code, it's less likely to break.  So i'd move this line to
right-before the for loop.

 t = tuple

Even if you were going to use this initialization later, it doesn't do
what you think it does.  It doesn't create a tuple, it just makes
another reference to the class.  If you had wanted an empty tuple, you
should either do  t=tuple(), or better  t=()

 filename=argv[1]
 lineCount=10


I'd suggest getting into the habit of doing all your argv parsing in one
place.  So check for argv[2] here, rather than inside the loop below. 
Eventually you're going to have code complex enough to use an argument
parsing library.  And of course, something to tell your use what the
arguments are supposed to be.

 with fileinput.input(files=(filename)) as f:

fileinput is much more general than you want for processing a single
file.  That may be deliberate, if you're picturing somebody using
wildcards on their input.  But if so, you should probably use a
different name, something that indicates plural.

 for line in f:
 t=(line.split('\t'))
 t[0]=int(t[0])
 l.append(t)


 l=sorted(l, key=itemgetter(0))


Your sample data has duplicate numbers.  So you really ought to decide
how you'd like such lines sorted in the output.  Your present code
simply preserves the present order of such lines.  But if you remove the
key parameter entirely, the default sort order will sort with t[0] as
primary key, and t[1] as tie-breaker.  That'd probably be what I'd do,
after trying to clarify with the client what the desired sort order was.

 try:   
 inCount = int(argv[2])
 lineCount = inCount
 except IndexError:
 #just catch the error and continue   
 None

 for c in range(lineCount):
 t=l[c]
 print(t[0], t[1], sep='\t', end='')

 Thanks

 Lipska



A totally off-the-wall query.  Are you using a source control system,
such as git ?  It can make you much braver about refactoring a working
program.

-- 

DaveA

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


Re: A thread import problem

2012-07-21 Thread Bruce Sherwood
Thanks much for this clear statement. I hadn't managed to find any
documentation on this specific issue.

Bruce Sherwood

On Sat, Jul 21, 2012 at 10:26 AM, Dave Angel d...@davea.name wrote:
 Two of the things you mustn't do during an import:

 1) start or end any threads
 2) import something that's already in the chain of pending imports.
 (otherwise known as recursive imports, or import loop).  And there's a
 special whammy reserved for those who import the script as though it
 were a module.

 Like any rule, there are possible exceptions.  But you're much better
 off factoring your code better.

 I haven't managed to understand your software description, so i'm not
 making a specific suggestion.  But I know others have pointed out that
 you should do as little as possible in top-level code of an imported
 module.  Make the work happen in a function, and call that function from
 the original script, not from inside some import.  An imported module's
 top-level code should do nothing more complex than initialize module
 constants.


 --

 DaveA


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


Re: A thread import problem

2012-07-21 Thread Dave Angel
On 07/21/2012 04:36 PM, Bruce Sherwood wrote:
 Thanks much for this clear statement. I hadn't managed to find any
 documentation on this specific issue.

 Bruce Sherwood

 On Sat, Jul 21, 2012 at 10:26 AM, Dave Angel d...@davea.name wrote:
 Two of the things you mustn't do during an import:

 1) start or end any threads
 2) import something that's already in the chain of pending imports.
 (otherwise known as recursive imports, or import loop).  And there's a
 special whammy reserved for those who import the script as though it
 were a module.

 Like any rule, there are possible exceptions.  But you're much better
 off factoring your code better.

 I haven't managed to understand your software description, so i'm not
 making a specific suggestion.  But I know others have pointed out that
 you should do as little as possible in top-level code of an imported
 module.  Make the work happen in a function, and call that function from
 the original script, not from inside some import.  An imported module's
 top-level code should do nothing more complex than initialize module
 constants.


 --

 DaveA



(You top-posted, which makes it harder to figure out who said what.)

For docs on the threading thing, see:

http://docs.python.org/library/threading.html

 ... an import should not have the side effect of spawning a new thread
and then waiting for that thread in any way...




-- 

DaveA

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


Re: ANN: dbf.py 0.94

2012-07-21 Thread Alex Strickland

Hi


Getting closer to a stable release.

Latest version has a simpler, cleaner API, and works on PyPy (and
hopefully the other implementations as well ;), as well as CPython.

Get your copy at http://python.org/pypi/dbf.

Bug reports, comments, and kudos welcome!  ;)


Not supported: index files:

I have been using http://sourceforge.net/projects/harbour-project/ for 
years where a guy called Przemyslaw Czerpak has written an absolutely 
bullet proof implementation of NTX and CDX for DBF. Maybe it will 
interest you.


PS : bareable is spelt bearable.

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


Re: Encapsulation, inheritance and polymorphism

2012-07-21 Thread Erik Max Francis

On 07/20/2012 02:05 AM, Virgil Stokes wrote:

On 20-Jul-2012 10:27, Steven D'Aprano wrote:

The fellow looked relived and said Oh thank god, I thought you said
*million*!


How does this relate to the python list?


It's also a seriously old joke.

--
Erik Max Francis  m...@alcyone.com  http://www.alcyone.com/max/
 San Jose, CA, USA  37 18 N 121 57 W  AIM/Y!M/Jabber erikmaxfrancis
  She's your moon, she's your sun / She could even be the one
   -- Nik Kershaw
--
http://mail.python.org/mailman/listinfo/python-list


Re: Encapsulation, inheritance and polymorphism

2012-07-21 Thread Erik Max Francis

On 07/20/2012 03:28 AM, BartC wrote:

Erik Max Francis m...@alcyone.com wrote in message
news:gskdnwoqpkoovztnnz2dnuvz5s2dn...@giganews.com...

On 07/20/2012 01:11 AM, Steven D'Aprano wrote:

On Thu, 19 Jul 2012 13:50:36 -0500, Tim Chase wrote:



I'm reminded of Graham's Number, which is so large that there aren't
enough molecules in the universe to write it out as a power tower
a^b^c^d^..., or even in a tower of hyperpowers a^^b^^c^^d^^... It was
the
provable upper bound to a question to which experts in the field thought
the most likely answer was ... six.

(The bounds have since been reduced: the lower bound is now 13, and the
upper bound is *much* smaller than Graham's Number but still
inconceivably ginormous.)


You don't even need to go that high. Even a run-of-the-mill googol
(10^100) is far larger than the total number of elementary particles in
the observable Universe.


But you can write it down, even as a straightforward number, without any
problem. Perhaps a googolplex (10^10^100 iirc) would be difficult to
write it down in full, but I have just represented it as an exponent
with little difficulty.

These bigger numbers can't be written down, because there will never be
enough material, even using multiple systems of exponents.


But that's true for precisely the same reason as what I said.  If you're 
going to write a number down in standard format (whatever the base), 
then the number of digits needed scales as the logarithm of the number 
(again, whatever the base).  log_10 10^100 is trivially 100, so a rough 
order of magnitude in that form is easy to write down.  But the log_10 
10^10^100 is 10^100 = a googol, which is already more than the number of 
elementary particles in the observable Universe.



(A few years ago the biggest number I'd heard of was Skewes' Number
(something like 10^10^10^34), but even that is trivial to write using
conventional exponents as I've just shown. Graham's Number is in a
different
class altogether.)


Anything's trivial to write down.  Just say the number such that ... 
and you've written it down.  Even numbers that aren't really numbers, 
such as transfinite cardinals!


--
Erik Max Francis  m...@alcyone.com  http://www.alcyone.com/max/
 San Jose, CA, USA  37 18 N 121 57 W  AIM/Y!M/Jabber erikmaxfrancis
  She's your moon, she's your sun / She could even be the one
   -- Nik Kershaw
--
http://mail.python.org/mailman/listinfo/python-list


Re: A thread import problem

2012-07-21 Thread Bruce Sherwood
On Sat, Jul 21, 2012 at 2:53 PM, Dave Angel d...@davea.name wrote:
 On 07/21/2012 04:36 PM, Bruce Sherwood wrote:
 Thanks much for this clear statement. I hadn't managed to find any
 documentation on this specific issue.

 Bruce Sherwood

 On Sat, Jul 21, 2012 at 10:26 AM, Dave Angel d...@davea.name wrote:
 Two of the things you mustn't do during an import:

 1) start or end any threads
 2) import something that's already in the chain of pending imports.
 (otherwise known as recursive imports, or import loop).  And there's a
 special whammy reserved for those who import the script as though it
 were a module.

 Like any rule, there are possible exceptions.  But you're much better
 off factoring your code better.

 I haven't managed to understand your software description, so i'm not
 making a specific suggestion.  But I know others have pointed out that
 you should do as little as possible in top-level code of an imported
 module.  Make the work happen in a function, and call that function from
 the original script, not from inside some import.  An imported module's
 top-level code should do nothing more complex than initialize module
 constants.


 --

 DaveA



 (You top-posted, which makes it harder to figure out who said what.)

 For docs on the threading thing, see:

 http://docs.python.org/library/threading.html

  ... an import should not have the side effect of spawning a new thread
 and then waiting for that thread in any way...




 --

 DaveA


Thanks. I had read that as forbidding waiting for that thread, not
forbidding spawning a new thread. The following sentence says,
Failing to abide by this restriction can lead to a deadlock if the
spawned thread directly or indirectly attempts to import a module. I
gather that a clearer, more forceful statement might be, Failing to
abide by this restriction WILL lead to a deadlock if the spawned
thread directly or indirectly attempts to import a module. All of
which implies the behavior I've seen in various experiments, namely
that as long as the spawned thread doesn't do any imports, I haven't
seen any problems with spawning a thread in an imported module. I take
your word for it that this is a no-no, but I don't know why.

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


Re: ANN: dbf.py 0.94

2012-07-21 Thread Mark Lawrence

On 21/07/2012 21:57, Alex Strickland wrote:

Hi


Getting closer to a stable release.

Latest version has a simpler, cleaner API, and works on PyPy (and
hopefully the other implementations as well ;), as well as CPython.

Get your copy at http://python.org/pypi/dbf.

Bug reports, comments, and kudos welcome!  ;)


Not supported: index files:

I have been using http://sourceforge.net/projects/harbour-project/ for
years where a guy called Przemyslaw Czerpak has written an absolutely
bullet proof implementation of NTX and CDX for DBF. Maybe it will
interest you.

PS : bareable is spelt bearable.



and PS is spelt p.s. :)

--
Cheers.

Mark Lawrence.

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


Re: A thread import problem

2012-07-21 Thread Dave Angel
On 07/21/2012 05:35 PM, Bruce Sherwood wrote:
 On Sat, Jul 21, 2012 at 2:53 PM, Dave Angel d...@davea.name wrote:
 SNIP
 For docs on the threading thing, see:

 http://docs.python.org/library/threading.html

  ... an import should not have the side effect of spawning a new thread
 and then waiting for that thread in any way...




 --

 DaveA

 Thanks. I had read that as forbidding waiting for that thread, not
 forbidding spawning a new thread. The following sentence says,
 Failing to abide by this restriction can lead to a deadlock if the
 spawned thread directly or indirectly attempts to import a module. I
 gather that a clearer, more forceful statement might be, Failing to
 abide by this restriction WILL lead to a deadlock if the spawned
 thread directly or indirectly attempts to import a module. All of
 which implies the behavior I've seen in various experiments, namely
 that as long as the spawned thread doesn't do any imports, I haven't
 seen any problems with spawning a thread in an imported module. I take
 your word for it that this is a no-no, but I don't know why.

 Bruce Sherwood

I don't know just what will work and what will not;   But there are lots
of subtle and indirect ways of waiting for that thread and I suspect
that import is one of them.

Since I've never seen a case where we had to break the general rule, it
just seems easier to keep it clean.  No threading inside an import.

Same with recursive imports.  I could list some of the specific problems
that crop up, but since the only time recursive imports are unavoidable
is when you're constrained by preexisting 3rd party software that does
something strange, it seems easier to make a simple rule that's easy
enough to test for.

if you try to import the script (that imported you) as though it were a
module, you end up with two copies of that module, and if they have any
non-constant globals, you can get very strange symptoms.  In other
recursion cases,

-- 

DaveA

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


Re: Sudden doubling of nearly all messages

2012-07-21 Thread Devin Jeanpierre
On Sat, Jul 21, 2012 at 2:25 PM, Chris Angelico ros...@gmail.com wrote:
 On Sun, Jul 22, 2012 at 4:16 AM, Rick Johnson
 rantingrickjohn...@gmail.com wrote:
 It was a nice run Google. We had good times and bad times. A few smiles and 
 cries.

 LMBTFY

 So, what... you reckon Microsoft is going to be the paragon of
 righteousness against the squalor of Google's information-grubbing
 tactics? Fascinating.

It's happened before. The example that made me really realize this was
when my university, the University of Toronto, was considering both
Microsoft and Google as mail providers for students last year. They
chose Microsoft, to a mass of student responses to the effect of but
Microsoft is Evil!. It turns out that they ended up choosing
Microsoft because they gave stronger privacy guarantees.

People hold grudges against MS too strongly, and they believe too much
in Google's righteousness. They are both big companies that don't
necessarily care about you.

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


Re: A thread import problem

2012-07-21 Thread Bruce Sherwood
On Sat, Jul 21, 2012 at 4:16 PM, Dennis Lee Bieber
wlfr...@ix.netcom.com wrote:
 On Sat, 21 Jul 2012 10:11:30 -0600, Bruce Sherwood
 bruce.sherw...@gmail.com declaimed the following in
 gmane.comp.python.general:



 ---
 testABA.py -- execute this file

 from ABA import *
 print('exec testABA')
 from math import sin
 print(sin(3.14159/6))

 
 testABA_noimport.py -- a version of testABA.py without the import of ABA

 print('exec testABA_noimport')
 from math import sin
 print(sin(3.14159/6))

 -
 ABA.py

 from thread import start_new_thread
 from time import sleep
 import sys

 user = 'testABA_noimport'
 start_new_thread(lambda: __import__(user), ())
 print('after start_new_thread\n')

 while True:
 sleep(1)


 And all along you are still coding where imported modules are doing
 work DURING THE IMPORT. Anything beyond initializing module level
 constants or importing modules needed by the module should be placed
 into a function which can be executed by the top-level importer AFTER
 the import has finished.

 -=-=-=-=- testABA.py
 print (testABA: top)

 from math import sin, pi
 import time

 print (testABA: defining worker function)
 def runner():   #this is the key -- a function IN the module
 #that does the real work
 print (testABA.runner: starting work\n)
 time.sleep(2.5)
 print (sin(pi))
 time.sleep(2.5)
 print (\ntestABA.runner: end of work)

 print (testABA: after set-up)

 if __name__ == __main__:
 print (testABA: was not an import, running main task)
 runner()#invoke the function if module is not imported
 print (testABA: end)
 -=-=-=-=-

 -=-=-=-=- ABA.py
 import threading

 USER = testABA

 print (ABA: importing  + USER)
 modl = __import__(USER)

 print (ABA: starting runner)
 th = threading.Thread(target=modl.runner)
 th.start()

 print (ABA: waiting for completion)
 th.join()

 print (ABA: done)
 -=-=-=-=-

 And showing the results...

 -=-=-=-=-
 E:\UserData\Wulfraed\My Documents\Python ProgstestABA
 testABA: top
 testABA: defining worker function
 testABA: after set-up
 testABA: was not an import, running main task
 testABA.runner: starting work

 1.22460635382e-016

 testABA.runner: end of work
 testABA: end

 E:\UserData\Wulfraed\My Documents\Python ProgsABA
 ABA: importing testABA
 testABA: top
 testABA: defining worker function
 testABA: after set-up
 ABA: starting runner
 testABA.runner: starting work

 ABA: waiting for completion
 1.22460635382e-016

 testABA.runner: end of work
 ABA: done
 -=-=-=-=-

 Note that testABA.py is designed to be used as a stand-alone
 program, but is also designed to be imported where all the real work is
 done from a function that is NOT run during the import. The program that
 imports testABA is then responsible for actually starting the worker.

 I put the sleeps into testABA.runner() so that you can see that the
 main process isn't blocked (note the ABA: waiting... output)


 --
 Wulfraed Dennis Lee Bieber AF6VN
 wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/

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

Thanks, but the problem I need to solve does not permit putting a
function like runner in the main program. I'm constrained to being
able to handle the API of VPython (vpython.org), which lets you write
programs like the following (call it user.py), which animates a 3D
cube moving to the right, using OpenGL:

from visual import box
b = box()
while True:
b.pos.x += 0.001

In VPython at present, the visual module sets up (using C++ and Boost)
a secondary thread that periodically updates the 3D scene using the
current objects and their attributes, and handles events. On the Mac
this is done with Carbon, which is dying, so I need to base VPython on
the Mac on Cocoa, for which the interact loop must be in the primary
thread. Hence my need to turn the architecture inside out while
nevertheless handling the existing API.

The cleanest scheme is to have the user's program user.py import a
module visual that spawns a new process, python visual2.py
user.py, where visual2.py reads the source from user.py, comments out
the import visual, and exec's this modified source in a secondary
thread. This works because visual2.py is now the main module.
Unfortunately, if user.py is run from IDLE, print output goes to a
terminal window rather than to the IDLE shell window, and I don't know
how to direct the output to that shell window.

For this reason I've been experimenting with other schemes, and it
took a while to understand that a thread spawned in an imported module
cannot do imports. I've even managed to carry out a real kludge of
executing imports found in user.py at the top level of visual,
creating a dictionary of globals to pass to an exec of the source in
user.py with all imports there commented out. It works, but ugh.

Bruce 

Re: Sudden doubling of nearly all messages

2012-07-21 Thread Chris Angelico
On Sun, Jul 22, 2012 at 9:07 AM, Devin Jeanpierre
jeanpierr...@gmail.com wrote:
 People hold grudges against MS too strongly, and they believe too much
 in Google's righteousness. They are both big companies that don't
 necessarily care about you.

Just to clarify, I'm not advocating the Google is perfect stance
either; in both cases you're looking at a huge company and a
zero-dollar service. That means you're completely at their mercy in
terms of feature support, and you're most likely going to have your
information harvested as a means of spamming you with ads.

And as you can see from the headers, I use gmail too. I'm fully aware
that they're scanning my emails to target the ads I see; it doesn't
bother me. I have another email address at a domain that I own, with
the mail server being an actual computer that I own, and Google's
welcome to read through all my mailing list posts.

It'd be no different if python.org provided their own free-to-use
webmail service. I'd be assuming you guys are targeting me with ads,
and it wouldn't bother me. :)

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


Re: Sudden doubling of nearly all messages

2012-07-21 Thread Steven D'Aprano
On Sat, 21 Jul 2012 06:48:29 -0400, Dave Angel wrote:

 Has anybody else noticed the sudden double-posting of nearly all
 messages in the python mailing list?

No I have not.

It sounds like a problem with your Usenet provider. Remember that this 
news group is a mirror of the mailing list python-list@python.org so you 
can check the mail archives to see if the problem is there. It is also 
mirrored by gmane (I *think* it is gmane.comp.python.general).


 Previously, I've seen some messages double posted, and it was nearly
 always a newbie, presumably posting via some low-end gateway.

Some people also annoyingly send to both the newsgroup *and* the mailing 
list, not realising -- or not caring -- that they are the same thing.



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


Re: Sudden doubling of nearly all messages

2012-07-21 Thread Steven D'Aprano
On Sat, 21 Jul 2012 19:07:28 -0400, Devin Jeanpierre wrote:


 People hold grudges against MS too strongly, and they believe too much
 in Google's righteousness. They are both big companies that don't
 necessarily care about you.

+1

Google's motto Don't be evil should really be, Don't be evil unless 
there's a lot of money in it.

I personally know a couple of people working for Google, and their famed 
geek-friendly work environment is not all it is cracked up to be either.

I think the IT world is better now than it was 10 years ago, because an 
industry dominated by three big, competing entities who hate each other 
(Microsoft, Apple, Google) is better than a monopoly of one (Microsoft). 
But we, the users and consumers, should never make the mistake of 
thinking that *any* of the three have our best interests at heart.


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


Re: Sudden doubling of nearly all messages

2012-07-21 Thread Dave Angel
On 07/21/2012 08:13 PM, Steven D'Aprano wrote:
 On Sat, 21 Jul 2012 06:48:29 -0400, Dave Angel wrote:

 Has anybody else noticed the sudden double-posting of nearly all
 messages in the python mailing list?
 No I have not.

 It sounds like a problem with your Usenet provider. Remember that this 
 news group is a mirror of the mailing list python-list@python.org so you 
 can check the mail archives to see if the problem is there. It is also 
 mirrored by gmane (I *think* it is gmane.comp.python.general).


I don't have a usenet provider, I use the straight email, collected as
regular email, by Thunderbird.  I thought for a while that perhaps my
imap provider had hiccupped, and just reloaded all the same messages. 
But it happened in several sessions, and for the messages I checked, the
emails were *NOT* identical.

 Previously, I've seen some messages double posted, and it was nearly
 always a newbie, presumably posting via some low-end gateway.
 Some people also annoyingly send to both the newsgroup *and* the mailing 
 list, not realising -- or not caring -- that they are the same thing.



That may be because many other messages (including this one from you)
list the newsgroup in the headers, so a reply-all generates it as one of
the recipients.  The only reason I don't fall into that trap is that I
have Thunderbird configured to *not* send to any newsgroup.



-- 

DaveA

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


Re: My first ever Python program, comments welcome

2012-07-21 Thread Steven D'Aprano
On Sat, 21 Jul 2012 20:40:46 +0100, MRAB wrote:

 On 21/07/2012 20:08, Lipska the Kat wrote:
  l=sorted(l, key=itemgetter(0))

 Short is:
 
  l.sort(key=itemgetter(0))

Shorter, and the semantics are subtly different.

The sorted function returns a copy of the input list.

The list.sort method sorts the list in place.



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


Re: Sudden doubling of nearly all messages

2012-07-21 Thread Chris Angelico
On Sun, Jul 22, 2012 at 10:20 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 On Sun, 22 Jul 2012 04:25:21 +1000, Chris Angelico wrote:

 Use whichever service you like, but don't seriously expect anything that
 you don't pay money for to be perfectly featured AND not spy on you.

 http://duckduckgo.com/privacy.html

They go for privacy at the cost of everything else, and that's fine.
But you still can't depend on its featureset. With a mailing list /
newsgroup reader, there's a whole lot of little things that you'd
probably like, but you can't depend on it; such things cost money, and
most companies that give you stuff that cost money without charging
you money are going to be selling ad space, ergo the temptation to
harvest information about you.

But as I said, I don't care. Google doesn't get any information about
me that I'm not willing for them to get. Let 'em show me ads. And
sometimes they're even useful!

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


Re: My first ever Python program, comments welcome

2012-07-21 Thread Steven D'Aprano
On Sat, 21 Jul 2012 16:10:51 -0400, Dave Angel wrote:

 with fileinput.input(files=(filename)) as f:
 
 fileinput is much more general than you want for processing a single
 file.  That may be deliberate, if you're picturing somebody using
 wildcards on their input.  But if so, you should probably use a
 different name, something that indicates plural.

Also, fileinput is more a convenience module than a serious production 
quality tool. It works, it does the job, but it can be slow. From the 
source:

Performance: this module is unfortunately one of the slower ways of
processing large numbers of input lines.


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


Re: Basic question about speed/coding style/memory

2012-07-21 Thread Devin Jeanpierre
On Sat, Jul 21, 2012 at 5:06 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 So there is approximately 0.03 second difference per TWO MILLION
 if...else blocks, or about 15 nanoseconds each. This is highly unlikely
 to be the bottleneck in your code. Assuming the difference is real, and
 not just measurement error, the difference is insignificant.

It's probably real. For if-else, the true case needs to make a jump
before it returns, but for if-return, there's no jump and the return
is inlined.

-- Devin

 So, don't worry about which is faster. Write whichever is more natural,
 easier to read and write.

The most important advice. Even when it's a larger difference! :)

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


Re: Sudden doubling of nearly all messages

2012-07-21 Thread Rick Johnson
On Saturday, July 21, 2012 6:16:24 PM UTC-5, Chris Angelico wrote:

 Just to clarify, I'm not advocating the 
[...snip...]

Well. Well. Backpedaling AND brown-nosing in a single post. Nice!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sudden doubling of nearly all messages

2012-07-21 Thread Chris Angelico
On Sun, Jul 22, 2012 at 11:33 AM, Rick Johnson
rantingrickjohn...@gmail.com wrote:
 On Saturday, July 21, 2012 6:16:24 PM UTC-5, Chris Angelico wrote:

 Just to clarify, I'm not advocating the
 [...snip...]

 Well. Well. Backpedaling AND brown-nosing in a single post. Nice!

Absolutely. Haven't you noticed that I'm one of those mad people who
goes everywhere in reverse? My backpedal is saying the exact same
thing as my frontpedal!

Curiouser and curiouser...

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


Re: My first ever Python program, comments welcome

2012-07-21 Thread MRAB

On 22/07/2012 01:32, Steven D'Aprano wrote:

On Sat, 21 Jul 2012 20:40:46 +0100, MRAB wrote:


On 21/07/2012 20:08, Lipska the Kat wrote:

l=sorted(l, key=itemgetter(0))


Short is:

 l.sort(key=itemgetter(0))


Shorter, and the semantics are subtly different.

The sorted function returns a copy of the input list.

The list.sort method sorts the list in place.


Since the result is bound to the original name, the
result is the same.

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


Re: My first ever Python program, comments welcome

2012-07-21 Thread Chris Angelico
On Sun, Jul 22, 2012 at 11:56 AM, MRAB pyt...@mrabarnett.plus.com wrote:
 Since the result is bound to the original name, the
 result is the same.

Yes, assuming there are no other refs.

 a=[3,2,1]
 b=a
 a=sorted(a)
 a
[1, 2, 3]
 b
[3, 2, 1]

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


Re: My first ever Python program, comments welcome

2012-07-21 Thread Dave Angel
On 07/21/2012 09:56 PM, MRAB wrote:
 On 22/07/2012 01:32, Steven D'Aprano wrote:
 On Sat, 21 Jul 2012 20:40:46 +0100, MRAB wrote:

 On 21/07/2012 20:08, Lipska the Kat wrote:
 l=sorted(l, key=itemgetter(0))

 Short is:

  l.sort(key=itemgetter(0))

 Shorter, and the semantics are subtly different.

 The sorted function returns a copy of the input list.

 The list.sort method sorts the list in place.

 Since the result is bound to the original name, the
 result is the same.


In this particular program, yes.  But if there's another variable bound
to the same list, then the fact that there's a new object from sorted()
makes a difference.



-- 

DaveA

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


Re: ANN: dbf.py 0.94

2012-07-21 Thread Ethan Furman

Alex Strickland wrote:

Hi


Getting closer to a stable release.

Latest version has a simpler, cleaner API, and works on PyPy (and
hopefully the other implementations as well ;), as well as CPython.

Get your copy at http://python.org/pypi/dbf.

Bug reports, comments, and kudos welcome!  ;)


Not supported: index files:

I have been using http://sourceforge.net/projects/harbour-project/ for 
years where a guy called Przemyslaw Czerpak has written an absolutely 
bullet proof implementation of NTX and CDX for DBF. Maybe it will 
interest you.


I'll check it out, thanks!


PS : bareable is spelt bearable.


I wondered about that.  :/

~Ethan~

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


Re: My first ever Python program, comments welcome

2012-07-21 Thread rusi
On Jul 22, 1:10 am, Dave Angel d...@davea.name wrote:

 A totally off-the-wall query.  Are you using a source control system,
 such as git ?  It can make you much braver about refactoring a working
 program.

Question in a similar vein: What development environment do you use?
My impression is that the majority of pythonistas use a non-ide editor
like vi or emacs
Ive been using emacs for 20 years and python-mode of emacs is very
useful but I am increasingly concerned that emacs is refusing to move
with the times.

Which is why I am particularly curious how an ol Java-head finds
eclipse+python (http://pydev.org/ )
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue14579] CVE-2012-2135: Vulnerability in the utf-16 decoder after error handling

2012-07-21 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

 There are spurious print() calls in the 2.7 patch.

Oh, my inattentiveness. Thank you for pushing, Antoine. And thank Martin for 
review.

--

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



[issue15381] Optimize BytesIO to so less reallocations when written, similarly to StringIO

2012-07-21 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

Hmm. Without the ability to reproduce this effect, it will be difficult for me 
to 
get rid of him. What times for StringIO, append/join, unpatched BytesIO? Do 
this happen with a little different numbers (n=1500, 1600,...,3000)?

--

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



[issue15411] os.chmod() does not follow symlinks on Windows

2012-07-21 Thread Atsuo Ishimoto

New submission from Atsuo Ishimoto ishim...@gembook.org:

os.chmod() should check symlinks if followsymlinks option is True on Windows. 

This is a cause of failure of test case 

   test.test_shutil.TestShutil.test_copymode_follow_symlinks

(#13837)

--
components: Library (Lib), Windows
files: chmod_symlink_win32.patch
keywords: patch
messages: 165996
nosy: ishimoto
priority: normal
severity: normal
status: open
title: os.chmod() does not follow symlinks on Windows
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file26462/chmod_symlink_win32.patch

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



[issue13837] test_shutil fails with symlinks enabled under Windows

2012-07-21 Thread Atsuo Ishimoto

Atsuo Ishimoto ishim...@gembook.org added the comment:

Error in test_copymode_follow_symlinks is adderessed in #15411.

--
nosy: +ishimoto

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



[issue14998] pprint._safe_key is not always safe enough

2012-07-21 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 03cda5360dc6 by Florent Xicluna in branch '3.2':
Issues #10017 and #14998: Fix TypeError using pprint on dictionaries with 
unorderable key.
http://hg.python.org/cpython/rev/03cda5360dc6

New changeset 4d0dcfbdf45b by Florent Xicluna in branch 'default':
Issues #10017 and #14998: Fix TypeError using pprint on dictionaries with 
unorderable key.
http://hg.python.org/cpython/rev/4d0dcfbdf45b

--
nosy: +python-dev

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



[issue10017] pprint.pprint raises TypeError on dictionaries with user-defined types as keys

2012-07-21 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 03cda5360dc6 by Florent Xicluna in branch '3.2':
Issues #10017 and #14998: Fix TypeError using pprint on dictionaries with 
unorderable key.
http://hg.python.org/cpython/rev/03cda5360dc6

New changeset 4d0dcfbdf45b by Florent Xicluna in branch 'default':
Issues #10017 and #14998: Fix TypeError using pprint on dictionaries with 
unorderable key.
http://hg.python.org/cpython/rev/4d0dcfbdf45b

--
nosy: +python-dev

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



[issue10017] pprint.pprint raises TypeError on dictionaries with user-defined types as keys

2012-07-21 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

Thanks for this patch.
I've reviewed the issue and merged the patch of issue #14998 which fixes both 
cases.

--
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed
superseder:  - pprint._safe_key is not always safe enough

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



[issue14998] pprint._safe_key is not always safe enough

2012-07-21 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

Thank you for this patch.

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

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



[issue15412] Note in documentation for weakrefs

2012-07-21 Thread Richard Oudkerk

New submission from Richard Oudkerk shibt...@gmail.com:

In the documentation on weakrefs there is the following quote

Note: Weak references to an object are cleared before the object’s
__del__() is called, to ensure that the weak reference callback 
(if any) finds the object still alive.

But I think the weakref is always dead by the time the callback is invoked.  
The first paragraph from the documentation for weakref.ref(object[, callback]) 
contains the following:

If callback is provided and not None, and the returned weakref 
object is still alive, the callback will be called when the object 
is about to be finalized; the weak reference object will be passed 
as the only parameter to the callback; **the referent will no longer 
be available**.

Which does prompt a question: what use is there for the weakref argument to the 
callback if it already dead?

(Compare http://bugs.python.org/issue14933)

--
assignee: docs@python
components: Documentation
messages: 166002
nosy: docs@python, pitrou, sbt
priority: normal
severity: normal
status: open
title: Note in documentation for weakrefs

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



[issue15411] os.chmod() does not follow symlinks on Windows

2012-07-21 Thread Atsuo Ishimoto

Atsuo Ishimoto ishim...@gembook.org added the comment:

Patch updated. Check symlinks only if supported by platform.

--
Added file: http://bugs.python.org/file26463/issue1492704_new_2.patch

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



[issue15411] os.chmod() does not follow symlinks on Windows

2012-07-21 Thread Atsuo Ishimoto

Changes by Atsuo Ishimoto ishim...@gembook.org:


Removed file: http://bugs.python.org/file26463/issue1492704_new_2.patch

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



[issue15411] os.chmod() does not follow symlinks on Windows

2012-07-21 Thread Atsuo Ishimoto

Changes by Atsuo Ishimoto ishim...@gembook.org:


Added file: http://bugs.python.org/file26464/chmod_symlink_win32_2.patch

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



[issue2919] Merge profile/cProfile in 3.n+1

2012-07-21 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


--
nosy: +flox

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



[issue14998] pprint._safe_key is not always safe enough

2012-07-21 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

I just broke tests :(

--
status: closed - open

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



[issue15381] Optimize BytesIO to so less reallocations when written, similarly to StringIO

2012-07-21 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 Hmm. Without the ability to reproduce this effect, it will be difficult for 
 me to 
 get rid of him.

It's under 64-bit Linux, Intel Core i5 CPU. Are you sure you're testing
in non-debug mode?

That said, the numbers under Windows suggest me that Eli's original idea
(append and then join at the end) would be more robust.

--

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



[issue15412] Note in documentation for weakrefs

2012-07-21 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 In the documentation on weakrefs there is the following quote
 
 Note: Weak references to an object are cleared before the object’s
 __del__() is called, to ensure that the weak reference callback 
 (if any) finds the object still alive.
 
 But I think the weakref is always dead by the time the callback is
 invoked.

It's true, the doc needs fixing.

 Which does prompt a question: what use is there for the weakref
 argument to the callback if it already dead?

The weakref is dead but it's still a weakref, and it can be used to
e.g. index a container of existing weakrefs (cf. WeakSet,
WeakKeyDictionary, WeakValueDictionary).

--

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



[issue15381] Optimize BytesIO to so less reallocations when written, similarly to StringIO

2012-07-21 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

By the way, here is Matt Mackall's take on realloc():

http://www.selenic.com/pipermail/mercurial-devel/2011-October/034988.html

--

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



[issue15381] Optimize BytesIO to so less reallocations when written, similarly to StringIO

2012-07-21 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

StringIO:

$ ./python -m timeit -s import io; n=2000; d=['a'*n,'bb'*n,'ccc'*n]*1000  
s=io.StringIO(); w=s.write  for x in d: w(x)  global y; y = s.getvalue()

- Linux: 1000 loops, best of 3: 985 usec per loop
- Windows: 100 loops, best of 3: 4.26 msec per loop

Unpatched BytesIO:

$ ./python -m timeit -s import io; n=2000; d=[b'a'*n,b'bb'*n,b'ccc'*n]*1000  
s=io.BytesIO(); w=s.write  for x in d: w(x)  global y; y = s.getvalue()

- Linux: 100 loops, best of 3: 2.44 msec per loop
- Windows: 10 loops, best of 3: 38.4 msec per loop

b''.join():

$ ./python -m timeit -s import io; n=2000; d=[b'a'*n,b'bb'*n,b'ccc'*n]*1000  
l = list(d)  global y; y = b''.join(l)

- Linux: 1000 loops, best of 3: 821 usec per loop
- Windows: 100 loops, best of 3: 4.09 msec per loop

bytearray:

$ ./python -m timeit -s import io; n=2000; d=[b'a'*n,b'bb'*n,b'ccc'*n]*1000  
b = bytearray() for x in d: b += x global y; y = b

- Linux: 1000 loops, best of 3: 834 usec per loop
- Windows: 10 loops, best of 3: 37.8 msec per loop

--

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



[issue15412] Note in documentation for weakrefs

2012-07-21 Thread Richard Oudkerk

Richard Oudkerk shibt...@gmail.com added the comment:

 The weakref is dead but it's still a weakref, and it can be used to
 e.g. index a container of existing weakrefs (cf. WeakSet,
 WeakKeyDictionary, WeakValueDictionary).

Ah.

I had assumed that since dead weakrefs were unhashable you couldn't safely use 
them as keys in a dict.  (Presumably removal of a no longer hashable key from a 
dict is O(n)?)

I also hadn't realize that weakrefs were subclassable.

--

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



[issue15412] Note in documentation for weakrefs

2012-07-21 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 I had assumed that since dead weakrefs were unhashable you couldn't
 safely use them as keys in a dict.  (Presumably removal of a no longer
 hashable key from a dict is O(n)?)

They are unhashable if you didn't hash them alive. Otherwise they retain
their old hash value (which is quite useful :-)).

--

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



[issue14998] pprint._safe_key is not always safe enough

2012-07-21 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

Test test_pprint fixed with changesets 29642f82bbcc and 79d44f4920d9.

--
status: open - closed

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



[issue12834] PyBuffer_ToContiguous() incorrect for non-contiguous arrays

2012-07-21 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

There is an additional problem with PyBuffer_ToContiguous():

Suppose 'view' is multi-dimensional, C-contiguous and initialized
according to PyBUF_ND, i.e. view-shape != NULL but view-strides == NULL.

Now if PyBuffer_ToContiguous() is called with 'F', PyBuffer_IsContiguous()
returns false and view-strides will be accessed.


This means that incomplete buffer information will have to be
reconstructed like it is done in the 3.3 memoryview.

--

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



[issue7214] TreeBuilder.end(tag) differs between cElementTree and ElementTree

2012-07-21 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


Removed file: http://bugs.python.org/file18445/unnamed

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



[issue7214] TreeBuilder.end(tag) differs between cElementTree and ElementTree

2012-07-21 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

does it require action in 3.3, where the C implementation is active by default?

--

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



[issue7214] TreeBuilder.end(tag) differs between cElementTree and ElementTree

2012-07-21 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


--
nosy: +eli.bendersky
versions: +Python 3.3 -Python 2.7, Python 3.2

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



[issue9610] buildbot: uncaptured python exception (smtpd), but no failure in regrtest

2012-07-21 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

probably related to issue #5154 mentioned in previous comment: 
http://bugs.python.org/issue9610#msg114000

--
resolution:  - wont fix
status: open - closed

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



[issue3609] does parse_header really belong in CGI module?

2012-07-21 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

This refactoring between cgi and email modules is languishing for few years.
Any thought?

--
status: open - languishing
versions: +Python 3.4 -Python 3.2

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



[issue8273] move generally useful test.support functions into the unittest package

2012-07-21 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


--
versions: +Python 3.4 -Python 3.2, Python 3.3

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



[issue5504] ctypes should work with systems where mmap can't be PROT_WRITE and PROT_EXEC

2012-07-21 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


--
status: open - closed

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



[issue15184] Test failure in test_sysconfig_module

2012-07-21 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset d76b83803e7e by Ned Deily in branch 'default':
Issue #15184: Ensure consistent results of OS X configuration
http://hg.python.org/cpython/rev/d76b83803e7e

--
nosy: +python-dev

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



[issue15184] Test failure in test_sysconfig_module

2012-07-21 Thread Ned Deily

Ned Deily n...@acm.org added the comment:

I've committed an updated version of the refactoring patch which attempts to 
handle some additional edge cases and which includes a number of additional 
tests.  I still have not been able to reproduce the original failure so I'm 
setting the status to pending awaiting a test report from Georg or someone else 
who is able to reproduce it.

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - pending

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



[issue9566] Compilation warnings under x64 Windows

2012-07-21 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

Attached file is a copy of the remaining warnings on the AMD64 Windows7 SP1 3.x 
builder.

--
keywords: +buildbot
nosy: +flox
Added file: http://bugs.python.org/file26465/warnings64.log

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



[issue9783] _elementtree.c warnings under 64-bit Windows

2012-07-21 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

This warning is not specific to the _elementtree module.
See related issue #9566.

--
nosy: +eli.bendersky
resolution:  - duplicate
status: open - closed
superseder:  - Compilation warnings under x64 Windows

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



[issue9772] test_pep277 failure on AMD64 debian parallel buildbot

2012-07-21 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

 That appears to be a bug in the NFS server.

So, it's not a Python bug.

--
resolution:  - works for me
status: open - closed

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



  1   2   3   >