PyHou January -- Python Teach and Learn! (Houston, Texas, USA)

2011-01-15 Thread Walker Hale IV
Announcing a new Meetup for PyHou - Houston Python Enthusiasts!!

What: PyHou - Python Teach and Learn!

When: Tuesday, January 18, 2011 7:00 PM

Where: Stag's Head Pub
2128 Portsmouth St
Houston, TX 77098
713-533-1199

Hello Pythonistas!

January's Python Teach and Learn Meetup will focus on a
back-to-basics approach, with a twist! At this session, we will ask
our novices  newcomers to pair up with experts for individual or
small group QA and demos.

Know anyone who wants to get started with Python, but isn't quite sure
how to jump in?

Been interested in the Meetup, but was afraid it was too technical?
(hint: it's not!) Looking to brush up on your basics? Ready for more
Python awesomeness?

Format: We'll start with a 15-minute tour covering the Python
documentation and essential references. Afterwards, we'll
pair-up/group-up and work through some core concepts.

Novices: Bring your questions! Need some help with the basics? Stuck
with some tricky material? We'll try to help!

Experts: Please come! Everyone's an expert in some areas but a novice
in others, so we'll rearrange as necessary, and your input is
invaluable!

Everyone: If possible, bring your laptop with charged battery and
Python installed. (We'll have installers for Mac and Windows available
if needed).

This is our first time with this format for our Meetup, so input and
suggestions are welcome and appreciated!!

As usual, we'll save time at the end for general Python geekiness and
catching-up. :-)

Our meetup is located at the Stag's Head Pub, near Richmond and
Shepherd. Please enjoy their menu and drink offerings, so they
continue to enjoy hosting us! Lastly, please RSVP (even if you're a
Maybe!) to assist us with capacity planning!

RSVP to this Meetup:
http://www.meetup.com/python-14/calendar/15753896/


-- 
Walker Hale walker.hale...@gmail.com
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


alsaseq 0.4

2011-01-15 Thread Patricio Paez

Hi all,

In this release the module was ported to Python 3, maintaining
Python 2 support, and distutils are used now.

alsaseq is a Python 3 and Python 2 module that allows to
interact with ALSA sequencer clients.   It can create an ALSA
client, connect to other clients, send and receive ALSA events
immediately or at a scheduled time using a sequencer queue.  It
provides a subset of the ALSA sequencer capabilities in
a simplified model.

It is implemented in C language and licensed under the Gnu GPL
license version 2 or later.

Home
http://pp.com.mx/python/alsaseq

Download
http://pp.com.mx/python/alsaseq/alsaseq-0.4.tar.gz

Regards,
Patricio Páez  pp at pp.com.mx
--
http://mail.python.org/mailman/listinfo/python-announce-list

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


Re: FTP problem

2011-01-15 Thread Justin Ezequiel
'indexftp.barcap.com' only (sans the 'ftp.' prefix) allows me to
connect to an FTP server

ftp indexftp.barcap.com
Connected to usftp.barcap.com.
220-Connected to usftp.barcap.com.
220 FTP server ready.
User (usftp.barcap.com:(none)):
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: do you know what's CGI? (web history personal story)

2011-01-15 Thread Captain Obvious

XL ... i recall, i stopped doing Mathematica in 1998 because it's a
XL career dead-end as a programing lang, and dived into the utterly
XL idiotic Perl  unix  mysql world. (See: The Unix Pestilence ◇ Xah
XL Lee's Computing Experience (Impression Of Lisp from Mathematica).)

I guess you're calling idiotic everything you're too lazy to understand.

XL today were under 10 in the 1990s. They wouldn't know what was CGI, and
XL no amount of explanation can tell them exactly it was like, because it
XL has become HISTORY — if you didn't live it, you can't feel it.

CGI is still used in some places today, hello?
If spawning a process for each request is what you want to do, it is a way 
to go.


inetd is quite similar to CGI and, guess what, it is still used. 


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


Re: Tkinter: The good, the bad, and the ugly!

2011-01-15 Thread Mel
Zeissmann wrote:

 Seriously, get off of WoW and go write some code. If you'd spent the
 last year programming instead of doing your best Xah Lee impression you
 might have actually made some progress on this.
 
 I'm curious, is Xah Lee some sort of a Usenet meme? Cause this is not the
 first time I see his name in the context of a lightweight invective.

AFAIK he's just a guy who thinks Usenet is his blog, and kicks off big 
rambling threads, cross-posted to infinity that mathematically have 
probability 0.0 of being on topic in any of the groups they're in.

Mel.

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


BackupRead problem

2011-01-15 Thread Stefan Sonnenberg-Carstens

I'm trying to create a Backup/Restore app.
I'm really struggeling for a long time.

I can successfully read directories, but not files.
Every time, I'll try I get Access denied, Error 5.

It's running with admin privs.

Any ideas ?

#!python
import sys
import os
import os.path
import getopt
import time


DELETE=0x0001
READ_CONTROL=0x0002
WRITE_DAC=0x0004
WRITE_OWNER=0x0008
SYNCHRONIZE=0x0010
STANDARD_RIGHTS_REQUIRED=0x000FL
STANDARD_RIGHTS_READ=READ_CONTROL
STANDARD_RIGHTS_WRITE=READ_CONTROL
STANDARD_RIGHTS_EXECUTE=READ_CONTROL
STANDARD_RIGHTS_ALL=0x001F
SPECIFIC_RIGHTS_ALL=0x

FILE_ATTRIBUTE_REPARSE_POINT=0x400

from ctypes import *

if os.name == 'nt':

import win32security
import win32process
import win32file

try:
import win32api
except ImportError,e:
print sys.stderr,'Could not load win32api module. Can not 
continue'

os._exit(1)
try:
import wmi
except ImportError,e:
print sys.stderr,'Could not load wmi module. Can not continue'
os._exit(1)
try:
import ctypes
except ImportError,e:
print sys.stderr,'Could not load ctypes module. Can not continue'
os._exit(1)
else:
print sys.stderr,'Sorry, your platform %s is not supported' % os.name
os._exit(1)

if len(sys.argv) = 1:
try:
opts,args = getopt.getopt(sys.argv[1:],'h',('help',))
except getopt.GetoptError,e:
print str(e)
if not ctypes.windll.shell32.IsUserAnAdmin():
win32api.ShellExecute(None,'runas',sys.executable,' 
'.join(sys.argv),r'C:\WINDOWS',0)

else:
print sys.stderr,'Running with administrative privileges'
token = 
win32security.OpenProcessToken(win32process.GetCurrentProcess(),win32security.TOKEN_ADJUST_PRIVILEGES|win32security.TOKEN_QUERY)

if token:
for priv in 
(win32security.SE_BACKUP_NAME,win32security.SE_RESTORE_NAME):

luid = win32security.LookupPrivilegeValue(None,priv)
newState = [(luid,win32security.SE_PRIVILEGE_ENABLED)]
try:
win32security.AdjustTokenPrivileges(token,0,newState)
except:
print sys.stderr,'Could not get (some) required 
priviledge(s): ',win32api.FormatMessage(win32api.GetLastError())

os._exit(1)
win32api.CloseHandle(token)
else:
print sys.stderr,'Could not get token for running process'
os._exit(1)
print sys.stderr,'Acquired backup/restore context 
(SeRestorePrivilege and SeBackupPrivilege enabled)'
inf = 
win32file.CreateFile(r'C:\Windows\System32\drivers\etc\hosts',READ_CONTROL,0,None,win32file.OPEN_EXISTING,win32file.FILE_FLAG_BACKUP_SEMANTICS,None)

buf = win32file.AllocateReadBuffer(4096)
ctx = 0
(bytes_read,buf,ctx) = 
win32file.BackupRead(inf,4096,buf,False,True,ctx)

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


Re: Developing a program to make a family tree.

2011-01-15 Thread Grant Edwards
On 2011-01-14, Ata Jafari a.j.romani...@gmail.com wrote:

 I'm trying to develop a program like family tree maker. I have all
 information, so there is no need to search on the net. This must be
 something like trees.

Not really.  It's more like a combination of a directed graph 
and a relational database.

 Can someone help me? I'm at the beginning.

You do know there is already a family-tree-maker program written in
Python, right?

http://gramps-project.org/

Your time might be better spent working on Gramps...

-- 
Grant


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


Re: do you know what's CGI? (web history personal story)

2011-01-15 Thread Sherm Pendley
Captain Obvious udode...@users.sourceforge.net writes:

 XL ... i recall, i stopped doing Mathematica in 1998 because it's a
 XL career dead-end as a programing lang, and dived into the utterly
 XL idiotic Perl  unix  mysql world. (See: The Unix Pestilence ◇ Xah
 XL Lee's Computing Experience (Impression Of Lisp from Mathematica).)

 I guess you're calling idiotic everything you're too lazy to understand.

That's Xah for you.

 XL today were under 10 in the 1990s. They wouldn't know what was CGI, and
 XL no amount of explanation can tell them exactly it was like, because it
 XL has become HISTORY — if you didn't live it, you can't feel it.

 CGI is still used in some places today, hello?

Yeah, James Cameron made a *ton* of money using it to make Avatar.

What? Why is everyone looking at me that way? ;-)

sherm--

-- 
Sherm Pendley
   http://camelbones.sourceforge.net
Cocoa Developer
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: do you know what's CGI? (web history personal story)

2011-01-15 Thread Grant Edwards
On 2011-01-15, Sherm Pendley sherm.pend...@gmail.com wrote:
 Captain Obvious udode...@users.sourceforge.net writes:

 XL ... i recall, i stopped doing Mathematica in 1998 because it's a
 XL career dead-end as a programing lang, and dived into the utterly
 XL idiotic Perl  unix  mysql world. (See: The Unix Pestilence ??? Xah
 XL Lee's Computing Experience (Impression Of Lisp from Mathematica).)

 I guess you're calling idiotic everything you're too lazy to understand.

 That's Xah for you.

 XL today were under 10 in the 1990s. They wouldn't know what was CGI, and
 XL no amount of explanation can tell them exactly it was like, because it
 XL has become HISTORY ??? if you didn't live it, you can't feel it.

 CGI is still used in some places today, hello?

 Yeah, James Cameron made a *ton* of money using it to make Avatar.

Too bad he couldn't have used it to make a better movie.

Did we really need Furngully avec 3D sans funny?

-- 
Grant

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


Re: do you know what's CGI? (web history personal story)

2011-01-15 Thread Martin v. Loewis
 CGI is still used in some places today, hello?
 
 Yeah, James Cameron made a *ton* of money using it to make Avatar.

He used compacted graphite iron in Avatar? I didn't know that.

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


Re: do you know what's CGI? (web history personal story)

2011-01-15 Thread Grant Edwards
On 2011-01-15, Martin v. Loewis mar...@v.loewis.de wrote:
 CGI is still used in some places today, hello?
 
 Yeah, James Cameron made a *ton* of money using it to make Avatar.

 He used compacted graphite iron in Avatar? I didn't know that.

Is that what unobtanium is?

Did anybody else thing Unobtainium was a blatant ripoff of Upsidasium
from Rocky and Bullwinkle?  http://en.wikipedia.org/wiki/Upsidaisium

-- 
Grant

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


Re: BackupRead problem

2011-01-15 Thread Stefan Sonnenberg-Carstens

Am 15.01.2011 16:06, schrieb Stefan Sonnenberg-Carstens:

I'm trying to create a Backup/Restore app.
I'm really struggeling for a long time.

I can successfully read directories, but not files.
Every time, I'll try I get Access denied, Error 5.

It's running with admin privs.

Any ideas ?

#!python
import sys
import os
import os.path
import getopt
import time


DELETE=0x0001
READ_CONTROL=0x0002
WRITE_DAC=0x0004
WRITE_OWNER=0x0008
SYNCHRONIZE=0x0010
STANDARD_RIGHTS_REQUIRED=0x000FL
STANDARD_RIGHTS_READ=READ_CONTROL
STANDARD_RIGHTS_WRITE=READ_CONTROL
STANDARD_RIGHTS_EXECUTE=READ_CONTROL
STANDARD_RIGHTS_ALL=0x001F
SPECIFIC_RIGHTS_ALL=0x

FILE_ATTRIBUTE_REPARSE_POINT=0x400

from ctypes import *

if os.name == 'nt':

import win32security
import win32process
import win32file

try:
import win32api
except ImportError,e:
print sys.stderr,'Could not load win32api module. Can not 
continue'

os._exit(1)
try:
import wmi
except ImportError,e:
print sys.stderr,'Could not load wmi module. Can not continue'
os._exit(1)
try:
import ctypes
except ImportError,e:
print sys.stderr,'Could not load ctypes module. Can not 
continue'

os._exit(1)
else:
print sys.stderr,'Sorry, your platform %s is not supported' % 
os.name

os._exit(1)

if len(sys.argv) = 1:
try:
opts,args = getopt.getopt(sys.argv[1:],'h',('help',))
except getopt.GetoptError,e:
print str(e)
if not ctypes.windll.shell32.IsUserAnAdmin():
win32api.ShellExecute(None,'runas',sys.executable,' 
'.join(sys.argv),r'C:\WINDOWS',0)

else:
print sys.stderr,'Running with administrative privileges'
token = 
win32security.OpenProcessToken(win32process.GetCurrentProcess(),win32security.TOKEN_ADJUST_PRIVILEGES|win32security.TOKEN_QUERY)

if token:
for priv in 
(win32security.SE_BACKUP_NAME,win32security.SE_RESTORE_NAME):

luid = win32security.LookupPrivilegeValue(None,priv)
newState = [(luid,win32security.SE_PRIVILEGE_ENABLED)]
try:
win32security.AdjustTokenPrivileges(token,0,newState)
except:
print sys.stderr,'Could not get (some) required 
priviledge(s): ',win32api.FormatMessage(win32api.GetLastError())

os._exit(1)
win32api.CloseHandle(token)
else:
print sys.stderr,'Could not get token for running process'
os._exit(1)
print sys.stderr,'Acquired backup/restore context 
(SeRestorePrivilege and SeBackupPrivilege enabled)'
inf = 
win32file.CreateFile(r'C:\Windows\System32\drivers\etc\hosts',READ_CONTROL,0,None,win32file.OPEN_EXISTING,win32file.FILE_FLAG_BACKUP_SEMANTICS,None)

buf = win32file.AllocateReadBuffer(4096)
ctx = 0
(bytes_read,buf,ctx) = 
win32file.BackupRead(inf,4096,buf,False,True,ctx)

MS's documenation sucks.
Just found some code on the web regarding root-kits,
but after changing

win32file.CreateFile(r'C:\Windows\System32\drivers\etc\hosts',READ_CONTROL,0,None,win32file.OPEN_EXISTING,win32file.FILE_FLAG_BACKUP_SEMANTICS,None)

to

win32file.CreateFile(r'C:\Windows\System32\drivers\etc\hosts',win32file.GENERIC_READ,0,None,win32file.OPEN_EXISTING,win32file.FILE_FLAG_BACKUP_SEMANTICS,None)


it works.

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


Re: do you know what's CGI? (web history personal story)

2011-01-15 Thread rantingrick
On Jan 15, 10:38 am, Grant Edwards inva...@invalid.invalid wrote:

  Yeah, James Cameron made a *ton* of money using it to make Avatar.

 Too bad he couldn't have used it to make a better movie.


I don't LOL very often but i must say that i was ROTF after this
comment. Avatar was very disappointing (Both in graphics and story)
but maybe i expect too much...? I found the look and feel of Beowulf
to be more lifelike. Actually if you appreciate great rendering then
you may want to check out Despicable Me. The story was utterly
atrocious (although slightly interesting at moments) but the render
quality rivaled the best Dreamworks i have ever seem!
-- 
http://mail.python.org/mailman/listinfo/python-list


Fitness data program

2011-01-15 Thread Antonio Cardenes
Hello folks, I'm trying to improve my Phyton skills with a project: A
fitness program that can correlate measurements (weight and size of various
body parts), date taken and it has to be able to print a nice graph showing
improvements (a la Wii Fit)

I was wondering if you could point me in the right path (modules and such),
thanks.

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


Re: do you know what's CGI? (web history personal story)

2011-01-15 Thread Emile van Sebille

On 1/15/2011 8:44 AM Grant Edwards said...

On 2011-01-15, Martin v. Loewismar...@v.loewis.de  wrote:

CGI is still used in some places today, hello?


Yeah, James Cameron made a *ton* of money using it to make Avatar.


He used compacted graphite iron in Avatar? I didn't know that.


Is that what unobtanium is?

Did anybody else thing Unobtainium was a blatant ripoff of Upsidasium
from Rocky and Bullwinkle?  http://en.wikipedia.org/wiki/Upsidaisium



No -- I figured he took it directly form the name of the material used 
to make the MotoGP bikes...


Emile

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


Re: do you know what's CGI? (web history personal story)

2011-01-15 Thread John Nagle

On 1/14/2011 1:20 PM, Xah Lee wrote:

some extempore thought.


   Who let the dogs in?

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


Re: Developing a program to make a family tree.

2011-01-15 Thread Katie T
On Fri, Jan 14, 2011 at 7:57 PM, Jon Clements jon...@googlemail.com wrote:
 Otherwise, you're in for a struggle, as you need to choose a storage
 back-end, a GUI (wxWindows/GTK/Qt4 etc...), how to handle GEDCOM
 format (unless it's not going to be compatible with other software),
 does it need to produce web pages/reports (and in what formats).

There are a couple of Python gedcom parsers around:

http://ilab.cs.byu.edu/cs460/code/gedcom/gedcom.py

https://github.com/dijxtra/simplepyged


Katie
-- 
CoderStack
http://www.coderstack.co.uk/python-jobs
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Fitness data program

2011-01-15 Thread Katie T
On Sat, Jan 15, 2011 at 5:47 PM, Antonio Cardenes
antonio.carde...@gmail.com wrote:
 Hello folks, I'm trying to improve my Phyton skills with a project: A
 fitness program that can correlate measurements (weight and size of various
 body parts), date taken and it has to be able to print a nice graph showing
 improvements (a la Wii Fit)

Scipy + Matplotlib should give you the tools to do correlation stats
and graphing.

Katie
-- 
CoderStack
http://www.coderstack.co.uk/python-jobs
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Career path - where next?

2011-01-15 Thread Alan Harris-Reid
To all those who answered my original post so far (Jon Clements, Terry 
Jan Reedy, Philip Semanchuk) - many thanks.  Your suggestions have given 
me a number of avenues to follow.  I'll let you know how I get on.


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


Re: Fitness data program

2011-01-15 Thread GrayShark
On Sat, 15 Jan 2011 19:48:40 +, Katie T wrote:

 On Sat, Jan 15, 2011 at 5:47 PM, Antonio Cardenes
 antonio.carde...@gmail.com wrote:
 Hello folks, I'm trying to improve my Phyton skills with a project: A
 fitness program that can correlate measurements (weight and size of
 various body parts), date taken and it has to be able to print a nice
 graph showing improvements (a la Wii Fit)
 
 Scipy + Matplotlib should give you the tools to do correlation stats and
 graphing.
 
 Katie

Likely you'll want a database, for usernames, dates, weights. Since it's 
so simple, using sqlite (which doesn't have a running database engine) is 
a wise choice. There's a python module to help interface. 

Also you might visit the django website. This sort of project could use a 
web frontend, since your likely want users to have access to their plots, 
so logins are required; 

Remote access (via web) sounds reasonable too. During those early days of 
shaping up, well, no one else need see my progress.

Remember the old adage KISS (Keep It Simple, Stupid)

steven

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


Re: Developing a program to make a family tree.

2011-01-15 Thread Michael Hunter
On Fri, Jan 14, 2011 at 11:39 AM, Ata Jafari a.j.romani...@gmail.com wrote:
 Hi there.
 I'm trying to develop a program like family tree maker. I have all
 information, so there is no need to search on the net. This must be
 something like trees. Can someone help me? I'm at the beginning.
 Thanks.

I think you are probably coming at this from the wrong direction.
Either you want to solve your family tree problem in the easiest way
possible in which case there are already packages available or you
want to develop this because you want to do the project to learn
(more) python, etc.  Assuming the later the fact you have to ask the
question in the way you did means you are short on software design
experience and don't know much about the problem domain (genealogy).
Additionally you probably havn't written much code although you came
here so you probably have a little experience.  That is triple death.
You need to hold a couple of those variables stable.  I'd suggest
finding a existing open source genealogy program and use bug fixing as
a way to learn basics about the package and then try to add a feature
as a way of learning something about software design.

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


Re: Developing a program to make a family tree.

2011-01-15 Thread Ata Jafari
People here guided me to GRAMPS, an open-source software project. Yes,
I'm new, and Python is my first programming language. My software
should not be only a tree-like one. There are 254 people in this
family tree. I'm trying to find another method. But I think it is
better to start with contributing to GRAMPS first.
Thanks.

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


Re: do you know what's CGI? (web history personal story)

2011-01-15 Thread Alice Bevan–McGregor

On 2011-01-15 08:15:25 -0800, Sherm Pendley said:


Captain Obvious udode...@users.sourceforge.net writes:


XL ... i recall, i stopped doing Mathematica in 1998 because it's a
XL career dead-end as a programing lang, and dived into the utterly
XL idiotic Perl  unix  mysql world. (See: The Unix Pestilence ◇ Xah
XL Lee's Computing Experience (Impression Of Lisp from Mathematica).)

I guess you're calling idiotic everything you're too lazy to understand.


That's Xah for you.


It's a bad sign when people use your name as a running joke in multiple 
mailing lists (outside the ones regularly posted in, specificaly I 
noticed this in one of the web framework lists) to mean silly/stupid 
comments with no basis in reality.


— Alice.


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


Re: do you know what's CGI? (web history personal story)

2011-01-15 Thread Alice Bevan–McGregor

On 2011-01-15 08:55:47 -0800, rantingrick said:


On Jan 15, 10:38 am, Grant Edwards inva...@invalid.invalid wrote:


Yeah, James Cameron made a *ton* of money using it to make Avatar.


Too bad he couldn't have used it to make a better movie.


I found the graphics impressive; the blue people was merely an effort 
to avoid a more clear representation of the Na'vi as North American 
indigenous people.


Avatar was very disappointing (Both in graphics and story) but maybe i 
expect too much...?


The story was clearly Pocahontas… in Space!, which was very disappointing.


I found the look and feel of Beowulf to be more lifelike.


That's just the naked Angelina Jolie in your brain talking.  ;)

— Alice.


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


Re: do you know what's CGI? (web history personal story)

2011-01-15 Thread rantingrick
On Jan 15, 4:22 pm, Alice Bevan–McGregor al...@gothcandy.com wrote:

 That's just the naked Angelina Jolie in your brain talking.  ;)

must...keep...hands...on...keyboard :-O
.
.
.
.
.
.
.
.
OPPS! ;-)
-- 
http://mail.python.org/mailman/listinfo/python-list


Regex url

2011-01-15 Thread Jean-Francois
Hi,

I try to match the following url with one regex

/hello
/hello/
/hello/world
/hello/world/


world is a variable, I can put toto instead

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


Re: Regex url

2011-01-15 Thread MRAB

On 16/01/2011 01:48, Jean-Francois wrote:

Hi,

I try to match the following url with one regex

/hello
/hello/
/hello/world
/hello/world/


world is a variable, I can put toto instead


The regex is:

^/hello(?:/(?:[a-z]+/?)?)$

Its meaning is:

start of string
characters /hello
optional:
character /
optional:
one or more:
one of:
a .. z
optional:
character /
end of string

If it's not what you want, you need to be more specific.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Regex url

2011-01-15 Thread Corey Richardson
On 01/15/2011 08:48 PM, Jean-Francois wrote:
 Hi,
 
 I try to match the following url with one regex
 
 /hello
 /hello/
 /hello/world
 /hello/world/
 
 
 world is a variable, I can put toto instead
 
 Thanks !

What was the regex you tried, and where did it fail? I'm no re guru, but
here's my go at it:

(/hello/?(%s)?/?) % var

Interpreter session:
Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56)
[GCC 4.4.5] on linux2
Type help, copyright, credits or license for more information.
 import re
 var = toto
 pat = re.compile((/hello/?(%s)?/?) % var)
 pat.match(/hello/toto)
_sre.SRE_Match object at 0x7f53baf25938
 pat.match(/hello)
_sre.SRE_Match object at 0x7f53baf25c68
 pat.match(/hello/)
_sre.SRE_Match object at 0x7f53baf25938
 pat.match(/hello/toto/)
_sre.SRE_Match object at 0x7f53baf25c68

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


Re: do you know what's CGI? (web history personal story)

2011-01-15 Thread Rainy
On Jan 15, 5:22 pm, Alice Bevan–McGregor al...@gothcandy.com wrote:
 On 2011-01-15 08:55:47 -0800, rantingrick said:

  On Jan 15, 10:38 am, Grant Edwards inva...@invalid.invalid wrote:

  Yeah, James Cameron made a *ton* of money using it to make Avatar.

  Too bad he couldn't have used it to make a better movie.

 I found the graphics impressive; the blue people was merely an effort
 to avoid a more clear representation of the Na'vi as North American
 indigenous people.

  Avatar was very disappointing (Both in graphics and story) but maybe i
  expect too much...?

 The story was clearly Pocahontas… in Space!, which was very disappointing.


I have to disagree.. without writing
a dozen pages of my thoughts on Avatar,
I think this comment from Metafilter
sums it up best:

http://www.metafilter.com/88197/Even-better-without-special-effects#2897157

a href=http://www.metafilter.com/88197/Even-better-without-special-
effects#2897157link/a
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter: The good, the bad, and the ugly!

2011-01-15 Thread rantingrick
On Jan 14, 3:37 pm, geremy condra debat...@gmail.com wrote:
 If you'd spent the
 last year programming instead of doing your best Xah Lee impression
 you might have actually made some progress on this.

Well Geremy the very first step a wise developer employs is to get an
idea of what the masses want and what they don't want. Nobody wants to
waste a second (much less a whole year) developing a wxPython stdlib
module when the powers that be won't even *entertain* the idea of a
wxPython stdlib module. Most every Python programmer (noob to pro)
understands that while Tkinter is a great starter GUI module
eventually you hit the glass ceiling. However for some strange and
quite ridiculous reason they insist on keeping Tkinter alive forever.
I am at a loss here.

Interviewer: So how do you feel about Tkinter?
Python Community: Well Tkinter sucks what more can i say?

Interviewer: Ok so maybe we should replace Tkinter with something
better then?
Python Community: What? Are you stupid? No it sucks but we will keep
it! And that is that! I have spoken!

Interviewer: So let me get this strait fella... You hate Tkinter, and
most of your constituents won't even bother to use it because they
hate it also *however* you just want to let it rot in the stdlib like
some aging hero of boredom and booze?
Python Community: Pretty much. Yea.

Interviewer: Sounds like a Masochistic psychosis to me.
Python Community:  ad hominem!,  ad hominem!




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


After C++, what with Python?

2011-01-15 Thread Aman
Hey all, I am a college student, and at college, we did most of the work in 
C/C++. I kind of stopped using C when I learned C++ (simply because C++ seemed 
a natural/elegant choice to me, and had backward compatibility with C). I've 
had a lot of experience with C++.
Recently, I was on the path to learn a new programming language, and after 
suggestion of some of my friends and consulting the web, I chose to proceed 
with Python. I've finished with core Python and now I'm going through the 
various inbuilt packages that Python provides. I have an inquisitive mind, and 
while programming, I always want/tend to make something that is out of the box. 
It would be great if you people could guide me as to what to proceed with and 
how.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: do you know what's CGI? (web history personal story)

2011-01-15 Thread Xah Lee
   Avatar was very disappointing (Both in graphics and story) but maybe i
   expect too much...?

  The story was clearly Pocahontas… in Space!, which was very disappointing.

 I have to disagree..

Loly. At this point, i must voice Xah's Point Of View.

〈Avatar and District 9 Movie Review〉
http://xahlee.org/Periodic_dosage_dir/skina/avatar.html

--
Avatar and District 9 Movie Review

Xah Lee, 2010-01-07

--
Avatar

Went to watch the movie Avatar (2009 film) in theater today.

Boo. On a scale of 1 to 10, i'd say this is no more than 7. This movie
is totally predicable, stereotypical, intellectually shallow. The 3D
effect isn't impressive at all, and about the only thing that is
positive about this movie is the imaginative flora and fauna.

This movies garnered raving reviews, both by critics as well as being
a highly successful money maker. But it's so disappointing to me that
i have to think about where to begin.

--
3D Effect

Ok, lets begin at some easy criticisms, the 3D tech. I recall, back in
late 1970s or early 1980s when i was about 10 or so, my mom's mom took
me to see one of the first 3D film, in Taiwan, a kung fu film. I
vividly recall that i physically dodged when the weapons swung towards
me from the screen. Yeah, a lot people did that. That, is the effect
of good 3D on you. But now, after 30 years, one'd suppose that the 3D
tech has improved vastly, which it has. However, watching Avatar, i
hardly get ANY 3D sense at all. In fact, i absolutely don't feel any
3D sense, perhaps a little, if i force my self to feel it, thru its 3D
glasses. (I did not watch it on iMax)

What's wrong? I don't know. Perhaps the 3D tech is different. I don't
remember which 3D films i've watched back 30 years ago, but am
guessing that some 3D tech are designed to have a exaggerated
perspectivity, and am guessing the 3D tech used in this movie is
designed to be more mellow or wide angle. But over all, i say bah.

--
Predicable

Ok, now i might disclose some of this movie's plot, and so here's your
“spoiler” warning, but, the movie is so formula driven and
stereotypical that it doesn't matter much.

The movie, in one sentence, is about Western powers with high tech
wanting to take over gold from some primitive, indigenous people, for
their riches in their land. Yeah, that's it. And, yes, there's a hero,
who gradually realized that this isn't right, and fell in love with
one of the beautiful chick from the indigenous people (you guessed
right, the daughter of a chieftain!), and saved the tribe, with the
help of local animals and magical nature.

The movies runs 2.5 hours. I didn't particular cry “move on already”
at any point, but nor did the long movie had my attention wholly
seized.

There are no characters. All are shallow. The bad guys, in this case,
the corporation head and the head of marines, are just what they are.
The corporation head has eyes on gold, and that's his only concern.
The marines head has bulky muscles, and is all about toughness. The
hero, is just that, with good heart, and handsome to boot, courageous,
always miraculously succeeds against all odds, and gets his girl. The
heroin, in this case a alien race chick, is of course beautiful as
much beauty we can put on a feline humanoid. And what's she like?
Well, a beautiful woman, with concerns of loyalty of her man, love of
her family, her people, a caring of nature. Actually had sex with the
half-human half-alien hero. (inter-species porn anyone?)

--
Where is the Science in Sci-Fi?

What about the story line? Well, the human animals want this million-
dollar land inhabited by primitive tribes. The human animals created
what's called a “avatar”, which is a humanoid creature grown from bio-
tubes that has mixed DNA from humans and the native feline-like
humanoid aliens. The avatar is connected and controlled by a sleeping
human. When one is awake, the other goes to sleep. Thru the avatars,
it is thought that they can persuade the feline humanoids to move out.
But the diplomatic cunning didn't work out, of course, and violence is
resorted to. The hero fell in love with the heroin, and grew the sense
of American Justice, and defended the primitive feline-humanoids with
the help of miracle nature.

The Sci-Fi aspect of the avatar concept is all interesting. How does
the avatar work? How's it grown? How long does it take? How's the
technology to control or connect it? What's the biology of the alien?
What they eat? Well, this movie isn't concerned about these things,
only that these settings qualify it as Sci-Fi flick.

Another interesting aspect of sci-fi is that the plants and animals on
this alien place have some sort bio-wire grown from their body, that
allows direct animal-to-animal communication or animal-to-plant. For
example, the feline-humanoid can connect her bio-wire grown from her

Re: After C++, what with Python?

2011-01-15 Thread John Nagle

On 1/15/2011 9:30 PM, Aman wrote:

Hey all, I am a college student, and at college, we did most of the
work in C/C++. I kind of stopped using C when I learned C++ (simply
because C++ seemed a natural/elegant choice to me, and had backward
compatibility with C). I've had a lot of experience with C++.
Recently, I was on the path to learn a new programming language, and
after suggestion of some of my friends and consulting the web, I
chose to proceed with Python. I've finished with core Python and now
I'm going through the various inbuilt packages that Python provides.
I have an inquisitive mind, and while programming, I always want/tend
to make something that is out of the box. It would be great if you
people could guide me as to what to proceed with and how.


   If you know C++ well, and have a computer science background.
Python is trivial. Here's what you need to know:

   It's a safe dynamically typed imperative object oriented language,
with explicit classes.  The language is declaration-free and
block structure is defined by indentation.  Threading is supported
but thread concurrency is marginal.  The most common implementation is
a naive interpreter with reference counting backed up by a mark
and sweep garbage collector.  Performance is about 1/60 of
optimized C code.

   That's Python.

John Nagle





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


Re: After C++, what with Python?

2011-01-15 Thread Aman
@nagle Means you are suggesting me not to proceed with Python because I've had 
experience with C++?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: After C++, what with Python?

2011-01-15 Thread John Nagle

On 1/15/2011 10:48 PM, Aman wrote:

@nagle Means you are suggesting me not to proceed with Python because I've had 
experience with C++?


  No, Python is quite useful, but on the slow side.  If you're I/O
bound, not time critical, or otherwise not performance constrained,
it's quite useful.  The language is really quite good, but there's
some excessive dynamism which has caused every attempt at an optimizing
implementation to fail.

John Nagle

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


Re: Tkinter: The good, the bad, and the ugly!

2011-01-15 Thread Terry Reedy

On 1/15/2011 11:17 PM, rantingrick wrote:


Well Geremy the very first step a wise developer employs is to get an
idea of what the masses want and what they don't want.


'The masses' have so far been divided on what alternative they might 
want. In any case, open source developers are typically scratching their 
own itches, which may are may not be influenced by 'the masses'.



Nobody wants to waste a second (much less a whole year)

 developing a wxPython stdlib

module when the powers that be won't even *entertain* the idea of a
wxPython stdlib module.


As far as I know, no one has ever seriously proposed any replacement for 
tkinter in at least the last ten years. There has been nothing to 
entertain, review, or discuss, let alone approve or reject. (And if you 
propose to the PSF that developer X contribute his code, the answer will 
be to talk to developer X instead.) 'gui' does not appear in any PEP 
title (except as part of 'guide' or 'guideline'.


--
Terry Jan Reedy

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


Re: After C++, what with Python?

2011-01-15 Thread geremy condra
On Sat, Jan 15, 2011 at 9:30 PM, Aman aman.6...@gmail.com wrote:
 Hey all, I am a college student, and at college, we did most of the work in 
 C/C++. I kind of stopped using C when I learned C++ (simply because C++ 
 seemed a natural/elegant choice to me, and had backward compatibility with 
 C). I've had a lot of experience with C++.
 Recently, I was on the path to learn a new programming language, and after 
 suggestion of some of my friends and consulting the web, I chose to proceed 
 with Python. I've finished with core Python and now I'm going through the 
 various inbuilt packages that Python provides. I have an inquisitive mind, 
 and while programming, I always want/tend to make something that is out of 
 the box. It would be great if you people could guide me as to what to proceed 
 with and how.

Here's what I would do:

1. Start off slow; reimplement things you've written in other
languages until you're sure that you understand how Python constructs
differ from superficially similar things in C/C++.

2. Once you've done that, pick a few small tasks (things you would
expect to take about one or two weeks to finish), write all the
high-level architectural code, and then put together a test harness
for them using either unittest[0] or doctest[1]. Pick the one you're
most confident you can write the code for and keep at it until you
pass all your tests. Using the lessons learned from that, refactor the
code of the others and iterate until you feel comfortable thinking
about Python at a high level. As a bonus, you also now have a set of
medium-scale projects with good test harnesses to show off.

3. After you've convinced yourself you know how to write Python, learn
to read other peoples' Python code. Look for small projects (1-5 KLOC)
with 'easy' bugs, get familiar with them, and fix those bugs. It isn't
a race- make sure your work is high-quality, well-tested, and well
documented before you send it to the maintainers. As yet another
bonus, if those patches get accepted you'll be able to tell that to
potential employers.

At this point you'll probably have a much better idea of what you'd
like to do moving forward- you'll probably have found out what kinds
of problems you find interesting, which ones you have an aptitude for,
and what kinds of environments you like. In other words, you'll be
much better off than the vast majority of your peers ;)

Geremy Condra

[0]: http://docs.python.org/library/unittest.html
[1]: http://docs.python.org/library/doctest.html
-- 
http://mail.python.org/mailman/listinfo/python-list


[RELEASED] Python 3.2 rc 1

2011-01-15 Thread Georg Brandl
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On behalf of the Python development team, I'm very happy to announce the
first release candidate of Python 3.2.

Python 3.2 is a continuation of the efforts to improve and stabilize the
Python 3.x line.  Since the final release of Python 2.7, the 2.x line
will only receive bugfixes, and new features are developed for 3.x only.

Since PEP 3003, the Moratorium on Language Changes, is in effect, there
are no changes in Python's syntax and built-in types in Python 3.2.
Development efforts concentrated on the standard library and support for
porting code to Python 3.  Highlights are:

* numerous improvements to the unittest module
* PEP 3147, support for .pyc repository directories
* PEP 3149, support for version tagged dynamic libraries
* PEP 3148, a new futures library for concurrent programming
* PEP 384, a stable ABI for extension modules
* PEP 391, dictionary-based logging configuration
* an overhauled GIL implementation that reduces contention
* an extended email package that handles bytes messages
* a much improved ssl module with support for SSL contexts and certificate
  hostname matching
* a sysconfig module to access configuration information
* additions to the shutil module, among them archive file support
* many enhancements to configparser, among them mapping protocol support
* improvements to pdb, the Python debugger
* countless fixes regarding bytes/string issues; among them full support
  for a bytes environment (filenames, environment variables)
* many consistency and behavior fixes for numeric operations

For a more extensive list of changes in 3.2, see

http://docs.python.org/3.2/whatsnew/3.2.html

To download Python 3.2 visit:

http://www.python.org/download/releases/3.2/

Please consider trying Python 3.2 with your code and reporting any bugs
you may notice to:

http://bugs.python.org/


Enjoy!

- --
Georg Brandl, Release Manager
georg at python.org
(on behalf of the entire python-dev team and 3.2's contributors)

-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.16 (GNU/Linux)

iEYEARECAAYFAk0yn1QACgkQN9GcIYhpnLDTdACgqQYW5ZmTLlxmppBZItprSj7I
TmAAn13lgnu9TdVy0Jln7VwOt5JW9CwL
=VZ3p
-END PGP SIGNATURE-
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue9532] pipe.read hang, when calling commands.getstatusoutput in multi-threading code of python 2.4

2011-01-15 Thread Ross Lagerwall

Ross Lagerwall rosslagerw...@gmail.com added the comment:

After trying to reproduce this bug in 2.7.1  3.2b2 and failing, I think this 
should be closed (even the OP couldn't reproduce it in anything other than 2.4).

--
nosy: +rosslagerwall

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



[issue1535504] CGIHTTPServer doesn't handle path names with embeded space

2011-01-15 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Right, closing this one too.  Thanks!

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

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



[issue1602] windows console doesn't print or input Unicode

2011-01-15 Thread sorin

sorin sorin.sbar...@gmail.com added the comment:

remeber that cp65001 cannot be set on windows. Also please read 
http://blogs.msdn.com/b/michkap/archive/2010/10/07/10072032.aspx and contact 
the author, Michael Kaplan from Microsoft, if you have more questions. I'm sure 
he will be glad to help.

--

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



[issue10912] PyObject_RichCompare differs in behaviour from PyObject_RichCompareBool ; difference not noted in documentation

2011-01-15 Thread Eli Bendersky

Eli Bendersky eli...@gmail.com added the comment:

I agree that the difference in behavior between the two functions is 
unfortunate, but that's unlikely to change now.

The least we can do is make the documentation precise. I'm attaching a proposed 
patch to Doc/c-api/object.rst

Nick/Terry/Georg - if this looks OK I can commit.

--
keywords: +easy, patch
nosy: +eli.bendersky, ncoghlan, terry.reedy -Devin Jeanpierre
type:  - behavior
Added file: http://bugs.python.org/file20413/issue10912.py3k.1.patch

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



[issue10912] PyObject_RichCompare differs in behaviour from PyObject_RichCompareBool ; difference not noted in documentation

2011-01-15 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Sure.

--
nosy: +georg.brandl

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



[issue10912] PyObject_RichCompare differs in behaviour from PyObject_RichCompareBool ; difference not noted in documentation

2011-01-15 Thread Eli Bendersky

Eli Bendersky eli...@gmail.com added the comment:

Committed the fix to py3k in r88009

--

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



[issue10912] PyObject_RichCompare differs in behaviour from PyObject_RichCompareBool ; difference not noted in documentation

2011-01-15 Thread Eli Bendersky

Eli Bendersky eli...@gmail.com added the comment:

Backport to release31 branch in r88010

--
resolution:  - fixed
status: open - closed

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



[issue10913] Deprecate PyEval_AcquireLock() and PyEval_ReleaseLock()

2011-01-15 Thread Antoine Pitrou

New submission from Antoine Pitrou pit...@free.fr:

These two functions are very low-level and no good to use outside the 
interpreter core (actually, inside the core I don't think they are useful 
either). We should deprecate them and recommend the thread-state aware 
functions instead. See #1720250 for an example confusion.

--
assignee: pitrou
components: Documentation
messages: 126324
nosy: grahamd, pitrou
priority: high
severity: normal
status: open
title: Deprecate PyEval_AcquireLock() and PyEval_ReleaseLock()
type: behavior
versions: Python 3.2

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



[issue8754] ImportError: quote bad module name in message

2011-01-15 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Won't make it into 3.2.

--
priority: deferred blocker - high
versions: +Python 3.3 -Python 3.2

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



[issue3243] Support iterable bodies in httplib

2011-01-15 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Anything left to do here, Senthil?

--

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



[issue10913] Deprecate PyEval_AcquireLock() and PyEval_ReleaseLock()

2011-01-15 Thread Antoine Pitrou

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

Done in r88018.

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

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



[issue10914] Python sub-interpreter test

2011-01-15 Thread Antoine Pitrou

New submission from Antoine Pitrou pit...@free.fr:

Here is a prototype test for embedding and sub-interpreters.

--
components: Interpreter Core, Tests
files: embedtest.patch
keywords: patch
messages: 126328
nosy: christian.heimes, grahamd, haypo, loewis, pitrou
priority: normal
severity: normal
status: open
title: Python sub-interpreter test
versions: Python 3.2, Python 3.3
Added file: http://bugs.python.org/file20414/embedtest.patch

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



[issue1977] Python reinitialization test

2011-01-15 Thread Antoine Pitrou

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

See also #10914.

--

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



[issue10912] PyObject_RichCompare differs in behaviour from PyObject_RichCompareBool ; difference not noted in documentation

2011-01-15 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

For the record, the gory details as to *why* RichCompareBool makes more 
assumptions as to the meaning of equality than the basic RichCompare function 
can be found in issue 4296 (I just found that issue myself by looking at Mark's 
response to the python-list thread).

It may be worth explicitly pointing out that use cases where this assumption is 
unacceptable would be better served by direct invocation RichCompare function.

--
nosy: +mark.dickinson

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



[issue10912] PyObject_RichCompare differs in behaviour from PyObject_RichCompareBool ; difference not noted in documentation

2011-01-15 Thread Eli Bendersky

Eli Bendersky eli...@gmail.com added the comment:

Nick, I read the protocol of issue 4296 and I understand the reasoning behind 
the code, but I still think the naming is mightily confusing. Two distinct 
changes went into a single function (A) Return -1/0/+1 instead of PyObject and 
(B) the id() shortcut, and its name is inappropriate. Were an API change 
feasible, some other naming would be better.

 It may be worth explicitly pointing out that use cases where this assumption 
 is unacceptable would be better served by direct invocation RichCompare 
 function.

Do you mean write it down in the docs?

--

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



[issue10912] PyObject_RichCompare differs in behaviour from PyObject_RichCompareBool ; difference not noted in documentation

2011-01-15 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

Yeah, to prevent perfectly reasonable why questions, it is probably worth 
providing a little extra justification as an addendum to your new note (which 
is already an improvement on the complete silence on the topic that existed 
before).

A possible addition:

... This assumption allows invariants such as x in [x] to be more easily 
guaranteed by the interpreter. If the assumption is not valid for a given use 
case, call PyObject_RichCompare() directly instead of using this function.

For 3.3, it *may* make sense to provide a PyObject_RichCompareBoolEx() function 
which includes an additional reflexive parameter. Then the existing 
PyObject_RichCompareBool() semantics would just be the new function with the 
reflexive argument set to 1.

--

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



[issue10915] Make the PyGILState API compatible with multiple interpreters

2011-01-15 Thread Antoine Pitrou

New submission from Antoine Pitrou pit...@free.fr:

It should be relatively easy to devise a new PyGILState API with support for 
multiple interpreters. We just need two new functions (similar to the two 
existing ones) taking a PyInterpreterState* parameter; a TLS key can be added 
to the PyInterpreterState structure (instead of the current global TLS key).

It will be up to the caller to know which interpreter they want to hook into 
when calling these functions (which is application-dependent and is normally 
well-defined, e.g. when calling a Python callback, you should call it with the 
interpreter which was in use when registering the callback (i.e. 
``PyThreadState_Get()-interp``)).

--
components: Interpreter Core
messages: 126333
nosy: amaury.forgeotdarc, grahamd, loewis, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: Make the PyGILState API compatible with multiple interpreters
type: feature request
versions: Python 3.3

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



[issue10915] Make the PyGILState API compatible with multiple interpreters

2011-01-15 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +ncoghlan

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



[issue10914] Python sub-interpreter test

2011-01-15 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +amaury.forgeotdarc, ncoghlan

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



[issue10916] mmap segfault

2011-01-15 Thread Ross Lagerwall

New submission from Ross Lagerwall rosslagerw...@gmail.com:

If a mmap length 0 is used and an offset is used as well, the size to mmap() is 
calculated as the size of the file instead of the size of the file minus 
offset. This means that trying to access a certain part does not result in an 
index error but a segfault (bus error).

Attached is a patch that fixes the issue + a unit test.

--
components: Extension Modules
files: mmap.patch
keywords: patch
messages: 126334
nosy: amaury.forgeotdarc, loewis, pitrou, r.david.murray, rosslagerwall
priority: normal
severity: normal
status: open
title: mmap segfault
type: crash
versions: Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file20415/mmap.patch

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



[issue5800] make wsgiref.headers.Headers accept empty constructor

2011-01-15 Thread SilentGhost

Changes by SilentGhost ghost@gmail.com:


--
status: open - languishing

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



[issue10915] Make the PyGILState API compatible with multiple interpreters

2011-01-15 Thread Antoine Pitrou

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

Here is a sketch, including conversion of ctypes to the new API.
Converting sqlite would require a bit more work.

--
keywords: +patch
Added file: http://bugs.python.org/file20416/gilstateinterp.patch

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



[issue9532] pipe.read hang, when calling commands.getstatusoutput in multi-threading code of python 2.4

2011-01-15 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
resolution:  - out of date
stage:  - committed/rejected
status: open - closed

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



[issue10908] Improvements to trace._Ignore

2011-01-15 Thread SilentGhost

SilentGhost ghost@gmail.com added the comment:

The patch aside from fixing directory names on case-insensitive file systems, 
also:
 * implements more efficient handling of directory and module comparison (put 
into _Ignoore.__init__ instead of _Ignore.names).
 * changes integer return codes to boolean
 * doesn't require any more that the directory is actually a directory name.
 * moves --ignore-dir processing into a directory so that it can be expanded if 
$prefix support on windows is needed.
 * adds tests.

--
stage:  - patch review

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



[issue10916] mmap segfault

2011-01-15 Thread Antoine Pitrou

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

Thanks for the patch. Committed in r88022 (3.2), r88023 (3.1) and r88024 (2.7).

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

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



[issue10896] trace module compares directories as strings (--ignore-dir)

2011-01-15 Thread SilentGhost

Changes by SilentGhost ghost@gmail.com:


--
status: closed - open

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



[issue10908] Improvements to trace._Ignore

2011-01-15 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


--
nosy: +eli.bendersky

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



[issue10896] trace module compares directories as strings (--ignore-dir)

2011-01-15 Thread SilentGhost

Changes by SilentGhost ghost@gmail.com:


--
nosy:  -SilentGhost

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



[issue10908] Improvements to trace._Ignore

2011-01-15 Thread SilentGhost

Changes by SilentGhost ghost@gmail.com:


--
dependencies: +trace module compares directories as strings (--ignore-dir)
type:  - performance

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



[issue10915] Make the PyGILState API compatible with multiple interpreters

2011-01-15 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


Removed file: http://bugs.python.org/file20416/gilstateinterp.patch

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



[issue10915] Make the PyGILState API compatible with multiple interpreters

2011-01-15 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
stage: needs patch - patch review
Added file: http://bugs.python.org/file20417/gilstateinterp.patch

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



[issue10694] zipfile.py end of central directory detection not robust

2011-01-15 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Not important enough to block release.

--
priority: deferred blocker - critical

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



[issue3243] Support iterable bodies in httplib

2011-01-15 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
priority: deferred blocker - critical

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



[issue8746] os.chflags() and os.lchflags() are not built when they should be be

2011-01-15 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
priority: deferred blocker - critical

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



[issue10736] test_ttk_guionly fails on OS X using ActiveState Tcl 8.5.9 (Cocoa)

2011-01-15 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
priority: deferred blocker - critical

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



[issue10734] test_ttk failure under Windows

2011-01-15 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
priority: deferred blocker - critical

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



[issue8957] strptime(.., '%c') fails to parse output of strftime('%c', ..) in some locales

2011-01-15 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

On Sat, Jan 15, 2011 at 2:20 AM, Eli Bendersky rep...@bugs.python.org wrote:
..
 This solution is a hack, but so is the whole __calc_date_time function :-) 
 [IMHO]


I am not sure how to proceed.   On one hand, I opened this issue to
demonstrate that the current implementation is flawed, on the other
hand, Eli has succeeded in improving the hack so that we can live with
it a bit longer.  Note that I did not have any real life application
that would misbehave because of this bug and I don't think developers
expect %c format to be parseable in the first place.

I made this issue depend on #8915 because I think strptime should
query the locale for format information directly rather than reverse
engineer what strftime does.

I don't think this fix solves all the problems.  For example, in most
locales (including plain C locale), day of the month in %c format uses
%e format, but current implementation guesses it as %d:

'%a %b %e %H:%M:%S %Y'
 LocaleTime().LC_date_time
'%a %b %d %H:%M:%S %Y'

This does not seem to be an issue because strptime with %d seems to be
able to parse space-filled as well as zero-filled numbers.  However,
there may be platforms that are less forgiving.

On the patch itself:

1. Unit tests are needed.

2. Please don't use datetime as a local variable.

3. I am not sure what the purpose of .lower() is.  Are a_month and
f_month lowercased?

4. Please keep lines under 79 characters long.

5. for m in range(1, 13) loop is better written as for am, fm in
zip(self.a_month, self.f_month)

Eli, what do you think yourself:  should we try to perfect the hack or
is it better to reimplement strptime using locale?  Note that the
latter may be a stepping stone to implementing strftime as well.

--

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



[issue8957] strptime(.., '%c') fails to parse output of strftime('%c', ..) in some locales

2011-01-15 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

6. datetime.find(self.f_month[m]) = 0 - self.f_month[m] in datetime

Python is not C!

--

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



[issue2275] urllib2 header capitalization

2011-01-15 Thread Rui Carmo

Rui Carmo rca...@gmail.com added the comment:

I'd like to add that when supplying custom headers for things like UPNP (which 
uses SOAPACTION as a header to talk to frequently very limited servers), the 
library shouldn't mangle the headers in any way whatsoever and send them 
verbatim. 

(I consider that mangling to be a bug, and not a new feature. HTTP headers may 
be case-insensitve according to standards, but embedded implementations require 
us to have a degree of control over the headers, and failing to preserve header 
case is a bug.)

Right now I've had to replace httplib and urllib2 with my own custom code 
because the SOAPACTION header is capitalized and sent to the server as 
Soapaction, which breaks the Intel embedded UPNP daemon.

--
nosy: +Rui.Carmo
type: feature request - behavior
versions: +Python 2.7 -Python 3.3

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



[issue3243] Support iterable bodies in httplib

2011-01-15 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

Hi Georg,

In the previous comment, I had written that

'let me see if we have to accommodate those very special case
where data can be a zero length string just to accommodate the mistake
it was present in the earlier version.'

More, I think about it, the more it seems to me that accommodating that
special wrong case is not required.

The decision boils down to this.

1. In py3k, data for POST should be bytes.

2. But urllib.request had a 'bug/hole' that when a zero length string
was passed as a data, it did not raise an exception. There were cases
in test_urllib2 where zero length string was passed. I argue that it
was more of a mistake than, what we actually wanted to test it.

Because there is NO practical scenario where Zero length data as a
POST is useful.

3. Now, with the introduction of this feature requested in this issue,
this zero length string would raise an Exception and would demand that
even if it is zero length, please send it as bytes.

IMO, this is correct behavior and we need not accommodate the previous
one. 

So, I would recommend closing this bug as Fixed without further change.
At most, a NEWS item can be added to explain point 2.

--

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



[issue10916] mmap segfault

2011-01-15 Thread Antoine Pitrou

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

It also needed fixing on Windows: committed in r88036, r88037 and r88038.

--

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



[issue3243] Support iterable bodies in httplib

2011-01-15 Thread Xuanji Li

Xuanji Li xua...@gmail.com added the comment:

Yes, I think we should close it.

--

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



[issue8957] strptime(.., '%c') fails to parse output of strftime('%c', ..) in some locales

2011-01-15 Thread Eli Bendersky

Eli Bendersky eli...@gmail.com added the comment:

Alexander,

1) Patch comments - thanks for those. Will have them fixed.
2) General strategy for implementing strptime. I must confess I don't fully 
understand the reason for doing what the _strptime module does. Standard C 
AFAIK has nothing of the sort - it only has strftime and strptime, both using a 
given format string. Neither tries to guess it from an actual formatted time! 
Does it exist just to circumvent platforms where strptime isn't implemented in 
C or is buggy? Can you please shed some light on this (or point me somewhere)?

With understanding of (2) I will be able to also logically reason about the 
next steps :-)

--

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



[issue3243] Support iterable bodies in httplib

2011-01-15 Thread Senthil Kumaran

Senthil Kumaran orsent...@gmail.com added the comment:

Thanks for the note. I shall some details to the NEWS entry before the release. 
Closing this report.

--
priority: critical - low
status: open - closed

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



[issue3243] Support iterable bodies in httplib

2011-01-15 Thread Senthil Kumaran

Changes by Senthil Kumaran orsent...@gmail.com:


--
priority: low - normal

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



[issue8957] strptime(.., '%c') fails to parse output of strftime('%c', ..) in some locales

2011-01-15 Thread Alexander Belopolsky

Alexander Belopolsky alexander.belopol...@gmail.com added the comment:

You pretty much hit the nail on the head. Some platforms don't  have strptime 
or did not have it at the time this code was written. The locale module is 
probably more recent than this code as well.

--
nosy: +Alexander.Belopolsky

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



[issue10912] PyObject_RichCompare differs in behaviour from PyObject_RichCompareBool ; difference not noted in documentation

2011-01-15 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +Devin Jeanpierre

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



[issue10915] Make the PyGILState API compatible with multiple interpreters

2011-01-15 Thread Graham Dumpleton

Graham Dumpleton graham.dumple...@gmail.com added the comment:

Can you please provide an example of what user would do and what changes 
existing extension modules would need to make?

When I looked at this exact problem some time back, I worked out that you 
probably only need a single new public API function. This would be something 
like PyInterpreterState_Swap().

By default stuff would work on the main interpreter, but if for a specific 
thread it wanted to operate in context of a different sub interpreter, would 
call PyInterpreterState_Swap() to indicate that. That would store in TLS 
outside of any existing data structures. Functions like existing 
PyGILState_Ensure()/PyGILState_Release() would then look up that TLS variable 
to know which interpreter they are working with.

Doing it this way meant that no C extension modules using PyGILState_??? 
functions would need to change at all, as what interpreter is being operated on 
dictated by who created the thread and initiated call in to Python interpreter.

You probably want validation checks to say that PyInterpreterState_Swap() can 
only be called when not GIL lock held.

It worries me that you are talking about new PyGILState_??? functions as that 
would suggest to me that extension modules would need to change to be aware of 
this stuff. That you are saying that sqlite needs changes is what makes me 
things the way you are going is a problem. It isn't practical to make SWIG 
change to use something other than PyGILState_Ensure()/PyGILState_Release(), it 
should be transparent and required no changes to existing C extensions.

--

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



[issue10915] Make the PyGILState API compatible with multiple interpreters

2011-01-15 Thread Antoine Pitrou

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

 Can you please provide an example of what user would do and what
 changes existing extension modules would need to make?

The patch contains such a change for ctypes. It's quite simple actually.

 By default stuff would work on the main interpreter, but if for a
 specific thread it wanted to operate in context of a different sub
 interpreter, would call PyInterpreterState_Swap() to indicate that.
 That would store in TLS outside of any existing data structures.
 Functions like existing PyGILState_Ensure()/PyGILState_Release() would
 then look up that TLS variable to know which interpreter they are
 working with.

That sounds like an ugly hack to avoid passing the desired interpreter
state directly to PyGILState_Ensure()/PyGILState_Release().

Besides, it will only work if a thread always serves the same
sub-interpreter.

 Doing it this way meant that no C extension modules using
 PyGILState_??? functions would need to change at all, as what
 interpreter is being operated on dictated by who created the thread
 and initiated call in to Python interpreter.

Who would do that, if it's not the extensions in question?
who created the thread is often a third-party library (e.g. sqlite)
that has no notion of a Python interpreter. That's the whole point of
using the PyGILState_* API, really. So extensions *will* have to be
fixed.

 That you are saying that sqlite needs changes is what makes me things
 the way you are going is a problem. It isn't practical to make SWIG
 change to use something other than
 PyGILState_Ensure()/PyGILState_Release(), it should be transparent and
 required no changes to existing C extensions.

What does SWIG use them for?

--

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



[issue10912] PyObject_RichCompare differs in behaviour from PyObject_RichCompareBool ; difference not noted in documentation

2011-01-15 Thread Raymond Hettinger

Changes by Raymond Hettinger rhettin...@users.sourceforge.net:


--
nosy: +rhettinger

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



[issue10912] PyObject_RichCompare differs in behaviour from PyObject_RichCompareBool ; difference not noted in documentation

2011-01-15 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

-1 on PyObject_RichCompareBoolEx() for 3.3 -- it is simply an invitation to 
shoot yourself (or others) in the foot.

I've not seen real world code using bool(a==b) or its C equivalent, so it's 
hard to believe that there is a use case here (unless you're trying to commit 
atrocities with NaN-like objects).

--

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



[issue10915] Make the PyGILState API compatible with multiple interpreters

2011-01-15 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

A TLS based approach would presumably allow an embedding application like 
mod_wsgi to tinker with the state of threads created by naive modules that are 
unaware of the existence of subinterpreters.

That said, I don't see anything that prevents us from pursuing a TLS based 
override for the existing PyGILState functions later if the simpler, more 
explicit approach proves inadequate. As it stands, the new explicit calls allow 
something like mod_wsgi to define its *own* TLS location for the interpreter 
that is currently handling callbacks into Python, then use SWIG to generate 
PyGILState_*Ex calls in callback wrappers that reference that TLS interpreter 
state.

--

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



[issue10912] PyObject_RichCompare differs in behaviour from PyObject_RichCompareBool ; difference not noted in documentation

2011-01-15 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

Indeed. I was actually wondering if it would be worth trying to write up a 
section for the language reference to describe the cases where a Python 
implementation is *expected* to assume reflexive equality. We (IMO) have a 
problem at the moment due to situations like:

 class PyContains(list):
...   def __contains__(self, obj):
... return any(x==obj for x in self)
... 
 nan = float(nan)
 nan in [nan]
True
 nan in PyContains([nan])
False

This is a bug in the __contains__ definition (it should use x is obj or x == 
obj rather than just the latter expression) but there isn't anything in the 
language reference to point that out.

Assuming reflexive equality in some places and not in others based on the 
underlying implementation language is going to be a source of subtle bugs 
relating to types like float and decimal.Decimal.

--

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



[issue10903] ZipExtFile:_update_crc fails for CRC = 0x80000000

2011-01-15 Thread Nadeem Vawda

Nadeem Vawda nadeem.va...@gmail.com added the comment:

I have been unable to reproduce this on either 3.2rc1 or 2.6. I used a Zip 
archive containing a single file with the data ba\n (CRC 0xDDEAA107).

--
nosy: +nvawda

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



[issue10915] Make the PyGILState API compatible with multiple interpreters

2011-01-15 Thread Antoine Pitrou

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

 A TLS based approach would presumably allow an embedding application
 like mod_wsgi to tinker with the state of threads created by naive
 modules that are unaware of the existence of subinterpreters.

The question is how mod_wsgi could know about the existence of these
threads, let alone decide which subinterpreter an arbitrary OS thread
should belong to; only the extension module can safely tell.
And it becomes totally hopeless if those threads are actually *shared*
between subinterpreters, as might be the case with a 3rd-party library
managing its own helper threads (I don't know if that's the case with
sqlite).

IMO we should really promote clean APIs which allow solving the whole
problem, rather than devise an internal hack to try to improve things
slightly.

--

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



[issue10915] Make the PyGILState API compatible with multiple interpreters

2011-01-15 Thread Graham Dumpleton

Graham Dumpleton graham.dumple...@gmail.com added the comment:

The bulk of use cases is going to be simple callbacks via the same thread that 
called out of Python in the first place. Thus ultimately all it is doing is:

Py_BEGIN_ALLOW_THREADS

Call into some foreign C library.
C library wants to do a callback into Python.

PyGILState_STATE gstate;
gstate = PyGILState_Ensure();

/* Perform Python actions here. */
result = CallSomeFunction();
/* evaluate result or handle exception */

/* Release the thread. No Python API allowed beyond this point. */
PyGILState_Release(gstate);

More stuff in C library.
Return back into the C extension wrapper.

Py_END_ALLOW_THREADS

This is what SWIG effectively does in its generated wrappers for callbacks.

Using a TLS solution, all these modules that simply do this will now start 
working where as they currently usually deadlock or have other problems.

In your solution, all these modules would need to be modified to some how 
transfer information about the current interpreter into the callback which is 
called by the foreign C library and use new PyGILState_??? functions rather 
than the old.

I do accept that more complicated extension modules which create their own 
foreign threads and perform the call back into interpreter from that thread, or 
systems like mod_wsgi which have a persistent thread pool from which calls 
originate, will have to be modified, but this is the lessor use case from what 
I have seen.

Overall, it is an easy win if TLS is used because a lot of code wouldn't need 
to change. Some will, but expect that a lot of the common stuff like lxml for 
example wouldn't.

--

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



[issue10912] PyObject_RichCompare differs in behaviour from PyObject_RichCompareBool ; difference not noted in documentation

2011-01-15 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

If something needs to be written about NaNs or other invariant destroying 
objects, perhaps a FAQ entry would suffice (perhaps referencing 
http://bertrandmeyer.com/2010/02/06/reflexivity-and-other-pillars-of-civilization/
 ).

--
assignee: docs@python - rhettinger
keywords:  -easy

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



[issue10915] Make the PyGILState API compatible with multiple interpreters

2011-01-15 Thread Graham Dumpleton

Graham Dumpleton graham.dumple...@gmail.com added the comment:

As to the comment:

IMO we should really promote clean APIs which allow solving the whole
problem, rather than devise an internal hack to try to improve things
slightly.

The reality is that if you force a change on every single extension module 
doing callbacks into the interpreter without having the GIL first, you will 
never see people update their code as they will likely not care about this 
special use case. And so the whole point of adding the additional APIs will be 
wasted effort and have achieved nothing.

The TLS solution means many modules will work without the authors having to do 
anything.

You therefore have to balance between what you perceive as a cleaner API and 
what is actually going to see a benefit without having to wait a half dozen 
years before people realise they should change their ways.

BTW, TLS is currently used for current thread state for simplified GIL API, why 
isn't that use of TLS a hack where as doing the same for interpreter is?

--

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



[issue8957] strptime(.., '%c') fails to parse output of strftime('%c', ..) in some locales

2011-01-15 Thread Eli Bendersky

Eli Bendersky eli...@gmail.com added the comment:

Alexander, but still - this isn't just an implementation of strptime. strptime, 
AFAIU strptime gets the format string as a parameter and uses it to parse a 
date string into a tm struct. So why do we need to parse a date string 
*without* a format string in Python, resorting to heuristics and pseudo-AI 
instead?

--

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



[issue10912] PyObject_RichCompare differs in behaviour from PyObject_RichCompareBool ; difference not noted in documentation

2011-01-15 Thread Eli Bendersky

Eli Bendersky eli...@gmail.com added the comment:

Raymond, 
I initially set easy on this issue because I considered it a documentation 
issue, not the place to resolve the harder debate of the semantics of these 
functions. Perhaps I was wrong?

Also, I agree with Nick that the difference must be further clarified in 
stronger words. If there's no debate on this issue, I will commit a fix after 
the freeze is over.

--

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



[issue10912] PyObject_RichCompare differs in behaviour from PyObject_RichCompareBool ; difference not noted in documentation

2011-01-15 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

Yes, it is a doc issue but sometimes those aren't easy to get right (in terms 
of being beneficial to the reader and in good alignment with the design 
intentions).  Please attach the doc patch you want to go in and I'll review it 
sometime the freeze.

--
priority: normal - low

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



[issue10917] PEP 333 link to CGI specification is broken

2011-01-15 Thread anatoly techtonik

New submission from anatoly techtonik techto...@gmail.com:

http://www.python.org/dev/peps/pep-0333/#id7

Link to CGI spec is broken.

--
assignee: docs@python
components: Documentation
messages: 126361
nosy: docs@python, techtonik
priority: normal
severity: normal
status: open
title: PEP 333 link to CGI specification is broken
versions: 3rd party, Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 
3.2, Python 3.3

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



  1   2   >