announcing: testing-in-python mailing list

2007-03-03 Thread Titus Brown
Folks, catalyzed by the great fun we had at PyCon '07, Grig Gheorghiu and I have created the testing-in-python (or TIP) mailing list. This list will hopefully serve as a forum for discussing Python testing tools, testing approaches useful in Python, Web resources for same, and whatever else

Re: Python 2.5, problems reading large ( 4Gbyes) files on win2k

2007-03-03 Thread casevh
On Mar 2, 10:09 am, [EMAIL PROTECTED] wrote: Folks, I've a Python 2.5 app running on 32 bit Win 2k SP4 (NTFS volume). Reading a file of 13 GBytes, one line at a time. It appears that, once the read line passes the 4 GByte boundary, I am getting occasional random line concatenations. Input

Re: classes and functions

2007-03-03 Thread James Stroud
Silver Rock wrote: Friends, I don´t see why using classes.. functions does everything already. I read the Rossum tutotial and two other already. Maybe this is because I am only writing small scripts, or some more serious misunderstandings of the language. Please give me a light.

Re: Perl and Python, a practical side-by-side example.

2007-03-03 Thread attn . steven . kuo
On Mar 2, 2:44 pm, Shawn Milo [EMAIL PROTECTED] wrote: (snipped) I'm attaching both the Perl and Python versions, and I'm open to comments on either. The script reads a file from standard input and finds the best record for each unique ID (piid). The best is defined as follows: The newest

print a ... z, A ... Z, \n' in Python

2007-03-03 Thread js
HI guys, How do you write Perl's print a ... z, A ... Z, \n' in Python In Python? A way I came up with is the following, but I'm sure this is ugly. ''.join(chr(c) for c in (range(ord('a'), ord('z')+1) + range(ord('A'), ord('Z')+1))) or crange = lambda c1, c2: [ chr(c) for c in

Re: Perl and Python, a practical side-by-side example.

2007-03-03 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Bjoern Schliessmann wrote: Bruno Desthuilliers wrote: Shawn Milo a écrit : if recs.has_key(piid) is False: 'is' is the identity operator - practically, in CPython, it compares memory addresses. You *dont* want to use it here. It's recommended to use is None;

Re: Sort with extra variables

2007-03-03 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Thomas Dybdahl Ahle wrote: Den Fri, 02 Mar 2007 21:13:02 +0100 skrev Bjoern Schliessmann: Thomas Dybdahl Ahle wrote: However I'd really like not to use the lambda, as it slows down the code. Did you check how much the slowdown is? Yes, the lambda adds 50%

Re: print a ... z, A ... Z, \n' in Python

2007-03-03 Thread Troy Melhase
How do you write Perl's print a ... z, A ... Z, \n' in Python In Python? you might consider this cheating, but it's packed with zen goodness: import string print string.letters abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ --

Re: cyclic iterators ?

2007-03-03 Thread tool69
Paul Rubin a écrit : As Bruno says, you can use itertools.cycle, but the problem above is that you're not looping repeatedly through the list; you yield all the elements, then yield the first element again, then stop. So for ['a','b','c'] you'd yield the sequence a,b,c,a. Yes, that was

Re: html sql client

2007-03-03 Thread gert
On Mar 2, 8:33 am, gert [EMAIL PROTECTED] wrote: On Mar 2, 7:33 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: In [EMAIL PROTECTED], gert wrote: I was thinking about making a column module that names the columns, i was hoping there would be some sort of api feature that already

Re: Perl and Python, a practical side-by-side example.

2007-03-03 Thread John Machin
On Mar 3, 7:08 pm, [EMAIL PROTECTED] wrote: On Mar 2, 2:44 pm, Shawn Milo [EMAIL PROTECTED] wrote: (snipped) I'm attaching both the Perl and Python versions, and I'm open to comments on either. The script reads a file from standard input and finds the best record for each unique ID

Re: print a ... z, A ... Z, \n' in Python

2007-03-03 Thread bearophileHUGS
js: crange = lambda c1, c2: [ chr(c) for c in range(ord(c1), ord(c2)+1) ] ''.join(chr(c) for c in crange('a', 'z') + crange('A', 'Z')) Yes, managing char ranges is a bit of pain with Python. You can also pack those chars: xcrange = lambda cc: (chr(c) for c in xrange(ord(cc[0]), ord(cc[1]) +1))

How to query a unicode data from sqlite database

2007-03-03 Thread Tzury
Can anyone tell the technique of composing a WHERE clause that refer to a unicode data. e.g. WHERE FirstName = ABCD where ABCD is the unicoded first name in the form that sqlite will match with its records. -- http://mail.python.org/mailman/listinfo/python-list

Re: Perl and Python, a practical side-by-side example.

2007-03-03 Thread William Heymann
On Saturday 03 March 2007, Ben Finney wrote: Bjoern Schliessmann [EMAIL PROTECTED] writes: if not recs.has_key(piid): # [1] Why not if piid not in recs: That is shorter, simpler, easier to read and very slightly faster. Plus you can change the data structure of recs later without

Re: print a ... z, A ... Z, \n' in Python

2007-03-03 Thread js
But note that you return the last item of the range too, and that goes against the semantic of the usual Python range/xrange, so you may want to call this function with another name. That makes sense. 100% agree with you. Maybe there are better ways to solve this problem. Maybe a way to

Re: print a ... z, A ... Z, \n' in Python

2007-03-03 Thread js
I forgot to cc pythonlist... # Thanks for you quick reply. I didn't know any string constants. From Python Library reference, 4.1.1 String constants: letters The concatenation of the strings lowercase and uppercase described below. The specific value is

Re: Perl and Python, a practical side-by-side example.

2007-03-03 Thread Ben Finney
William Heymann [EMAIL PROTECTED] writes: On Saturday 03 March 2007, Ben Finney wrote: Bjoern Schliessmann [EMAIL PROTECTED] writes: if not recs.has_key(piid): # [1] Why not if piid not in recs: That is shorter, simpler, easier to read and very slightly faster. Perhaps if

Re: Sort with extra variables

2007-03-03 Thread Diez B. Roggisch
Well, you'd have to define the function inside the sortMoves function, as it is where the variables exists. def sortMoves(board, table, ply, moves): def sortKey(move): return getMoveValue(board, table, ply, move) moves.sort(key=sortKey, reverse=True) return moves

Re: print a ... z, A ... Z, \n' in Python

2007-03-03 Thread MonkeeSage
js wrote: A way I came up with is the following, but I'm sure this is ugly. You could abuse __getitem__ (terribly, heh!) and use slice syntax... class crange(): def __init__(self): self.valid = range(47,58) + range(65,91) + range(97,123) def __getitem__(self, s): if

Re: Sort with extra variables

2007-03-03 Thread Thomas Dybdahl Ahle
Den Sat, 03 Mar 2007 11:26:08 +0100 skrev Diez B. Roggisch: Well, you'd have to define the function inside the sortMoves function, as it is where the variables exists. def sortMoves(board, table, ply, moves): def sortKey(move): return getMoveValue(board, table, ply, move)

Re: print a ... z, A ... Z, \n' in Python

2007-03-03 Thread Lloyd Zusman
js [EMAIL PROTECTED] writes: But note that you return the last item of the range too, and that goes against the semantic of the usual Python range/xrange, so you may want to call this function with another name. That makes sense. 100% agree with you. Maybe there are better ways to solve

Re: Converting a c array to python list

2007-03-03 Thread zefciu
Russell E. Owen wrote: It might help to have a clearer idea of why you want to do this. I am writing a Mandelbrot fractal generator with Tkinter interface. Now the generation works like this - there is a loop in python which iterates through fractal's pixels and for each of them calls a

Re: print a ... z, A ... Z, \n' in Python

2007-03-03 Thread js
Maybe we don't want char range If string constants would be rich enough. But as soon as we want a string that doesn't correspond to any pre-defined constants, we're hosed. For example, there isn't a constant that would correspond to this Perl-ism: print l ... w, e ... j, L ... W, E

Re: Python 2.5, problems reading large ( 4Gbyes) files on win2k

2007-03-03 Thread Bill Tydeman
Just curious, but since the file size limitation on NTFS is 4 GB, have you confirmed that it isn't some other part of the interaction that is causing the problem? What FS is hosting the files? On 2 Mar 2007 10:09:15 -0800, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Folks, I've a Python 2.5

Re: A more navigable Python Library Reference page

2007-03-03 Thread [EMAIL PROTECTED]
Google doesn't seem to let you add attachments so I've put a sample of the output here:http://www.qtrac.eu/libindex.html at the bottom of the page there is a link to the ~100 line libindex.py script that generated it. I like it. thanks. --

Re: Perl and Python, a practical side-by-side example.

2007-03-03 Thread Paddy
On Mar 2, 10:44 pm, Shawn Milo [EMAIL PROTECTED] wrote: I'm new to Python and fairly experienced in Perl, although that experience is limited to the things I use daily. I wrote the same script in both Perl and Python, and the output is identical. The run speed is similar (very fast) and the

Re: print a ... z, A ... Z, \n' in Python

2007-03-03 Thread Alex Martelli
js [EMAIL PROTECTED] wrote: HI guys, How do you write Perl's print a ... z, A ... Z, \n' in Python In Python? This specific one is easy, though this doesn't generalize: import string print string.lowercase + string.uppercase For the general case, there's no way to avoid calling

Re: print a ... z, A ... Z, \n' in Python

2007-03-03 Thread Alex Martelli
js [EMAIL PROTECTED] wrote: I forgot to cc pythonlist... # Thanks for you quick reply. I didn't know any string constants. From Python Library reference, 4.1.1 String constants: letters The concatenation of the strings lowercase and uppercase described

Randomizing in Python

2007-03-03 Thread [EMAIL PROTECTED]
I want to randomize a certain calculation in Python but haven't figured it out yet. To explain what i mean, I' m going to use an example: I want to get the numbers to do a random experience database for a game. What would be necessary to do so? --

qcombobox.findtext and matchflags.matchendswith

2007-03-03 Thread borntonetwork
Hi. Using the PyQt4 library, I am trying to use the following function(cbo is a qtcombobox): cbo.findText(searchStr, QtCore.MatchEndsWith) If I don't use the QtCore.MatchEndsWith, the function works properly, but doesn't return partial matches ending with searchStr. If I use

Re: Randomizing in Python

2007-03-03 Thread Mark Nenadov
On Sat, 03 Mar 2007 08:46:09 -0800, [EMAIL PROTECTED] wrote: I want to randomize a certain calculation in Python but haven't figured it out yet. To explain what i mean, I' m going to use an example: I want to get the numbers to do a random experience database for

Re: qcombobox.findtext and matchflags.matchendswith

2007-03-03 Thread Phil Thompson
On Saturday 03 March 2007 4:52 pm, borntonetwork wrote: Hi. Using the PyQt4 library, I am trying to use the following function(cbo is a qtcombobox): cbo.findText(searchStr, QtCore.MatchEndsWith) If I don't use the QtCore.MatchEndsWith, the function works properly, but doesn't return

Re: Perl and Python, a practical side-by-side example.

2007-03-03 Thread Jussi Salmela
Shawn Milo kirjoitti: snip I am not looking for the smallest number of lines, or anything else that would make the code more difficult to read in six months. Just any instances where I'm doing something inefficiently or in a bad way. I'm attaching both the Perl and Python versions, and

Re: class attrdict

2007-03-03 Thread Andrew Coffman
Could you do something like this? class attrdict(dict): def __getattr__(self, attr): if self.has_key(attr): return self[attr] else: message = 'attrdict' object has no attribute '%s' % attr raise AttributeError, message If you have a

py2exe: LoadLibrary(pythondll) failed

2007-03-03 Thread zxo102
Hi there, I py2exe my test.py as test.exe with a lot of dll and pyc in that directory. If I move the test.exe into another directory and run it from there, it gives me an error LoadLibrary(pythondll) failed... python24.dll. How can I set it up correctly for this test.exe to run? Thanks.

How to set docstrings for extensions supporting PyNumberMethods?

2007-03-03 Thread Nick Alexander
Hello, I am writing a python extension (compiled C code) that defines an extension type with PyNumberMethods. Everything works swimmingly, except I can't deduce a clean way to set the docstring for tp_* methods. That is, I always have type.__long__.__doc__ == 'x.__long__() == long(x)' which a

Re: class attrdict

2007-03-03 Thread Alex Martelli
Andrew Coffman [EMAIL PROTECTED] wrote: Could you do something like this? class attrdict(dict): def __getattr__(self, attr): if self.has_key(attr): return self[attr] else: message = 'attrdict' object has no attribute '%s' % attr

Re: print a ... z, A ... Z, \n' in Python

2007-03-03 Thread rzed
[EMAIL PROTECTED] (Alex Martelli) wrote in news:[EMAIL PROTECTED]: js [EMAIL PROTECTED] wrote: HI guys, How do you write Perl's print a ... z, A ... Z, \n' in Python In Python? This specific one is easy, though this doesn't generalize: import string print

Re: pyHook or SetWindowsHookEx

2007-03-03 Thread sturlamolden
On Mar 2, 7:01 pm, abcd [EMAIL PROTECTED] wrote: :( The answer depends on which GUI library you use. E.g. if you use MFC there is an object called win32ui.PyCWnd that has methods for hooking key strokes. -- http://mail.python.org/mailman/listinfo/python-list

Re: classes and functions

2007-03-03 Thread Arnaud Delobelle
On Mar 2, 11:01 pm, Nicholas Parsons [EMAIL PROTECTED] wrote: Hi Claire, That is the beauty of using Python. You have a choice of using classes and traditional OOP techniques or sticking to top level functions. For short, small scripts it would probably be overkill to use classes.

pop method question

2007-03-03 Thread Nicholas Parsons
Howdy Folks, I was just playing around in IDLE at the interactive prompt and typed in dir({}) for the fun of it. I was quite surprised to see a pop method defined there. I mean is that a misnomer or what? From the literature, pop is supposed to be an operation defined for a stack data

Re: pop method question

2007-03-03 Thread Stefan Scholl
Nicholas Parsons [EMAIL PROTECTED] wrote: I realize that in this context it is used for removing a specific key from the current dictionary object. But why call it pop and not something more intuitive like remove or delete? I wasn't a python programmer back than, but I'd guess it's

Re: pop method question

2007-03-03 Thread Paul Rubin
Nicholas Parsons [EMAIL PROTECTED] writes: I was just playing around in IDLE at the interactive prompt and typed in dir({}) for the fun of it. I was quite surprised to see a pop method defined there. I mean is that a misnomer or what? From the literature, pop is supposed to be an operation

Re: pop method question

2007-03-03 Thread Nicholas Parsons
On Mar 3, 2007, at 3:49 PM, Paul Rubin wrote: Nicholas Parsons [EMAIL PROTECTED] writes: I was just playing around in IDLE at the interactive prompt and typed in dir({}) for the fun of it. I was quite surprised to see a pop method defined there. I mean is that a misnomer or what? From the

Re: qcombobox.findtext and matchflags.matchendswith

2007-03-03 Thread borntonetwork
On Mar 3, 12:17 pm, Phil Thompson [EMAIL PROTECTED] wrote: On Saturday 03 March 2007 4:52 pm,borntonetworkwrote: Hi. Using the PyQt4 library, I am trying to use the following function(cbo is a qtcombobox): cbo.findText(searchStr, QtCore.MatchEndsWith) If I don't use the

portable Python ifconfig

2007-03-03 Thread Bart Van Loon
Hi all, I'm looking for a portable (FreeBSD and Linux) way of getting typical ifconfig information into Python. Some research on the web brought me to Linux only solutions http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/439094

Re: Questions about app design - OOP with python classes

2007-03-03 Thread Steven D'Aprano
On Fri, 02 Mar 2007 09:30:20 +0100, Diez B. Roggisch wrote: A type system doesn't help. So what if they're both floats? The test is still bogus, your code will still wait too long to engage the retro-rockets, and the billion dollar space craft will still be travelling at hundreds of miles an

Re: py2exe: LoadLibrary(pythondll) failed

2007-03-03 Thread Sick Monkey
(1) You may want to read the following links: http://docs.python.org/dist/describing-extensions.html#SECTION00234 which came from: http://docs.python.org/dist/dist.html Here is another good resource for py2exe: http://www.py2exe.org/index.cgi/GeneralTipsAndTricks (2) Also, you

are there any Piecewise Cubic Hermite Interpolating Polynomial in python

2007-03-03 Thread jitasi
Hi all I want to use the matlab function pchip in python. I have checked the scipy, but there is only spline Interpolating. Are there any pchip Interpolating in python? Thanks Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: class attrdict

2007-03-03 Thread MonkeeSage
On Mar 3, 1:29 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: It would be nice, yes, weren't it for the inevitable irregularity, one way or another, caused by the clash between attributes and items. In thinking about it, I think this might fall under 'we're all consenting adults here'. I mean,

Python FTP server down

2007-03-03 Thread John Nagle
ftp://ftp.python.org/pub/; is returning Connection Refused today. Does that ever work? I need FTP access to download onto a colocated server. John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: Questions about app design - OOP with python classes

2007-03-03 Thread Paul Rubin
Steven D'Aprano [EMAIL PROTECTED] writes: Multi-Level-Specification allows you to express physical quantities with their respective unit, and operations on them to yield the combined unit at compile-time. There are some rather complicated cases where simple unification won't solve the

Re: py2exe: LoadLibrary(pythondll) failed

2007-03-03 Thread Thomas Heller
zxo102 schrieb: Hi there, I py2exe my test.py as test.exe with a lot of dll and pyc in that directory. If I move the test.exe into another directory and run it from there, it gives me an error LoadLibrary(pythondll) failed... python24.dll. How can I set it up correctly for this test.exe

Re: pop method question

2007-03-03 Thread Steven D'Aprano
On Sat, 03 Mar 2007 15:56:39 -0500, Nicholas Parsons wrote: On Mar 3, 2007, at 3:49 PM, Paul Rubin wrote: Nicholas Parsons [EMAIL PROTECTED] writes: I was just playing around in IDLE at the interactive prompt and typed in dir({}) for the fun of it. I was quite surprised to see a pop

Re: cyclic iterators ?

2007-03-03 Thread MRAB
On Mar 3, 1:27 am, Paul Rubin http://[EMAIL PROTECTED] wrote: Tool69 [EMAIL PROTECTED] writes: I've tried something like this to have a cyclic iterator without sucess: def iterate_mylist(my_list): k = len((my_list) i=0 while i = k : yield my_list[i] i

Re: pop method question

2007-03-03 Thread jim-on-linux
On Saturday 03 March 2007 15:56, Nicholas Parsons wrote: On Mar 3, 2007, at 3:49 PM, Paul Rubin wrote: Nicholas Parsons [EMAIL PROTECTED] writes: I was just playing around in IDLE at the interactive prompt and typed in dir({}) for the fun of it. I was quite surprised to see a pop

Re: Questions about app design - OOP with python classes

2007-03-03 Thread Steven D'Aprano
On Thu, 01 Mar 2007 21:53:09 -0800, Paul Rubin wrote: Steven D'Aprano [EMAIL PROTECTED] writes: That still sounds like an unreliable manual type system, It's unreliable in the sense that the coder has to follow the naming convention, and must have some bare minimum of sense. If your coders

Re: pop method question

2007-03-03 Thread Steven D'Aprano
On Sat, 03 Mar 2007 18:13:18 -0500, jim-on-linux wrote: On Saturday 03 March 2007 15:56, Nicholas Parsons wrote: On Mar 3, 2007, at 3:49 PM, Paul Rubin wrote: Nicholas Parsons [EMAIL PROTECTED] writes: I was just playing around in IDLE at the interactive prompt and typed in dir({})

Re: pop method question

2007-03-03 Thread James Stroud
Steven D'Aprano wrote: I personally don't see that pop has any advantage, especially since the most useful example while some_dict: do_something_with(some_dict.pop()) doesn't work. Instead you have to write this: for key in some_dict.keys(): # can't iterate over the

Re: Questions about app design - OOP with python classes

2007-03-03 Thread Paul Rubin
Steven D'Aprano [EMAIL PROTECTED] writes: Unless there is a type system that can automatically deal with the semantic difference between (say) screen coordinates and window coordinates, or between height and width, or safe and unsafe strings, the coder still has to deal with it themselves.

Re: pop method question

2007-03-03 Thread Paul Rubin
James Stroud [EMAIL PROTECTED] writes: for akey in dict1: if some_condition(akey): dict2[akey] = dict2.pop(akey) Which necessitates a key is a little cleaner than your latter example. Yeah, I also think removing keys from a dict while iterating over it (like in Steven's examples)

Problem with returning prime number in a simple calculation program

2007-03-03 Thread QHorizon
Hello, I'm new to Python (I've learned everything up to iterators so far) and fairly new to Programming. This would be my first real program: #Coordinate Geometry (The whole program is not shown) import math import sys print Welcome to the Coordinate Geometry Calculator! print Type 'terms' for

Re: pop method question

2007-03-03 Thread Steven D'Aprano
On Sat, 03 Mar 2007 23:22:10 +, James Stroud wrote: To my mind, having to supply a key to dict.pop makes it rather pointless. I've used it in something like this and found it worthwhile: for akey in dict1: if some_condition(akey): dict2[akey] = dict2.pop(akey) Surely

Re: Eric on XP for Newbie

2007-03-03 Thread SPE - Stani's Python Editor
On Mar 1, 11:39 am, [EMAIL PROTECTED] wrote: Thanks guys Found this on another blog and it seems to work - you need to run theSPE.pyo file ... Which blog? Can yo point me to the url? Stani -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with returning prime number in a simple calculation program

2007-03-03 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: [reformatted indentation] def prime(): num = input(Number ) i = num - 1 divcounter = 0 while i 1: if num % i != 0 divcounter += 1 i -= 1 if divcounter == num - 2: print num, is a prime number

logging into forms on an ssl server using python

2007-03-03 Thread socialanxiety
Hi, I need some help, I'm trying to create a script that will fill in the forms on an ssl website, and submit them. Could anyone help me out, examples would be nice. Thanks in advance -- http://mail.python.org/mailman/listinfo/python-list

Re: pop method question

2007-03-03 Thread Steven D'Aprano
On Sat, 03 Mar 2007 15:36:14 -0800, Paul Rubin wrote: James Stroud [EMAIL PROTECTED] writes: for akey in dict1: if some_condition(akey): dict2[akey] = dict2.pop(akey) Which necessitates a key is a little cleaner than your latter example. Yeah, I also think removing keys from a

Re: pop method question

2007-03-03 Thread James Stroud
Steven D'Aprano wrote: On Sat, 03 Mar 2007 23:22:10 +, James Stroud wrote: To my mind, having to supply a key to dict.pop makes it rather pointless. I've used it in something like this and found it worthwhile: for akey in dict1: if some_condition(akey): dict2[akey] =

Re: thread safe SMTP module

2007-03-03 Thread Aahz
In article [EMAIL PROTECTED], Gordon Messmer [EMAIL PROTECTED] wrote: I believe that I've seen this discussed previously, so maybe there's some interest in it. I wrote a threaded mail filtering framework a while ago, and one of the modules does address verification via SMTP. Since smtplib.SMTP

Re: py2exe: LoadLibrary(pythondll) failed

2007-03-03 Thread zxo102
On 3月4日, 上午6时50分, Thomas Heller [EMAIL PROTECTED] wrote: zxo102 schrieb: Hi there, I py2exe my test.py as test.exe with a lot of dll and pyc in that directory. If I move the test.exe into another directory and run it from there, it gives me an error LoadLibrary(pythondll) failed...

Re: Problem with returning prime number in a simple calculation program

2007-03-03 Thread Steven D'Aprano
On Sat, 03 Mar 2007 15:36:36 -0800, QHorizon wrote: Hello, I'm new to Python (I've learned everything up to iterators so far) and fairly new to Programming. This would be my first real program: #Coordinate Geometry (The whole program is not shown) import math import sys print

Re: pop method question

2007-03-03 Thread Raymond Hettinger
[Nicholas Parsons] Dictionaries in Python have no order but are sequences. Now, does anyone know why the python core has this pop method implemented for a dictionary type? I realize that in this context it is used for removing a specific key from the current dictionary object. But

Re: portable Python ifconfig

2007-03-03 Thread MonkeeSage
On Mar 3, 3:38 pm, Bart Van Loon [EMAIL PROTECTED] wrote: I'm looking for a portable (FreeBSD and Linux) way of getting typical ifconfig information into Python. Here's a pure python version of the C extension, based on the recipes you posted. In this version, the 'addr' key will not exist for

Re: portable Python ifconfig

2007-03-03 Thread MonkeeSage
On Mar 3, 7:17 pm, MonkeeSage [EMAIL PROTECTED] wrote: I'm pretty sure the offsets would be different for BSD Then again, mabye not. http://freebsd.active-venture.com/FreeBSD-srctree/newsrc/compat/linux/linux_ioctl.h.html Regards, Jordan -- http://mail.python.org/mailman/listinfo/python-list

Re: print a ... z, A ... Z, \n' in Python

2007-03-03 Thread Alex Martelli
rzed [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (Alex Martelli) wrote in news:[EMAIL PROTECTED]: js [EMAIL PROTECTED] wrote: HI guys, How do you write Perl's print a ... z, A ... Z, \n' in Python In Python? This specific one is easy, though this doesn't

Re: class attrdict

2007-03-03 Thread Alex Martelli
MonkeeSage [EMAIL PROTECTED] wrote: On Mar 3, 1:29 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: It would be nice, yes, weren't it for the inevitable irregularity, one way or another, caused by the clash between attributes and items. In thinking about it, I think this might fall under

Re: class attrdict

2007-03-03 Thread MonkeeSage
On Mar 3, 7:54 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: Besides missing the warning in the __init__, this also has pretty weird behavior whenever subject to a .pop, .update, .setdefault, del of either item or attr, etc, etc: the attributes and items get out of sync (and, catching each and

Re: pop method question

2007-03-03 Thread Alex Martelli
Steven D'Aprano [EMAIL PROTECTED] wrote: ... while some_dict: do_something_with(some_dict.pop()) doesn't work. Instead you have to write this: You have to use .popitem for this -- that's what's it's for... Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: pop method question

2007-03-03 Thread Alex Martelli
Raymond Hettinger [EMAIL PROTECTED] wrote: ... The notion that pop is only defined for stack operations is somewhat pedantic. Worse: it's totally wrong. It's also defined for eyes, as a musical genre, as a kind of soda, as an avant-garde artistic movement of the '50s, for baloons, as a

Re: pyHook or SetWindowsHookEx

2007-03-03 Thread Jordan
On Feb 27, 9:01 am, abcd [EMAIL PROTECTED] wrote: I am having trouble with pyHook on python 2.4.1. Basically I have a python app that uses pyHook to capture keyboard events and write them straight to a file. The application is running as a service on a windows machine. If I am at that

Re: class attrdict

2007-03-03 Thread Alex Martelli
MonkeeSage [EMAIL PROTECTED] wrote: On Mar 3, 7:54 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: Besides missing the warning in the __init__, this also has pretty weird behavior whenever subject to a .pop, .update, .setdefault, del of either item or attr, etc, etc: the attributes and items

Re: portable Python ifconfig

2007-03-03 Thread MonkeeSage
Bart, Can you try this and let us know if it works for FreeBSD? import socket, fcntl, struct def _ifinfo(sock, addr, ifname): iface = struct.pack('256s', ifname[:15]) info = fcntl.ioctl(sock.fileno(), addr, iface) if addr == 0x8927: hwaddr = [] for char in

Re: pop method question

2007-03-03 Thread Nicholas Parsons
Hi Raymond, Thank you for your clarification below. I was just using remove and delete as possible alternatives to the name pop without much contemplation. Like you say below, it begs the question as to why not have two separate operations for dictionaries (retrieval of value from key

distutils - script install check file existence before copy?

2007-03-03 Thread [EMAIL PROTECTED]
Not sure if it is possible to do this - I know distutils has force option that can be turned on/off for install_data, but is it possible to do something somewhat complicated - have a data file named YYY, need to copy it to share/script/YYY only if share/script/YYY does not already exist,

Re: pop method question

2007-03-03 Thread MonkeeSage
Nick, In regards to stack-like objects, pop() implies mutation of the reciever and returning the item 'popped' off the stack. The same _semantic_ meaning can be used for pop() regarding dictionaries, even though the _implementation_ would be different: dict.pop(key) mutates the reciever and

running warnings

2007-03-03 Thread memcached
I wrote these codes pieces: try: import termios, TERMIOS except ImportError: try: import msvcrt except ImportError: try: from EasyDialogs import AskPassword except ImportError: getpass = default_getpass else: getpass = AskPassword else: getpass = win_getpass else: getpass = unix_getpass

Re: Non Sequitur

2007-03-03 Thread Ben Finney
Dennis Lee Bieber [EMAIL PROTECTED] writes: I before E Except after C Or when sounded as A As in Neighbor and Weigh Yes, like the A sound in weird or ceiling. -- \Most people don't realize that large pieces of coral, which | `\

Re: portable Python ifconfig

2007-03-03 Thread Bart Van Loon
It was 3 Mar 2007 18:43:57 -0800, when MonkeeSage wrote: Bart, Can you try this and let us know if it works for FreeBSD? thanks for you suggestions! import socket, fcntl, struct def _ifinfo(sock, addr, ifname): iface = struct.pack('256s', ifname[:15]) info =

Python 2.5 incompatible with Fedora Core 6 - packaging problems again

2007-03-03 Thread John Nagle
I've been installing Python and its supporting packages on a dedicated server with Fedora Core 6 for about a day now. This is a standard dedicated rackmount server in a colocation facility, controlled via Plesk control panel, and turned over to me with Fedora Core 6 in an empty state. This is

Re: Non Sequitur

2007-03-03 Thread Alex Martelli
Ben Finney [EMAIL PROTECTED] wrote: Dennis Lee Bieber [EMAIL PROTECTED] writes: I before E Except after C Or when sounded as A As in Neighbor and Weigh Yes, like the A sound in weird or ceiling. ceiling falls under the except after C exception.

Re: Questions about app design - OOP with python classes

2007-03-03 Thread John Nagle
Steven D'Aprano wrote: On Fri, 02 Mar 2007 09:30:20 +0100, Diez B. Roggisch wrote: A type system doesn't help. So what if they're both floats? The test is still bogus, your code will still wait too long to engage the retro-rockets, and the billion dollar space craft will still be travelling

Re: are there any Piecewise Cubic Hermite Interpolating Polynomial inpython

2007-03-03 Thread Terry Reedy
jitasi [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | Hi all | | I want to use the matlab function pchip in python. | I have checked the scipy, but there is only spline Interpolating. | Are there any pchip Interpolating in python? Putting p.. c.. h.. i.. p... Python into Google

[ python-Bugs-1672853 ] Error reading files larger than 4GB

2007-03-03 Thread SourceForge.net
Bugs item #1672853, was opened at 2007-03-03 00:01 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1672853group_id=5470 Please note that this message will contain a full copy of

[ python-Bugs-1672336 ] Building python 2.5 for AMD64 (windows) and VS2005

2007-03-03 Thread SourceForge.net
Bugs item #1672336, was opened at 2007-03-02 11:16 Message generated for change (Comment added) made by krisvale You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1672336group_id=5470 Please note that this message will contain a full copy of the comment

[ python-Bugs-1672336 ] Building python 2.5 for AMD64 (windows) and VS2005

2007-03-03 Thread SourceForge.net
Bugs item #1672336, was opened at 2007-03-02 12:16 Message generated for change (Comment added) made by loewis You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1672336group_id=5470 Please note that this message will contain a full copy of the comment

[ python-Bugs-1672336 ] Building python 2.5 for AMD64 (windows) and VS2005

2007-03-03 Thread SourceForge.net
Bugs item #1672336, was opened at 2007-03-02 11:16 Message generated for change (Comment added) made by krisvale You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1672336group_id=5470 Please note that this message will contain a full copy of the comment

[ python-Bugs-1672336 ] Building python 2.5 for AMD64 (windows) and VS2005

2007-03-03 Thread SourceForge.net
Bugs item #1672336, was opened at 2007-03-02 12:16 Message generated for change (Comment added) made by fred2k You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1672336group_id=5470 Please note that this message will contain a full copy of the comment

[ python-Bugs-1672336 ] Building python 2.5 for AMD64 (windows) and VS2005

2007-03-03 Thread SourceForge.net
Bugs item #1672336, was opened at 2007-03-02 12:16 Message generated for change (Comment added) made by loewis You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1672336group_id=5470 Please note that this message will contain a full copy of the comment

[ python-Bugs-1672336 ] Building python 2.5 for AMD64 (windows) and VS2005

2007-03-03 Thread SourceForge.net
Bugs item #1672336, was opened at 2007-03-02 12:16 Message generated for change (Comment added) made by fred2k You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1672336group_id=5470 Please note that this message will contain a full copy of the comment

[ python-Bugs-1672336 ] Building python 2.5 for AMD64 (windows) and VS2005

2007-03-03 Thread SourceForge.net
Bugs item #1672336, was opened at 2007-03-02 11:16 Message generated for change (Comment added) made by krisvale You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1672336group_id=5470 Please note that this message will contain a full copy of the comment

  1   2   >