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

2010-12-31 Thread Owen Jacobson

On 2010-12-30 19:43:21 -0500, Gerry Reno said:


For those that are lurking, this might provide a little background:

http://journal.dedasys.com/2010/03/30/where-tcl-and-tk-went-wrong



Essentially, there is nothing wrong with Tcl and Tkinter.  They are
part of a long evolutionary chain of how we got to where we are today.
They deserve to be respected for the contributions that they have made.

The question now is whether Python needs to evolve its own GUI toolset.


My two cents, given freely: I'd rather have better integration with 
each platform's GUI libraries and desktop services than one 
cross-platform GUI library. There are so many fundamental differences 
in accepted behaviour between each of the major GUI platforms (Gnome, 
KDE, Mac OS, and Windows, at minimum; you could include Blackberry, 
iOS, and Android in here as well, if you wanted something really 
different) that being able to put the same window with the same widgets 
on all of them is of limited value.


Consider Java's Swing toolkit - a passable cross-platform GUI library, 
whether you like its API or not. Swing apps almost *never* feel as 
pleasant to use as a native application, even on modern JVMs where 
performance isn't the problem and even using the native look  feel. 
Little things like keyboard shortcut conventions, mouse button 
conventions, and menu organization guidelines don't quite mesh. Then 
there are more complex issues, like process management, library 
packaging, software updates, and user notification, where the 
conventions on each platform differ more dramatically.


Python's native UI capabilities, on the other hand, give programmers 
the tools they need to write the core of their application using 
portable code while being able to write a UI (or UIs) that actually 
takes advantage of the underlying platform's features and that plays 
nicely with the underlying platform's conventions and interfaces - all 
without switching languages. I don't see having to maintain two or 
three UI codebases as being that much worse than riddling a single UI 
codebase with conditionals or extension points for handling each 
platform's idiosyncracies.


Fortunately for me and my opinions, Python is already shaped like that. 
PyObjC provides bindings for writing OS X applications; PyGTK and PyQt 
support Gnome and KDE respectively (as well as any other X11 desktop); 
PyWin32 provides passable support for Windows UIs, or you can use 
IronPython and .Net's GUI APIs. It is absolutely zero skin off of my 
nose if someone decides I'm utterly out of my tree, figures out that 
cross-platform GUIs are the future, and goes on to write an amazing 
pure-Python GUI stack that works everywhere with a colour monitor.


Cheers,

-o

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


Re: Python3 Web Framework

2010-12-31 Thread Alice Bevan–McGregor

On 2010-12-30 23:47:17 -0800, Aman said:

Hey all... I just started with Python, and I chose Python3 because it 
seemed a subtle choice as compared to doing Pthon 2.x now and then 
porting to Python3.x later... I plan to start with Web Development 
soon... I wanted to know what all web frameworks are available for 
Python3... I heard the Django is still not compatible with 3.x... Any 
idea guys?


Python 3 has a number of issues with web development thus far: WSGI[1] 
(PEP 333) isn't directly compatible with Python 3, for one.


However, PEP  is looking good[2] for making web framework code 
compatible with Python 3 without needing too much modification.  I'm 
not sure what the state of affairs is for PEP  or Python 3 
compatible frameworks, however.  (CherryPy -might- be compatible, I can 
not recall.)


Basically this means that using Python 3, you'll be roughing it for a while.

On the other hand, I'm working on PEP 444[3] (WSGI 2) and have a highly 
performant web server compatible with Python 3 available[4] that is 
compatible with PEP 444 as published on Python.org[5] (master branch) 
and with my rewritten draft (draft branch, to be merged when my rewrite 
is complete and published on Python.org).  Another developer and I have 
been working on the WebOb-style helper exceptions and wrappers, from 
which a microframework can quickly spawn.


The HTTP server has 100% coverage (master) and near-100% coverage 
(draft) and compatibility with Python 2.6+ and 3.1+.


Have a great day,

- Alice.

[1] http://www.python.org/dev/peps/pep-0333/
[2] http://www.python.org/dev/peps/pep-/
[3] http://bit.ly/e7rtI6
[4] http://bit.ly/fLfamO
[5] http://bit.ly/gmT17O


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


ANN: stats0.1.2a calculator statistics for Python

2010-12-31 Thread Steven D'Aprano
I am pleased to announce the third public release of stats for Python. 
This is a minor point release, mostly consisting of improved tests and 
documentation, plus the addition of six new statistics functions:

midhinge, quartile_skewness, cumulative_sum, running_sum, stderrskewness, 
stderrkurtosis.

http://pypi.python.org/pypi/stats

stats is a pure-Python module providing basic statistics functions 
similar to those found on scientific calculators. It has over 40 
statistics functions, including:

Univariate statistics:
  * arithmetic, harmonic, geometric and quadratic means
  * median, mode, midrange, trimean
  * mean of angular quantities
  * running and weighted averages
  * quartiles, hinges and quantiles
  * variance and standard deviation (sample and population)
  * average deviation and median average deviation (MAD)
  * skewness and kurtosis
  * standard error of the mean

Multivariate statistics:
  * Pearson's correlation coefficient
  * Q-correlation coefficient
  * covariance (sample and population)
  * linear regression
  * sums Sxx, Syy and Sxy

and others.


This is an unstable alpha release of the software. Feedback and 
contributions are welcome.



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


Re: Change in scope of handled exception variable in Python 3?

2010-12-31 Thread Peter Otten
Baptiste Lepilleur wrote:

 I stumbled on a small bug with httplib2 that I reduced to the example
 below.
 
 It seems that with Python 3, when an exception is handled it unbound the
 previously declared local variable. This did not occurs with Python 2.5.
 
 It is a Python 3 feature? I did not find anything in the what's news, but
 it's hard to search... (notes: I'm using Python 3.1.2)
 
 ---
 def main():
 msg = 'a message'
 try:
 raise ValueError( 'An error' )
 except ValueError as msg:
 pass
 return msg
 
 main()
 
 python localmask.py
 Traceback (most recent call last):
   File localmask.py, line 12, in module
 main()
   File localmask.py, line 10, in main
 return msg
 UnboundLocalError: local variable 'msg' referenced before assignment
 ---

Yes, that's intentional, see

http://docs.python.org/dev/py3k/whatsnew/3.0.html#changes-to-exceptions
http://www.python.org/dev/peps/pep-3110/#semantic-changes

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


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

2010-12-31 Thread python
Rick,

 However, now Tkinter just looks old and dumpy.

Have you taken a look at the ttk module (based on tile) that ships with
Python 2.7/3.1? This adds native/theme-aware widgets to Tkinter. And it
adds additional widgets such as a treeview (which can also be used as a
grid), notebook, progressbar, scales, panedwindow (splitters), etc.

The widgets in ttk match each platform's standards and look as
professional as the equivalents found in wxPython/pyQt. Take a look at
the screenshots on this rather long page to get an idea of what is now
possible - out-of-box with Python 2.7/3.1.
http://www.tkdocs.com/tutorial/onepage.html

I've done GUI development in wxPython and pyQt, and until recently
*never* considered Tkinter. Once I saw what was possible with the ttk
module, I've started moving a lot of new GUI projects from these other
platforms back to Tkinter/ttk (enhanced with PIL module).

Why Tkinter/ttk vs. wxPython or pyQt
- professional looking apps are now possible (really!)
- very light weight install and distribution 
- works with both 2.x/3.x (not possible with wx)
- very robust (wx can be finicky at times)

Subjective: I also prefer Tk's geometry managers to wx's sizers even
though I learned sizers first.

You seem to be very enamored with wxPython. What have you found in
wxPython that's not available with the latest versions of Tkinter/ttk
other than an AUI equivalent and better support for RTL languages?

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


Re: I am not able to verify the integrity of python.2.5.4.msi

2010-12-31 Thread Alexander Gattin
Hello,

On Sun, Dec 26, 2010 at 05:44:22AM +0530, Varuna
Seneviratna wrote:
  D:\Pythongpg --verify python-2.5.4.msi.asc
 gpg: no valid OpenPGP data found.
 gpg: the signature could not be verified.
 Please remember that the signature file (.sig or .asc)
 should be the first file given on the command line
 
 What am I doing wrong in this process?

probably you should try to perform LF=CRLF
conversion on the downloaded python-2.5.4.msi.asc
file

-- 
With best regards,
xrgtn
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python3 Web Framework

2010-12-31 Thread Terry Reedy

On 12/31/2010 3:47 AM, Alice Bevan–McGregor wrote:


Python 3 has a number of issues with web development thus far:


I believe some will be improved or even solved in 3.2.

--
Terry Jan Reedy


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


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

2010-12-31 Thread flebber
On Dec 31, 3:04 pm, Robert sigz...@gmail.com wrote:
 On 2010-12-30 22:28:39 -0500, rantingrick said:

   On Dec 30, 8:41�pm, Robert sigz...@gmail.com wrote:
  On 2010-12-30 19:46:24 -0500, rantingrick said:
  Just to clarify...I like Python. I am learning it at the moment.

  Glad to have you aboard Robert!

 Thanks!



  3. What is your opinion of Tkinter as to it's usefulness within the
  stdlib?

  No, I really don't see the need for it to be in the stdlib but that
  isn't my call.

  But it is your call Robert. Anyone who writes Python code --whether
  they be a beginner with no prior programming experience or a fire
  breathing Python Guru-- has a right to inject their opinion into th
  community. We really need input from first time users as they carry
  the very perspective that we have completely lost!

 I speak up.  :-)





  5. Should Python even have a GUI in the stdlib?

  I would say no but that is my opinion only and it doesn't matter.
  Python's domain isn't GUI programming so having it readily available on
  the sidelines would be fine for me.

  I agree that Python's domain is not specifically GUI programming
  however to understand why Tkinter and IDLE exists you need to
  understand what Guido's dream was in the beginning. GvR wanted to
  bring Programming to everyone (just one of his many heroic goals!). He
  believed (i think) that GUI programming is very important , and that
  was 20 years ago!!. So he included Tkinter mainly so new Python
  programmers could hack away at GUI's with little or no effort. He also
  created a wonderful IDE for beginners called IDLE. His idea was
  perfect, however his faith in TclTk was flawed and so we find
  ourselves in the current situation we have today. With the decay of
  Tkinter the dream has faded. However we can revive this dream and
  truly bring Python into the 21st century!

 I don't think Tkinter was in there for large programming. Tkinter is
 crufty and probably should be moved out. For whipping up quick gui
 things to scratch an itch it is good.

 I lurk more on the Tcl side of things. When the mention of separating
 Tcl and Tk development, I fall on the side of separating them. Tcl,
 like Python should stand on its own. Widget frameworks are extras to
 me. One way the Tcl community has stagnated has been its insistence
 on Tk. There was a wxTcl project...it died. That would have been good
 for the Tcl community. Luckily there is a GTk framework (Gnocl) that is
 really good. But it still doesn't get the props that it deserves. The
 second way the Tcl community irks me is the not invented here
 attitude. I like the syntax of Tcl and I like the community. They are
 some good folks. Try asking I want to build a Nagios clone in Tcl
 type question and invariably you get Why? There is already Nagios?.
 That stems from the glue language roots I think but to me that is the
 wrong attitude. You want people to take a look at a language (any
 language), you build stuff with it that people want to use. Ruby would
 not be as big as it is if Rails hadn't come along.

 Nuff of that...  ;-)





  6. If Python should have a GUI, then what traits would serve our
  community best?

  This is a good one.

  It should be:

  - cross platform
  - Pythonic
  - as native as possible

  Cross platform and native are hard. Just look at all the work with
  PyQt/PySide and wxPython. It took them years to get where they are.

  Hmm, wxPython is starting to look like the answer to all our problems.
  WxPython already has an IDE so there is no need to rewrite IDLE
  completely. What do we have to loose by integrating wx into the
  stdlib, really?

 wxPython is really good. The downside is that is shows (or did show)
 its C++ roots.

 Nokia is making a run with PySide (their version of the PyQt framework)
 and since it has a company behind it might go pretty far. Qt can be
 used for a lot of problem domains.

 Anyway, I wasn't meaning to be rough with you. Just trying to figure
 out where you were coming from. I am acquianted with Kevin Walzer and
 he is a good guy.

 --
 Robert

I thank this thread for putting me onto Pyside +1

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


Re: User input masks - Access Style

2010-12-31 Thread flebber
On Dec 28 2010, 12:21 am, Adam Tauno Williams awill...@whitemice.org
wrote:
 On Sun, 2010-12-26 at 20:37 -0800, flebber wrote:
  Is there anyay to use input masks in python? Similar to the function
  found in access where a users input is limited to a type, length and
  format.

 http://faq.pygtk.org/index.py?file=faq14.022.htpreq=show

 Typically this is handled by a callback on a keypress event.

Can I get some clarification on the re module specifically on matching
string

Line 137 of the Re module

def match(pattern, string, flags=0):
Try to apply the pattern at the start of the string, returning
a match object, or None if no match was found.
return _compile(pattern, flags).match(string)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: User input masks - Access Style

2010-12-31 Thread flebber
On Dec 28 2010, 12:21 am, Adam Tauno Williams awill...@whitemice.org
wrote:
 On Sun, 2010-12-26 at 20:37 -0800, flebber wrote:
  Is there anyay to use input masks in python? Similar to the function
  found in access where a users input is limited to a type, length and
  format.

 http://faq.pygtk.org/index.py?file=faq14.022.htpreq=show

 Typically this is handled by a callback on a keypress event.

Sorry

Regarding 137 of the re module, relating to the code above.

# validate the input is in the correct format (usually this would be
in
# loop that continues until the user enters acceptable data)
if re.match(r'''^[0-9]{2}:[0-9]{2}:[0-9]{2}$''', timeInput) == None:
print(I'm sorry, your input is improperly formated.)
sys.exit(1)

EDIT: I just needed to use raw_input rather than input to stop this
input error.

Please enter time in the format 'MM:SS:HH':
11:12:13
Traceback (most recent call last):
  File C:\Documents and Settings\renshaw\workspace\Testing\src
\Time.py, line 13, in module
timeInput = input()
  File C:\Eclipse\plugins\org.python.pydev_1.6.3.2010100422\PySrc
\pydev_sitecustomize\sitecustomize.py, line 176, in input
return eval(raw_input(prompt))
  File string, line 1
11:12:13
  ^
SyntaxError: invalid syntax

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


Re: Python3 Web Framework

2010-12-31 Thread Martin v. Loewis
Am 31.12.2010 08:47, schrieb Aman:
 Hey all... I just started with Python, and I chose Python3 because it
 seemed a subtle choice as compared to doing Pthon 2.x now and then
 porting to Python3.x later... I plan to start with Web Development
 soon... I wanted to know what all web frameworks are available for
 Python3... I heard the Django is still not compatible with 3.x... Any
 idea guys?

You could try my port of Django to Py3k:

https://bitbucket.org/loewis/django-3k

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


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

2010-12-31 Thread Adam Skutt
On Dec 31, 12:21 am, rantingrick rantingr...@gmail.com wrote:

 Of course a tiny widget set like this is not going to handle extensive
 GUI coding, thats a no brainer.

No, it's not going to handle any GUI coding except notepad.exe.
That's already been written, so we're left with no new application
that can be written with this proposed minimal widget set. Why do you
think Tix exists?  Why do you think there are Python bindings for it
in the standard library (to say nothing of a bunch of other additional
Tk controls)?

 But currently that is EXACTLY what we
 have to work with in the stdlib. Sure you have TIX and a few other
 extensions but they will never compare to the vast features of
 wxPython. Have you even aquinted yourself with wxPython Adam?


It is nothing of the sort even if you erroneously believe it is.  Have
you looked at Tix?  The fact you dismiss it away as some extension
like it is a leper really betrays your argument.  Others (not you)
have already described the legitimate deficiencies at length, I will
defer to them.

  What i (and others) are proposing is to replace the existing Tkinter
 library with a matching wxPython libray. Then allocate the remaining
 wxPython library (which is ginormous btw!) into a 3rd party module
 available for download. My argument is that because wxPython is s
 feature rich. We will break the glass ceiling that exist now with
 Tkinter.


And what I pointed out is that wxWidgets (and Qt, and Swing, and Tk+Tix
+whatever, and every other GUI toolkit in existence) is so feature
rich for a reason: you actually need all of that stuff in order to
build rich, functional, useful GUI applications.  I think you'll find
that it's very hard to cut any functionality, even functionality
Python more or less entirely replicates (e.g., wxNet, wxODBC).  Why?
Because useful widgets rely on such low-level functionality (blame C+
+'s rather anemic standard library).

Moreover, even if you find things to cut, coming to a consensus about
what belongs outside of the stdlib will be difficult, if not
impossible; plus, it's considerable work for very little gain: I still
need a full install of wxwidgets to even build your useless minimal
set.  There's definitely no point in minimizing the python side of
things if it doesn't minimize the native code side of things.  Note
how the divisions with the Tk bindings follow the divisions of the
native libraries.

 Agreed! We need at least the same capability that Tkinter offers in
 the stdlib. Why would we sacrifice?

I don't know, but a sacrifice is precisely what you proposed.

 Thats not true. Yes all projects have faults of some kind. I am not
 suggesting that wxPython is some sort of miracle library. However
 anyone of average intelligence can do a side by side comparison and
 agree that wx is far superior to TclTk in many, many ways. If you have
 a valid argument as to how Tkinter is better feel free to share this
 information with us.

From this claim I've forced to conclude you are not of average
intelligence, because you haven't managed yet to do an actual, factual
side-by-side comparison of wxWidgets and Tk. Here is one to start: the
native footprint of Tk has fewer dependencies than the native
footprint of wxWidgets.

 Adam, Adam. I feel you are desperately trying to inject negative
 energy into what is now the very beginnings of a healthy and positive
 community discussion on the future of Python's GUI library.

There's nothing positive about this discussion, since it's being
spearheaded by arrogance and ignorance.  It's highly improbable, in
fact, for this discussion to ever be healthy and positive without a
desperate attitude and behavior chance on your part.

Seriously, given that widget set you listed, what applications am I
supposed to write?  I can't write a web browser.  I can't write an
audio player.  I can't write a terminal.  I can't write an IM client.
I can't write a social media client/application/mashup.  I can't write
a web browser.  I can't write a game community client/launcher.  I
can't write office productivity applications.  So what can I write?

The fact your proposal shows you're entirely disconnected with reality
isn't my fault in the least, nor does it mean I'm trying to inject
negative energy, nor that I'm resorting to these wasteful and
vengeful tactics.

You want to be told your proposal isn't disconnected with reality?
Then propose ideas that actually have technical merit and that can be
actually accomplished, instead of proposing things that plainly lack
merit to anyone who's ever written a complicated GUI application
before and/or that are flat-out impossible.  Calling a bad proposal a
bad proposal is a positive thing, like it or not.  If you can't accept
that, you should consider a pastime that involves less criticism.

 If you do care about Python's future then you should get involved with this
 discussion in a positive way.

I have, I told you what you want to do isn't possible.  The fact you
don't 

String building using join

2010-12-31 Thread gervaz
Hi all, I would like to ask you how I can use the more efficient join
operation in a code like this:

 class Test:
... def __init__(self, v1, v2):
... self.v1 = v1
... self.v2 = v2
...
 def prg(l):
... txt = 
... for x in l:
... if x.v1 is not None:
... txt += x.v1 + \n
... if x.v2 is not None:
... txt += x.v2 + \n
... return txt
...
 t1 = Test(hello, None)
 t2 = Test(None, ciao)
 t3 = Test(salut, hallo)
 t = [t1, t2, t3]

 prg(t)
'hello\nciao\nsalut\nhallo\n'

The idea would be create a new list with the values not None and then
use the join function... but I don't know if it is really worth it.
Any hint?

 def prg2(l):
... e = []
... for x in l:
... if x.v1 is not None:
... e.append(x.v1)
... if x.v2 is not None:
... e.append(x.v2)
... return \n.join(e)
...
 prg2(t)
'hello\nciao\nsalut\nhallo'

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


Re: String building using join

2010-12-31 Thread Emile van Sebille

On 12/31/2010 7:22 AM gervaz said...

Hi all, I would like to ask you how I can use the more efficient join
operation in a code like this:


class Test:

... def __init__(self, v1, v2):
... self.v1 = v1
... self.v2 = v2
...

def prg(l):

... txt = 
... for x in l:
... if x.v1 is not None:
... txt += x.v1 + \n
... if x.v2 is not None:
... txt += x.v2 + \n
... return txt
...

t1 = Test(hello, None)
t2 = Test(None, ciao)
t3 = Test(salut, hallo)
t = [t1, t2, t3]

prg(t)

'hello\nciao\nsalut\nhallo\n'

The idea would be create a new list with the values not None and then
use the join function... but I don't know if it is really worth it.
Any hint?


def prg2(l):


return \n.join([x for x in l if x])

Emile




... e = []
... for x in l:
... if x.v1 is not None:
... e.append(x.v1)
... if x.v2 is not None:
... e.append(x.v2)
... return \n.join(e)
...

prg2(t)

'hello\nciao\nsalut\nhallo'

Thanks, Mattia



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


Re: kinterbasdb error connection

2010-12-31 Thread Ale Ghelfi

On 09/12/2010 15:17, Uwe Grauer wrote:

On 12/07/2010 04:35 PM, Ale Ghelfi wrote:

(i'm under Ubuntu 10.10 amd64 and python 2.6 and kinterbasdb 3.2 )
I try to connect my database of firebird 2.5 by kinterbasdb.
But python return this error :



You are not using the current kinterbasdb version.
See:
http://firebirdsql.org/index.php?op=develsub=python

Uwe


kinterbasdb 3.2.3 is the Really current version for Ubuntu 10.10 AMD64.
Kinterbasdb 3.3.0 exists only for ubuntu 10.10 i386
I've check in the repository.


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


Compile on SunOS?

2010-12-31 Thread Alex Zhang

Hi All,
I'm trying to build Python 2.7.1 on Sun Solaris 10 amd64, however end up 
with:


Python build finished, but the necessary bits to build these modules 
were not found:

_bsddb _tkinter   bsddb185
gdbm   linuxaudiodev  ossaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the 
module's name.



Failed to build these modules:
_bisect_codecs_cn _codecs_hk
_codecs_iso2022_codecs_jp _codecs_kr
_codecs_tw _collections   _csv
_ctypes_ctypes_test   _curses
_curses_panel  _elementtree   _functools
_hashlib   _heapq _hotshot
_io_json  _locale
_lsprof_multibytecodec_multiprocessing
_random_socket_sqlite3
_ssl   _struct_testcapi
array  audioopbinascii
bz2cmath  cPickle
crypt  cStringIO  datetime
dbmdl fcntl
future_builtinsgrpimageop
itertools  math   mmap
nisoperator   parser
pyexpatresource   select
spwd   strop  sunaudiodev
syslog termiostime
unicodedatazlib

running build_scripts

I am using cc provided in Solaris 10, readline downloaded from GNU and 
compiled in 32bit. Also, I added this entry:


readline readline.c -I/local32/include -L/local32/lib -R/local32/lib 
-lreadline -ltermcap


to Modules/Setup.local in order to get readline running.
Currently:

dns# /opt/python/bin/python
Python 2.7.1 (r271:86832, Dec 31 2010, 07:21:22) [C] on sunos5
Type help, copyright, credits or license for more information.
 import hashlib
Traceback (most recent call last):
  File stdin, line 1, in module
  File /opt/python/lib/python2.7/hashlib.py, line 136, in module
globals()[__func_name] = __get_hash(__func_name)
  File /opt/python/lib/python2.7/hashlib.py, line 71, in 
__get_builtin_constructor

import _md5
ImportError: No module named _md5

I can not use hashlib and many other modules however I can use the rest 
modules.

Thanks for all your kind reply.
--
OSQDU::Alex
--
http://mail.python.org/mailman/listinfo/python-list


Re: Interrput a thread

2010-12-31 Thread John Nagle

On 12/29/2010 3:31 PM, gervaz wrote:

Hi all, I need to stop a threaded (using CTR+C or kill) application if
it runs too much or if I decide to resume the work later.
I come up with the following test implementation but I wanted some
suggestion from you on how I can implement what I need in a better or
more pythonic way.


You can't send signals to individual threads under CPython.
Even where the OS supports it, CPython does not.  See
http://docs.python.org/library/signal.html;

Nor can you kill a thread.  All you can do is ask it
nicely to stop itself.

Even worse, sending control-C to a multi-thread program
is unreliable in CPython.  See http://blip.tv/file/2232410;
for why.  It's painful.

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


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

2010-12-31 Thread Robert

On 2010-12-30 23:20:59 -0500, Steven D'Aprano said:


On Thu, 30 Dec 2010 23:04:33 -0500, Robert wrote:


The
second way the Tcl community irks me is the not invented here
attitude. I like the syntax of Tcl and I like the community. They are
some good folks. Try asking I want to build a Nagios clone in Tcl type
question and invariably you get Why? There is already Nagios?.


You're the one who wants to re-write Nagios in Tcl, the Tcl community are
perfectly happy using the existing Nagios instead of re-inventing the
wheel, and you accuse *them* of suffering from NIH syndrome.

Oh the irony.


No, that was just an example! My goodness

--
Robert


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


Nagios

2010-12-31 Thread Antoine Pitrou
On 31 Dec 2010 04:20:59 GMT
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
 On Thu, 30 Dec 2010 23:04:33 -0500, Robert wrote:
 
  The
  second way the Tcl community irks me is the not invented here
  attitude. I like the syntax of Tcl and I like the community. They are
  some good folks. Try asking I want to build a Nagios clone in Tcl type
  question and invariably you get Why? There is already Nagios?.
 
 You're the one who wants to re-write Nagios in Tcl, the Tcl community are 
 perfectly happy using the existing Nagios instead of re-inventing the 
 wheel, and you accuse *them* of suffering from NIH syndrome.

Well, I don't know about Tcl but Nagios was re-written in Python:
http://www.shinken-monitoring.org/features/

Regards

Antoine.


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


Re: Python - NAWIT / Community

2010-12-31 Thread Fabio Zadrozny
 My question relates to community contribution. My concern arose when
 recently installing the pydev.org extensions in Eclipse. Now as far as
 my understanding goes the licensing on both is open source GPL.
 However Pydev became open source as part of aptana's acquistion, and
 for the moment pydev can be installed as part of the Aptana studio 2/3
 releases individually as a plugin, but moving on if you vist the
 aptana site there is sweet little about python on their site, their
 site is dominated by Radrails.

Just a little fix there, Pydev is open source EPL (not GPL).

Also, yes, there's little content about Pydev in the Aptana homepage,
but it points to the main Pydev homepage (http://pydev.org) which has
the proper content related to Python (and it's currently being
actively developed and also integrated in Aptana Studio 3, which is
where the current efforts are targeted within Aptana now). Sorry if
this causes the (wrong) perception that Pydev doesn't get as much
attention.


 Can't help thinking they open sourced Pydev so they could bench it. So
 I started thinking that the only consistent env each python person has
 is idle as it ships in the install.

Sorry, but I don't follow your thoughts here... there are many
consistent environments for python development which are properly
supported (Pydev being only one of them as you can see at
http://stackoverflow.com/questions/81584/what-ide-to-use-for-python ).


 Sometimes we can contribute with money and sometimes with time, if I
 was to contribute money to ensure that I and all new coming python
 programmers could have a first class development environment to use
 what would I donate to? At the moment no particular group seems
 applicable.

 Is pydev actively being developed and for who? SPE is a great idea but
 is Stan still developing? Pyscripter is good but not 64 capable. Plus
 none of these projects seem community centric.

I'm the current Pydev maintainer (since 2005)... and while I cannot
state that I'll be in that role forever (forever is quite a long
time), I do think it's well maintained and there are occasional
patches from the community that uses it (although I still get to
review all that goes in).

 Maybe its just my wish, maybe something already exists, but to my mind
 why is there not a central python community ide or plugin setup like
 pydev or using pydev(since currently it is very good - to me), which I
 know or at least could confidently donate time or money to further
 python.

 This could apply to many python area's does python use easy_install or
 pypm, well if you want camelot or zope (unless you have business
 edition) its easy_install, but you wont find an ide with built in egg
 or pypm support?

I think the issue is that only recently (if you compare with the
others) has easy_install became the de facto standard in python (so,
it'd be more an issue of interest adding such a feature to the ide).

 Why every Ruby ide has gems manager, and for that
 fact look at netbeans, the ide is good but support for python is
 mentioned on a far flung community page where some developers are
 trying to maintain good python support. PS they seem to be doing a
 good job, but a review of the mailing list archives shows little
 activity.

 One could say that activestate puts in good support but then they do
 not provide an ide within the means of the average part time person
 retailing its main edition at over $300, Pycharm a good ide at $99 but
 then where is my money going.

 I think a community plugin architecture which contained components
 like pydev, pyscripter, eclipse and eggs/pypm packages would give a
 place I can contribute time as my skills grow and confidently donate
 money knowing I am assisting the development of community tools and
 packages we all can use. No need to reinvent the wheel most things
 already exist, for example apt-get  rpm style package management time
 tested and could be easily used to manage python eggs for example.
 Anyway I have had my 2 cents, if someone is contributing more than I
 know, and this wasn't intended to dimnish anyone's effort, just
 wanting to look to growing and fostering a stronger python community.


Well, I can only comment from the Pydev side here, but do you think
it'd be worth reinventing all that's already done in it just for
having it in Python? When I started contributing to Pydev back in 2004
I didn't go that way because Eclipse itself has a huge community
that's already in place and is properly maintained, which takes a lot
of effort, so, I'm not sure it'd be worth reproducing all that just to
have it 100% Python code -- I say 100% because Pydev does have a
number of things that are in Python, such as the debugger and Jython
for the scripting engine, although the major portion is really in
java.

Another important aspect is that it's much better if you can get an
experience that can later be replicated to other languages (which
Eclipse provides).

Cheers,

Fabio
-- 

Re: Python3 Web Framework

2010-12-31 Thread Alice Bevan–McGregor

On 2010-12-31 02:20:47 -0800, Terry Reedy said:


I believe some will be improved or even solved in 3.2.


Evidence to back this statement up would be appreciated.  ;)

- Alice.


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


Re: Interrput a thread

2010-12-31 Thread Alice Bevan–McGregor

On 2010-12-31 10:28:26 -0800, John Nagle said:


Even worse, sending control-C to a multi-thread program
is unreliable in CPython.  See http://blip.tv/file/2232410;
for why.  It's painful.


AFIK, that has been resolved in Python 3.2 with the introduction of an 
intelligent thread scheduler as part of the GIL release/acquire process.


- Alice.


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


tempfile.NamedTemporaryFile use case?

2010-12-31 Thread Roy Smith
What is the use case for tempfile.NamedTemporaryFile?  As far as I can 
tell, the only way it differs from TemporaryFile is that it is 
guaranteed to have a name in the file system.  BUT, it's not guaranteed 
that you can open the file a second time via that name.

So, what's the point?  In what situations would NamedTemporaryFile do 
what you want but TemporaryFile not?

I'm writing a unit test where I want to verify operation of my code on a 
path which can't be opened (i.e. that it raises IOError). 
NamedTemporaryFile almost gives me what I want.  It creates a file, 
tells me what the path is (so I can os.chmod() it to mode 0), and cleans 
it up when I'm done (so I don't have to write my own context manager or 
whatever).  But, it's not guaranteed that I can open the path, so the 
whole test is moot.

I can work around that (plain old mktemp() or mkstemp() and have my 
tearDown() method do the cleanup), but the more I look at this, the more 
I'm scratching my head why NamedTemporaryFile exists.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Keeping track of the N largest values

2010-12-31 Thread Dan Stromberg
On Sat, Dec 25, 2010 at 7:42 AM, Roy Smith r...@panix.com wrote:
 I'm processing a stream of N numbers and want to keep track of the K
 largest.  There's too many numbers in the stream (i.e. N is too large)
 to keep in memory at once.  K is small (100 would be typical).

 From a theoretical point of view, I should be able to do this in N log K
 time.  What I'm doing now is essentially:

 top = [-1]    # Assume all x are = 0
 for x in input():
    if x = top[0]:
        continue
    top.append(x)
    if len(top)  K:
        top.sort()
        top.pop(0)

 I can see pathological cases (say, all input values the same) where
 running time would be N K log K, but on average (N  K and random
 distribution of values), this should be pretty close to N.

 Is there a better way to do this, either from a theoretical running time
 point of view, or just a nicer way to code this in Python?
 --
 http://mail.python.org/mailman/listinfo/python-list


heapq is probably fine, but I've empirically found a treap faster than
a heap under some conditions:

http://stromberg.dnsalias.org/~strombrg/treap/
http://stromberg.dnsalias.org/~strombrg/highest/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tempfile.NamedTemporaryFile use case?

2010-12-31 Thread Alice Bevan–McGregor
I'm a bad person, but one use case I have is for shuffling templates 
around such that:


* An inherited ('parent') template can be stored in a database.
* The 'views' of my application are told to either use the real master 
template or the db parent template.

* The rendering engine loads the parent from disk.

Thus I create a NamedTemporaryFile (with some custom prefix and suffix 
stuff), write the parent template from DB to it, flush, then let the 
rendering engine do its thing.  Works like a hot damn, and lets the 
users of my CMS manage custom layouts from within the CMS.


Templates are cached using the CMS template path as the dict key, and a 
2-tuple of modification time and the NamedTemporaryFile as the value.  
Cleanup of old versions on-disk is simple: just close the file!


- Alice.


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


Re: User input masks - Access Style

2010-12-31 Thread Tim Harig
On 2010-12-31, flebber flebber.c...@gmail.com wrote:
 On Dec 28 2010, 12:21 am, Adam Tauno Williams awill...@whitemice.org
 wrote:
 On Sun, 2010-12-26 at 20:37 -0800, flebber wrote:
  Is there anyay to use input masks in python? Similar to the function
  found in access where a users input is limited to a type, length and
  format.

 http://faq.pygtk.org/index.py?file=faq14.022.htpreq=show

 Typically this is handled by a callback on a keypress event.

 Regarding 137 of the re module, relating to the code above.

137? I am not sure what you are referencing?

 EDIT: I just needed to use raw_input rather than input to stop this
 input error.

Sorry, I used input() because that is what you had used in your example
and it worked for my system.  Normally, I would have used window.getstr()
from the curses module, or whatever the platform equivilant is, for
getting line buffered input.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Trying to parse a HUGE(1gb) xml file

2010-12-31 Thread dontcare
You should look into vtd-xml, available in c, c++, java and c#.

On Dec 20, 11:34 am, spaceman-spiff ashish.mak...@gmail.com wrote:
 Hi c.l.p folks

 This is a rather long post, but i wanted to include all the details  
 everything i have tried so far myself, so please bear with me  read the 
 entire boringly long post.

 I am trying to parse a ginormous ( ~ 1gb) xml file.

 0. I am a python  xml n00b, s have been relying on the excellent beginner 
 book DIP(Dive_Into_Python3 by MP(Mark Pilgrim) Mark , if u are readng 
 this, you are AWESOME  so is your witty  humorous writing style)

 1. Almost all exmaples pf parsing xml in python, i have seen, start off with 
 these 4 lines of code.

 import xml.etree.ElementTree as etree
 tree = etree.parse('*path_to_ginormous_xml*')
 root = tree.getroot()  #my huge xml has 1 root at the top level
 print root

 2. In the 2nd line of code above, as Mark explains in DIP, the parse function 
 builds  returns a tree object, in-memory(RAM), which represents the entire 
 document.
 I tried this code, which works fine for a small ( ~ 1MB), but when i run this 
 simple 4 line py code in a terminal for my HUGE target file (1GB), nothing 
 happens.
 In a separate terminal, i run the top command,  i can see a python process, 
 with memory (the VIRT column) increasing from 100MB , all the way upto 2100MB.

 I am guessing, as this happens (over the course of 20-30 mins), the tree 
 representing is being slowly built in memory, but even after 30-40 mins, 
 nothing happens.
 I dont get an error, seg fault or out_of_memory exception.

 My hardware setup : I have a win7 pro box with 8gb of RAM  intel core2 quad 
 cpuq9400.
 On this i am running sun virtualbox(3.2.12), with ubuntu 10.10 as guest os, 
 with 23gb disk space  2gb(2048mb) ram, assigned to the guest ubuntu os.

 3. I also tried using lxml, but an lxml tree is much more expensive, as it 
 retains more info about a node's context, including references to it's parent.
 [http://www.ibm.com/developerworks/xml/library/x-hiperfparse/]

 When i ran the same 4line code above, but with lxml's elementree ( using the 
 import below in line1of the code above)
 import lxml.etree as lxml_etree

 i can see the memory consumption of the python process(which is running the 
 code) shoot upto ~ 2700mb  then, python(or the os ?) kills the process as it 
 nears the total system memory(2gb)

 I ran the code from 1 terminal window (screenshot :http://imgur.com/ozLkB.png)
  ran top from another terminal (http://imgur.com/HAoHA.png)

 4. I then investigated some streaming libraries, but am confused - there is 
 SAX[http://en.wikipedia.org/wiki/Simple_API_for_XML] , the iterparse 
 interface[http://effbot.org/zone/element-iterparse.htm]

 Which one is the best for my situation ?

 Any  all code_snippets/wisdom/thoughts/ideas/suggestions/feedback/comments/ 
 of the c.l.p community would be greatly appreciated.
 Plz feel free to email me directly too.

 thanks a ton

 cheers
 ashish

 email :
 ashish.makani
 domain:gmail.com

 p.s.
 Other useful links on xml parsing in python
 0.http://diveintopython3.org/xml.html
 1.http://stackoverflow.com/questions/1513592/python-is-there-an-xml-par...
 2.http://codespeak.net/lxml/tutorial.html
 3.https://groups.google.com/forum/?hl=enlnk=gstq=parsing+a+huge+xml#!...
 4.http://www.ibm.com/developerworks/xml/library/x-hiperfparse/
 5.http://effbot.org/zone/element-index.htmhttp://effbot.org/zone/element-iterparse.htm
 6. SAX :http://en.wikipedia.org/wiki/Simple_API_for_XML

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


Re: Python - NAWIT / Community

2010-12-31 Thread flebber
On Jan 1, 9:03 am, Fabio Zadrozny fabi...@gmail.com wrote:
  My question relates to community contribution. My concern arose when
  recently installing the pydev.org extensions in Eclipse. Now as far as
  my understanding goes the licensing on both is open source GPL.
  However Pydev became open source as part of aptana's acquistion, and
  for the moment pydev can be installed as part of the Aptana studio 2/3
  releases individually as a plugin, but moving on if you vist the
  aptana site there is sweet little about python on their site, their
  site is dominated by Radrails.

 Just a little fix there, Pydev is open source EPL (not GPL).

 Also, yes, there's little content about Pydev in the Aptana homepage,
 but it points to the main Pydev homepage (http://pydev.org) which has
 the proper content related to Python (and it's currently being
 actively developed and also integrated in Aptana Studio 3, which is
 where the current efforts are targeted within Aptana now). Sorry if
 this causes the (wrong) perception that Pydev doesn't get as much
 attention.

  Can't help thinking they open sourced Pydev so they could bench it. So
  I started thinking that the only consistent env each python person has
  is idle as it ships in the install.

 Sorry, but I don't follow your thoughts here... there are many
 consistent environments for python development which are properly
 supported (Pydev being only one of them as you can see 
 athttp://stackoverflow.com/questions/81584/what-ide-to-use-for-python).

  Sometimes we can contribute with money and sometimes with time, if I
  was to contribute money to ensure that I and all new coming python
  programmers could have a first class development environment to use
  what would I donate to? At the moment no particular group seems
  applicable.

  Is pydev actively being developed and for who? SPE is a great idea but
  is Stan still developing? Pyscripter is good but not 64 capable. Plus
  none of these projects seem community centric.

 I'm the current Pydev maintainer (since 2005)... and while I cannot
 state that I'll be in that role forever (forever is quite a long
 time), I do think it's well maintained and there are occasional
 patches from the community that uses it (although I still get to
 review all that goes in).

  Maybe its just my wish, maybe something already exists, but to my mind
  why is there not a central python community ide or plugin setup like
  pydev or using pydev(since currently it is very good - to me), which I
  know or at least could confidently donate time or money to further
  python.

  This could apply to many python area's does python use easy_install or
  pypm, well if you want camelot or zope (unless you have business
  edition) its easy_install, but you wont find an ide with built in egg
  or pypm support?

 I think the issue is that only recently (if you compare with the
 others) has easy_install became the de facto standard in python (so,
 it'd be more an issue of interest adding such a feature to the ide).



  Why every Ruby ide has gems manager, and for that
  fact look at netbeans, the ide is good but support for python is
  mentioned on a far flung community page where some developers are
  trying to maintain good python support. PS they seem to be doing a
  good job, but a review of the mailing list archives shows little
  activity.
  One could say that activestate puts in good support but then they do
  not provide an ide within the means of the average part time person
  retailing its main edition at over $300, Pycharm a good ide at $99 but
  then where is my money going.

  I think a community plugin architecture which contained components
  like pydev, pyscripter, eclipse and eggs/pypm packages would give a
  place I can contribute time as my skills grow and confidently donate
  money knowing I am assisting the development of community tools and
  packages we all can use. No need to reinvent the wheel most things
  already exist, for example apt-get  rpm style package management time
  tested and could be easily used to manage python eggs for example.
  Anyway I have had my 2 cents, if someone is contributing more than I
  know, and this wasn't intended to dimnish anyone's effort, just
  wanting to look to growing and fostering a stronger python community.

 Well, I can only comment from the Pydev side here, but do you think
 it'd be worth reinventing all that's already done in it just for
 having it in Python? When I started contributing to Pydev back in 2004
 I didn't go that way because Eclipse itself has a huge community
 that's already in place and is properly maintained, which takes a lot
 of effort, so, I'm not sure it'd be worth reproducing all that just to
 have it 100% Python code -- I say 100% because Pydev does have a
 number of things that are in Python, such as the debugger and Jython
 for the scripting engine, although the major portion is really in
 java.

 Another important aspect is that it's much better if 

Re: Is there anyway to run JavaScript in python?

2010-12-31 Thread Dan Stromberg
On Thu, Dec 30, 2010 at 5:52 AM, crow wen...@gmail.com wrote:
 Hi, I'm writing a test tool to simulate Web browser. Is there anyway
 to run JavaScript in python? Thanks in advance.
 --
 http://mail.python.org/mailman/listinfo/python-list


You might also consider Pyjamas, which translates Python (somewhere
between 2.5 and 2.6) to Javascript.  Then your python code ends up
running on a javascript interpreter with interlanguage calling
available.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Compile on SunOS?

2010-12-31 Thread MrJean1
These command lines used to build 32-bit Python 2.4 and 2.5 on Solaris
10 Opteron using SUN's compilers:

  setenv LD_LIBRARY_PATH 
  env CCSHARED=-KPIC LDSHARED=cc -xtarget=native -G LDFLAGS=-
xtarget=native CC=cc \
   CPP=cc-xtarget=native -E BASECFLAGS=-xtarget=native OPT=-xO5
CFLAGS=-xtarget=native \
   CXX=CC -xtarget=native ./configure --enable-shared --without-gcc
--disable-ipv6 --prefix=
  make

Replace the 's accordingly.  Use BASECFLAGS=-xtarget=native -
xlibmieee for IEEE floating point.

Disclaimer, I have not tried building Python 2.6 nor 2.7.

/Jean


On Dec 31, 8:34 am, Alex Zhang cheungti...@gmail.com wrote:
 Hi All,
 I'm trying to build Python 2.7.1 on Sun Solaris 10 amd64, however end up
 with:

 Python build finished, but the necessary bits to build these modules
 were not found:
 _bsddb             _tkinter           bsddb185
 gdbm               linuxaudiodev      ossaudiodev
 To find the necessary bits, look in setup.py in detect_modules() for the
 module's name.

 Failed to build these modules:
 _bisect            _codecs_cn         _codecs_hk
 _codecs_iso2022    _codecs_jp         _codecs_kr
 _codecs_tw         _collections       _csv
 _ctypes            _ctypes_test       _curses
 _curses_panel      _elementtree       _functools
 _hashlib           _heapq             _hotshot
 _io                _json              _locale
 _lsprof            _multibytecodec    _multiprocessing
 _random            _socket            _sqlite3
 _ssl               _struct            _testcapi
 array              audioop            binascii
 bz2                cmath              cPickle
 crypt              cStringIO          datetime
 dbm                dl                 fcntl
 future_builtins    grp                imageop
 itertools          math               mmap
 nis                operator           parser
 pyexpat            resource           select
 spwd               strop              sunaudiodev
 syslog             termios            time
 unicodedata        zlib

 running build_scripts

 I am using cc provided in Solaris 10, readline downloaded from GNU and
 compiled in 32bit. Also, I added this entry:

 readline readline.c -I/local32/include -L/local32/lib -R/local32/lib
 -lreadline -ltermcap

 to Modules/Setup.local in order to get readline running.
 Currently:

 dns# /opt/python/bin/python
 Python 2.7.1 (r271:86832, Dec 31 2010, 07:21:22) [C] on sunos5
 Type help, copyright, credits or license for more information.
   import hashlib
 Traceback (most recent call last):
    File stdin, line 1, in module
    File /opt/python/lib/python2.7/hashlib.py, line 136, in module
      globals()[__func_name] = __get_hash(__func_name)
    File /opt/python/lib/python2.7/hashlib.py, line 71, in
 __get_builtin_constructor
      import _md5
 ImportError: No module named _md5

 I can not use hashlib and many other modules however I can use the rest
 modules.
 Thanks for all your kind reply.
 --
 OSQDU::Alex

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


Re: Python3 Web Framework

2010-12-31 Thread Robert

On 2010-12-31 17:24:56 -0500, Alice Bevan–McGregor said:


On 2010-12-31 02:20:47 -0800, Terry Reedy said:


I believe some will be improved or even solved in 3.2.


Evidence to back this statement up would be appreciated.  ;)

- Alice.


- wsgiref now implements and validates PEP , rather than an experimental
 extension of PEP 333.  (Note: earlier versions of Python 3.x may have
 incorrectly validated some non-compliant applications as WSGI compliant; if
 your app validates with Python 3.2b1+, but not on this version, it is likely
 the case that your app was not compliant.)


That is from the changes file...so they are working to fix it all.

HTH

--
Robert


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


Re: Nagios

2010-12-31 Thread Robert

On 2010-12-31 16:52:30 -0500, Antoine Pitrou said:


On 31 Dec 2010 04:20:59 GMT
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:

On Thu, 30 Dec 2010 23:04:33 -0500, Robert wrote:


The
second way the Tcl community irks me is the not invented here
attitude. I like the syntax of Tcl and I like the community. They are
some good folks. Try asking I want to build a Nagios clone in Tcl type
question and invariably you get Why? There is already Nagios?.


You're the one who wants to re-write Nagios in Tcl, the Tcl community are
perfectly happy using the existing Nagios instead of re-inventing the
wheel, and you accuse *them* of suffering from NIH syndrome.


Well, I don't know about Tcl but Nagios was re-written in Python:
http://www.shinken-monitoring.org/features/

Regards

Antoine.


It was forked to be written in Python, yes. The whole point (and it 
wasn't a Nagios port to Tcl) was that the Tcl community (and I like the 
Tcl community a lot) has a strange fixation with not reinventing the 
wheel, even when the wheel would be in Tcl and it might give Tcl more 
exposure. It is what it is though.


--
Robert


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


Re: GUI Tools for Python 3.1

2010-12-31 Thread flebber
On Dec 26 2010, 8:41 pm, Hans-Peter Jansen h...@urpla.net wrote:
 On Friday 24 December 2010, 03:58:15 Randy Given wrote:

  Lots of stuff for 2.6 and 2.7 -- what GUI tools are there for 3.1?

 PyQt4 of course.

 http://www.riverbankcomputing.com

 Pete

Pyside, Nokia have split with riverbank computing and are quickly
developing pyside. Currently not supported in Py3000 but have already
a roadmap for implementation when they finalise Python 2 support.

Here is what they see as roadblocks(not insurmountble) to python3.

http://developer.qt.nokia.com/wiki/PySide_Python_3_Issues

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


Re: Nagios

2010-12-31 Thread Adam Skutt
On Friday, December 31, 2010 9:56:02 PM UTC-5, Robert H wrote:
 It was forked to be written in Python, yes. The whole point (and it 
 wasn't a Nagios port to Tcl) was that the Tcl community (and I like the 
 Tcl community a lot) has a strange fixation with not reinventing the 
 wheel, even when the wheel would be in Tcl and it might give Tcl more 
 exposure. It is what it is though.
 
 -- 

Perhaps because they'd rather do something useful with the tool they've created 
instead of trying to win some sort of nonexistent popularity contest?  What 
value would there be in that?

Not trying to reinvent the wheel whenever feasible is both good programming and 
good engineering most of the time.  Unfortunately, the fact you see this as 
irksome only paints you in a negative light.

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


Re: default argument in method

2010-12-31 Thread DevPlayer
I agree with you Steven that the OP should avoid __getattribute__ and
the like for many a thing. I also agree with your last statement. I
try to answer the OP's question without much You shouldn't do this's
and don't do that's. I trust them to make thier own decisions. I'd
say A much better solution... is the way I like to say it.

The last solution you offered I find I use more often now as I like to
set my function with default values for which I call set-and-forget
function parms/args where using None is what allows my functions to
know what is changing (or not).
# for example
def logger(parm1, parm2=None):
if not hasattr(myfunc.parm2_default):
if parm2:
myfunc.parm2_default = parm2
else:
myfunc.parm2_default = CONSOLE
if not parm2:
parmTwo = myfunc.parm2_default
else:
parmTwo = parm2

# do something
print(parmTwo)

log = logger(gui_frame, GUI)  # an inaccurate example
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue7322] Socket timeout can cause file-like readline() method to lose data

2010-12-31 Thread Ross Lagerwall

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

Attached is a patch which fixes the issue.

Instead of allowing the readline method to lose data, it adds a check to 
SocketIO.readinto() to ensure that the socket does not have a timeout and 
throws an IOError if it does. Also does the same for SocketIO.write().

I think this is a better approach - just failing immediately when a readline on 
a nonblocking socket occurs instead of failing sometimes and losing data.

--
keywords: +patch
nosy: +rosslagerwall
Added file: http://bugs.python.org/file20202/7322_v1.patch

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



[issue7322] Socket timeout can cause file-like readline() method to lose data

2010-12-31 Thread Ross Lagerwall

Changes by Ross Lagerwall rosslagerw...@gmail.com:


--
nosy: +loewis, pitrou

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



[issue7995] On Mac / BSD sockets returned by accept inherit the parent's FD flags

2010-12-31 Thread Ross Lagerwall

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

issue1515839 seems to be a duplicate of this one.

--

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



[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-12-31 Thread Jacques Grove

Jacques Grove aquara...@gmail.com added the comment:

Thanks for putting up the hg repo, makes it much easier to follow.

Getting back to the performance regression I reported in msg124904:

I've verified that if I take the hg commit 7abd9f9bb1 , and I back out the 
guards changes manually, while leaving the FAST_INIT changes in, the 
performance is back to normal on my full regression suite (i.e. the 30-40% 
penalty disappears).

I've repeated my tests a few times to make sure I'm not mistaken;  since the 
guard changes doesn't look like it should impact performance much, but it does.

I've attached the diff that restored the speed for me (as usual, using Python 
2.6.5 on Linux x86_64)

BTW, now that we have the code on google code, can we log individual issues 
over there?  Might make it easier for those interested to follow certain issues 
than trying to comb through every individual detail in this 
super-issue-thread...?

--
Added file: http://bugs.python.org/file20203/remove_guards.diff

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



[issue1515839] socket timeout inheritance on accept

2010-12-31 Thread Ned Deily

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

The problem you have reported here was later independently reported in 
Issue7995 where a possible fix has been proposed.  Suggest adding yourself to 
the nosy list of that issue to monitor current status.

--
nosy: +ned.deily
resolution:  - duplicate
status: open - closed
superseder:  - On Mac / BSD sockets returned by accept inherit the parent's FD 
flags

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



[issue6210] Exception Chaining missing method for suppressing context

2010-12-31 Thread Antoine Pitrou

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

Le vendredi 31 décembre 2010 à 00:07 +, Patrick W. a écrit :
 Patrick W. p...@borntolaugh.de added the comment:
 
 Antoine Pitrou (pitrou) at 2010-12-30 18:32 (UTC)
  We are talking about context, not cause.
 
 Yes, but - as said before - obviously the cause takes a higher
 precedence than context (otherwise it wouldn't show a context message
 when you explicitely set that). So when *explicitely* setting the
 cause to `None`, it should use the cause `None` and ignore the
 context, and as such display nothing.

It looks quite unintuitive to me, though.

--

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



[issue7322] Socket timeout can cause file-like readline() method to lose data

2010-12-31 Thread Antoine Pitrou

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

While this patch looks conformant to the documentation, it is very likely to 
break code in the wild. Even in the stdlib, there are uses of makefile() + 
socket timeouts (e.g. in http.client and urllib). It would be better to find a 
way to make readline() functional even with socket timeouts.

--
assignee: gregory.p.smith - 

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



[issue3766] socket.socket.recv broken (unbearably slow)

2010-12-31 Thread Konstantin Osipov

Konstantin Osipov kostja.osi...@gmail.com added the comment:

I was able to observe the same issue:

I'm using Python 2.6.5 on Ubuntu 10.0.4 LTS. My system is 64 bit Intel Core I7, 
Quad core, Linux kernel 2.6.32-generic x86_64, Ubuntu EGLIBC 2.11.1-0ubuntu7.5.

A simple client TCP socket, which sends 35 bytes over to a server on localhost 
and receives 20 bytes in response, produces only 22 RPS. An identical 
application written in C gives me 7000 RPS. TCP_NODELAY is on on the server 
side. Turning on TCP_NODELAY on the client gives me ~500 RPS in Python (which 
I'm satisfied with, 'cause I think I then hit other bottlenecks). 
Still, such low performance on by default can be surprising and hard to debug.

--
nosy: +kostja

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



[issue10801] zipfile.ZipFile().extractall() header mismatch for non-ASCII characters

2010-12-31 Thread M. Z.

New submission from M. Z. mzdkm...@gmail.com:

Trying to unpack a ZIP file where some packet files contain danish letters 
results in:

zipfile.BadZipFile: File name in directory 'filename_with_æoå.txt'
and header b'filename_with_\x91o\x86.txt' differ.

Using Py 3.2b2 on Win7.

Unpack the attached ZIP file and run the Py script, which will show the problem 
using the enclosed two ZIP files.

--
components: Library (Lib)
files: bug_zipfile_extractall.zip
messages: 124964
nosy: M..Z.
priority: normal
severity: normal
status: open
title: zipfile.ZipFile().extractall() header mismatch for non-ASCII characters
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file20204/bug_zipfile_extractall.zip

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



[issue10801] zipfile.ZipFile().extractall() header mismatch for non-ASCII characters

2010-12-31 Thread Antoine Pitrou

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


--
nosy: +amaury.forgeotdarc, haypo, loewis

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



[issue7995] On Mac / BSD sockets returned by accept inherit the parent's FD flags

2010-12-31 Thread Antoine Pitrou

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

Thanks for the patch. Comments/questions:
- please don't use C++-style comments (//) in C code; some compilers can 
choke on them
- should the code path be also enabled for netbsd? (or other variants?)
- why does the test silence socket.error on accept()?
- what if fcntl() returns -1? (unlikely I know)

--

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



[issue10801] zipfile.ZipFile().extractall() header mismatch for non-ASCII characters

2010-12-31 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

The attached patch fixes it for me. No time to write tests right now.

--
keywords: +patch
Added file: http://bugs.python.org/file20205/zipfile.diff

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



[issue7995] On Mac / BSD sockets returned by accept inherit the parent's FD flags

2010-12-31 Thread Ross Lagerwall

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

From what I coud see, the same applied to NetBSD so I enabled it for NetBSD as 
well - if there are any other OSes that need it enabled, they can be added.

The updated patch checks for fcntl() failing and simply leaves the socket as is 
if it fails.

The test silenced socket.error() just because the other tests did like 
testSetBlocking, testInitNonBlocking, testAccept, etc. I updated it to remove 
this.

--
Added file: http://bugs.python.org/file20206/7995_v2.patch

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



[issue6210] Exception Chaining missing method for suppressing context

2010-12-31 Thread Ethan Furman

Ethan Furman et...@stoneleaf.us added the comment:

raise AttributeError from None

makes sense to me, and in a nice, short example like that I prefer it. 
In real code, however, I think

raise AttributeError.no_context(Field %s is not in table % attr)

is going to be easier for the human to parse than

raise AttributeError(Field %s is not in table % attr) from None

--

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



[issue9361] Tests for leapdays in calendar.py module

2010-12-31 Thread Sandro Tosi

Sandro Tosi sandro.t...@gmail.com added the comment:

I just tried John's patch, and:

- it still applies without problem (except for a bit of offset)
- I can confirm that it actually adds test coverage for leapdays() function 
(bringing calendar coverage from 71% to 72%).

I think it would be good to apply it to py3k branch.

Cheers,
Sandro

--
nosy: +sandro.tosi
stage:  - patch review

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



[issue9370] Add reader redirect from test package docs to unittest module

2010-12-31 Thread Sandro Tosi

Sandro Tosi sandro.t...@gmail.com added the comment:

Hi Nick,
the See also section already points to unittest module; are you asking to 
extend its description to mention that's the tool people should use for their 
unittest suites?

Cheers,
Sandro

--
nosy: +sandro.tosi

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



[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-12-31 Thread Matthew Barnett

Matthew Barnett pyt...@mrabarnett.plus.com added the comment:

Why not? :-)

--

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



[issue1674555] sys.path in tests contains system directories

2010-12-31 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Here is a proof of concept patch if anyone wants to play with it.Note that 
a higher value could be used for the j option; multiple threads help even on 
uniprocessor systems since a bunch of the tests spend time waiting around.

The patch removes the '-l' option from the make test run.  I'm not sure that 
matters, since we do our best to fix memory leaks before shipping a release, 
and we don't use make test to do our leak testing (as far as I know).

I'm not sure this is an appropriate solution, so I won't apply this unless I 
get some favorable votes from committers and/or packagers. 

One interesting thing is that several additional tests show up as altering the 
execution environment when run this way.  That bears investigation at some 
point, but is an orthogonal issue.

As noted, test_trace does not pass, but only one test within it fails, so that 
ought to be easy enough to fix.  Also note that this fix would only be 
applicable to 3.2 and 2.7.

--
keywords: +patch
nosy: +doko, loewis, pitrou
Added file: http://bugs.python.org/file20207/make_test_S.patch

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



[issue9671] test_executable_without_cwd fails: AssertionError: 1 != 47

2010-12-31 Thread Sandro Tosi

Sandro Tosi sandro.t...@gmail.com added the comment:

Hello,
I tried on a freshly build 2.7, and I can't replicate the reported error. Could 
it be it has been fixed by r78136?

Sridhar, are you still seeing this error?

Cheers,
Sandro

--
nosy: +sandro.tosi

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



[issue9361] Tests for leapdays in calendar.py module

2010-12-31 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Applied in r87590.  I threw in an extra test for a multi-leapyear-range.  Since 
there was no reason not to, I backported it to 3.1 in r87591 and 2.7 in r87592. 
 In the latter two commits I also backported the issue 9342 patch.

Thanks for the patch, John, and for the review, Sandro.

--
nosy: +r.david.murray
resolution:  - accepted
stage: patch review - committed/rejected
status: open - closed
versions: +Python 2.7, Python 3.1

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



[issue9342] Tests for monthrange in calendar.py module

2010-12-31 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Backported it to 3.1 in r87591 and 2.7 in r87592 along with the patch for issue 
9361.

--
nosy: +r.david.murray

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




[issue10270] Fix resource warnings in test_threading

2010-12-31 Thread Sandro Tosi

Sandro Tosi sandro.t...@gmail.com added the comment:

Already fixed in r86107

--
nosy: +sandro.tosi
resolution:  - fixed
stage: commit review - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10270
___
___
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

2010-12-31 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

I finally got around to researching this issue in the tracker.

Issue 10298 is a close relative to this issue.  The fix from that issue make 
the test that Xuanji added here pass.  That issue contains no testsit would 
be ideal to have tests that test the behavior in the face of actual comments in 
the zipfile, but even if all we have is Xuanji's test IMO we should apply one 
of the two fixes.

The 10298 patch takes the approach of ignoring the excess data but preserving 
the comment if any.  The author implies that that is what other tools do, so in 
the absence of input from Alan or other zipfile experts that's probably what we 
should go with.

Rep, could you look over this issue and indicate if you agree?

Note also issue 9239, which fixes one way that zipfile could create a zipfile 
with garbage at the end.

Then there is issue 1757072, where we hear some of Alan's thinking about this: 
a non-strict mode...but it is perhaps too late for a feature request, and 
there is the fact that ignoring the trailing data appears to be a de-facto 
standard.

And then we have issue 1757072, which is identical to this one and was closed 
won't fix, but apparently only because the source of the corrupted zip files 
wasn't identified, which this issue does do.

Interestingly, issue 669036 claims that zipfile.py supports garbage at the 
start, which makes tolerating garbage at the end seem sensibly symmetric.

Finally, comment support was added by the patch in issue 611760.  It would be 
interesting to know if garbage at the end was supported before that patch.  My 
guess is that it was, by ignoring it, but I haven't tested it.

Summary: if someone can review the actual patch, I think we should apply the 
issue 10298 patch along with Xuanji's test.  Xuanji, if you have the time and 
desire to add some additional tests that test comments with trailing data, that 
would be a bonus.  You could look at the tests in issue 9239 for ideas.

--
nosy: +rep, rfk

___
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



[issue10801] zipfile.ZipFile().extractall() header mismatch for non-ASCII characters

2010-12-31 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

FWIW, having just looked at related code in zipfile recently, this patch looks 
correct to me.

--
nosy: +r.david.murray

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



[issue10771] descriptor protocol documentation has two different definitions of owner class

2010-12-31 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

For future reference, the 'trunk' branch was frozen with the release of 2.7 in 
June 2010. However, this particular text is unchanged since in 2.7.1 and still 
in 3.2b2 (except for removal of 'new style'.)

--
nosy: +terry.reedy

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



[issue10772] Several actions for argparse arguments missing from docs

2010-12-31 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
nosy: +bethard
versions: +Python 3.2 -Python 3.3

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



[issue10782] Not possible to cross-compile due to poor detection of %lld support in printf

2010-12-31 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

Requests for information should go to python-list or other support forums. That 
said, does the response settle this issue, so that it can be closed, or is 
there still a claim that something should be changed in the Python repository?

--
nosy: +terry.reedy

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



[issue10786] unittest.TextTextRunner does not respect redirected stderr

2010-12-31 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

Since the current behavior matches the current doc,

class unittest.TextTestRunner(stream=sys.stderr, descriptions=True, 
verbosity=1, runnerclass=None, warnings=None) 
A basic test runner implementation which prints results on standard error. ...

this is a feature change request, not a bug report. Hence, the change should 
not be backported, lest it surprise someone. One could even question whether 
the change should be introduced now, but is does seem rather minor.

That aside, the doc needs to be changed and a version-changed note added. 
Something like

class unittest.TextTestRunner(stream=None, descriptions=True, verbosity=1, 
runnerclass=None, warnings=None) 
A basic test runner implementation. If *stream* is the default None, results go 
to standard error. ...
Version changed 3.2: default stream determined when class is instantiated 
rather than when imported.

--
nosy: +terry.reedy
type: behavior - feature request
versions:  -Python 2.7, Python 3.1

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



[issue10787] [random.gammavariate] Add the expression of the distribution in a comprehensive form for random.gammavariate

2010-12-31 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

From reading the Wikipedia article, I might conclude that beta = 1/theta, but 
from reading random.py, beta=theta. I think this much should be clarified, but 
without giving the formula in a hard to read text form. Perhaps the random doc 
should give reference to the much more complete numpy.random (and Wikipedia 
and/or Mathworld) entries rather than merely 'any statistics text' (many of 
which will not describe all).

--
nosy: +terry.reedy
versions: +Python 3.1, Python 3.2

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



[issue10789] Lock.acquire documentation is misleading

2010-12-31 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

Since threading is written in Python, one might expect Lock to be written in 
Python and its methods to accept keywords. However, threading.py (3.2) has
  _acquire_lock = _thread.acquire_lock
  Lock = _aquire_lock
so threading.Lock objects are C-coded _thread.lock objects and hence *might* 
not accept keyword args.

In 3.1:
lock.acquire([waitflag]) # same 2.7
Lock.acquire(blocking=True) # [blocking=1] in 2.7
Indeed the first is correct.

 from threading import Lock
 l=Lock()
 l.acquire(blocking=True)
Traceback (most recent call last):
  File pyshell#2, line 1, in module
l.acquire(blocking=True)
TypeError: acquire() takes no keyword arguments
 l.acquire(True)
True

r87596, r87596

In 3.2:
lock.acquire(waitflag=1, timeout=-1) 
Lock.acquire(blocking=True, timeout=-1)
The edit in 3.2 is actually correct 

 from threading import Lock
 l=Lock()
 l.acquire(blocking=True)
True
 l.acquire(timeout=1)
False

_thread.lock.acquire now accepts keywords.

--
assignee: d...@python - terry.reedy
nosy: +terry.reedy
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue10794] Infinite recursion while garbage collecting loops indefinitely

2010-12-31 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

2.6 is finished except for possible security patches.
This should be verified in a current release, preferably 3.2

--
nosy: +terry.reedy
stage:  - needs patch
versions: +Python 2.7 -Python 2.6

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



[issue9370] Add reader redirect from test package docs to unittest module

2010-12-31 Thread Nick Coghlan

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

Yeah, I think I wrote this issue based on the diff that added the new note at 
the top, rather than looking at the existing intro text that already references 
unittest and doctest.

No need to change anything after all.

--
resolution:  - invalid
status: open - closed

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



[issue10794] Infinite recursion while garbage collecting loops indefinitely

2010-12-31 Thread Gregory P. Smith

Gregory P. Smith g...@krypto.org added the comment:

it happens on 3.2 (py3k head).

--
Added file: http://bugs.python.org/file20208/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10794
___it happens on 3.2 (py3k head).br
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6285] Silent abort on XP help document display

2010-12-31 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


Removed file: http://bugs.python.org/file20199/z6285.diff

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



[issue6285] Silent abort on XP help document display

2010-12-31 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

I verified the bug by creating a copy of idlelib/help.txt, making the new help 
entry, testing it, deleting the copy, and retesting -- IDLE silently 
disappears. (A copy is necessary because IDLE checks that the file exists and 
gives a similar message as in the patch before posting the new menu item.) I 
decided that since a file can get renamed, moved, or deleted for various 
reasons, failure to open it should be caught.

I them tested my patch, found and fixed an typo-error (yes, testing is good 
even for simple patches!), found and fixed another bug in one of the two 
functions, and committed.
r87598, r97599, r87600

--
resolution:  - fixed
status: open - closed
Added file: http://bugs.python.org/file20209/z6285.diff

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



[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-12-31 Thread Matthew Barnett

Matthew Barnett pyt...@mrabarnett.plus.com added the comment:

Just to check, does this still work with your changes of msg124959?

regex.search(r'\d{4}(\s*\w)?\W*((?!\d)\w){2}', XX)

For me it fails to match!

--

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



[issue6285] Silent abort on XP help document display

2010-12-31 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

Bug and fix also apply to missing Idlelib/help.txt.
r87601 News entry for 3.2. Thanks Scott.

--

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



[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-12-31 Thread Jacques Grove

Jacques Grove aquara...@gmail.com added the comment:

You're correct, after the change:

regex.search(r'\d{4}(\s*\w)?\W*((?!\d)\w){2}', XX)

doesn't match (i.e. as before commit 7abd9f9bb1).

I was, however, just trying to narrow down which part of the code change killed 
the performance on my regression tests :-)

Happy new year to all out there.

--

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



[issue10801] zipfile.ZipFile().extractall() header mismatch for non-ASCII characters

2010-12-31 Thread Eli Bendersky

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

I'll try to produce a test in the next hour or two

--
nosy: +eli.bendersky

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



[issue10801] zipfile.ZipFile().extractall() header mismatch for non-ASCII characters

2010-12-31 Thread Eli Bendersky

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

I'm attaching a patch with a test for Martin's fix. I had trouble 
programmatically generating a bad zip for this bug, since it has different 
encodings for the header and filename (probably created by WinZip?). So I 
created a directory in test/ and placed the problematic zipfile M.Z. submitted 
in there, and wrote an appropriate test in test_zipfile.py

I verified the test fails on py3k trunk before Martin's fix, and succeeds after 
it, both by running the test file directly and through regrtest.

Note: Tested only on Ubuntu

--
Added file: http://bugs.python.org/file20210/issue10801_test.1.patch

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



[issue10801] zipfile.ZipFile().extractall() header mismatch for non-ASCII characters

2010-12-31 Thread Eli Bendersky

Changes by Eli Bendersky eli...@gmail.com:


Removed file: http://bugs.python.org/file20210/issue10801_test.1.patch

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



[issue10801] zipfile.ZipFile().extractall() header mismatch for non-ASCII characters

2010-12-31 Thread Eli Bendersky

Changes by Eli Bendersky eli...@gmail.com:


Added file: http://bugs.python.org/file20211/issue10801_test.1.patch

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