Re: how to ncurses on win32 platform

2005-01-26 Thread adam . vandenberg
> * Curses for Windows for Python (It was previously > mentioned on a follow-up. there are some missing > features): > http://flangy.com/dev/python/curses/ I've posted an update to this module (better color support, half delay input, some other stuff) and the source code, in case anyone wants to

Re: String Fomat Conversion

2005-01-26 Thread Steven Bethard
Stephen Thorne wrote: f = file('input', 'r') labels = f.readline() # consume the first line of the file. Easy Option: for line in f.readlines(): x, y = line.split() x = float(x) y = float(y) Or, more concisely: for line in f.readlines(): x, y = map(float, line.split()) Somewhat more memory

(no subject)

2005-01-26 Thread fireeagle
Subscribe -- http://mail.python.org/mailman/listinfo/python-list

Re: exclude binary files from os.walk

2005-01-26 Thread Craig Ringer
On Wed, 2005-01-26 at 17:32 -0500, rbt wrote: > Grant Edwards wrote: > > On 2005-01-26, rbt <[EMAIL PROTECTED]> wrote: > > > > > >>Is there an easy way to exclude binary files (I'm working on > >>Windows XP) from the file list returned by os.walk()? > > > > > > Sure, assuming you can provide a

Re: python without OO

2005-01-26 Thread Craig Ringer
On Wed, 2005-01-26 at 22:28 -0500, Davor wrote: > I browsed docs a bit today, and they also confirm what I have believed - > that OO is totally secondary in Python. In fact, > object/classes/metaclasses are nothing but *dictionaries with identity* > in python. Love this approach. I was really

Re: python without OO

2005-01-26 Thread Isaac To
> "beliavsky" == beliavsky <[EMAIL PROTECTED]> writes: beliavsky> I think the OO way is slightly more obscure. It's beliavsky> obvious what x = reverse(x) does, but it is not clear beliavsky> unless you have the source code whether x.reverse() beliavsky> reverses x or if it re

python module in webmin

2005-01-26 Thread sam
Hi, Had anyone written any python module for webmin? Since webmin is written in perl, but I want to write a python app/module used by webmin. If you know the detail of writing a python module for use in perl webmin, please drop me some guideline. Perhaps It is better off to find/write a python

Re: What's so funny? WAS Re: rotor replacement

2005-01-26 Thread phr
Jeremy Bowers <[EMAIL PROTECTED]> writes: > The policy has been laid out, multiple times, by multiple people now. The > answer is, you are not going to get any such indication that will satisfy > you. Actually I already got an indication that satisfied me, from Guido and Andrew, although it was la

Re: Which is faster?

2005-01-26 Thread Terry Reedy
"Aggelos I. Orfanakos" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Any idea which of the following is faster? > > 'a/b/c/'[:-1] > 'a/b/c/'.rstrip('/') I find the first easier to read and mentally process. Others may have a different answer. But perhaps you meant with the CPy

Re: how to write a tutorial

2005-01-26 Thread Craig Ringer
On Wed, 2005-01-26 at 09:35 +, Keith Thompson wrote: > "Xah Lee" <[EMAIL PROTECTED]> writes: > [snip] > > Following is a tutorial on Python's classes. > [snip] > > Please stop posting this to comp.lang.c. I'm sure the folks in most > of the other newsgroup aren't interested either -- or if th

Re: What's so funny? WAS Re: rotor replacement

2005-01-26 Thread Jeremy Bowers
On Thu, 27 Jan 2005 04:04:38 +, phr wrote: > Skip Montanaro <[EMAIL PROTECTED]> writes: >> Because good requirements specification is difficult and testing improves >> the breed. Better to have the major API changes and bugs taken care of, and >> to have its popularity demonstrated *before* i

Re: String Fomat Conversion

2005-01-26 Thread Stephen Thorne
On 26 Jan 2005 20:53:02 -0800, mcg <[EMAIL PROTECTED]> wrote: > Investigating python day 1: > > Data in file: > x y > 1 2 > 3 4 > 5 6 > > Want to read file into an array of pairs. > > in c: scanf("%d %d",&x,&y)---store x y in array, loop. > > How do I do this in python?? > In the actual

String Fomat Conversion

2005-01-26 Thread mcg
Investigating python day 1: Data in file: x y 1 2 3 4 5 6 Want to read file into an array of pairs. in c: scanf("%d %d",&x,&y)---store x y in array, loop. How do I do this in python?? In the actual application, the pairs are floating pt i.e. -1.003 -- http://mail.python.org/mailman/l

Re: building Python: up arrow broken on SuSE Linux 8.2

2005-01-26 Thread Erik Johnson
"Erik Johnson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > So I downloaded & built libreadline version 5.0. I have libreadline.a > and shlib/libreadline.so.5.0 files. Having done Python & other scripting > languages for a while, I have sort of forgotten all the ugly details

Re: python without OO

2005-01-26 Thread John Hunter
> "beliavsky" == beliavsky <[EMAIL PROTECTED]> writes: beliavsky> I think the OO way is slightly more obscure. It's beliavsky> obvious what x = reverse(x) does, but it is not clear beliavsky> unless you have the source code whether x.reverse() You don't need to read the src, you

Re: python without OO

2005-01-26 Thread Casey Hawthorne
"The object-oriented programming paradigm has an undeserved reputation as being complicated; most of the complexity of languages such as C++ and Java has nothing to do with their object orientation but comes instead from the type declarations and the mechanisms to work around them. This is a prime

Re: What's so funny? WAS Re: rotor replacement

2005-01-26 Thread phr
Skip Montanaro <[EMAIL PROTECTED]> writes: > Because good requirements specification is difficult and testing improves > the breed. Better to have the major API changes and bugs taken care of, and > to have its popularity demonstrated *before* it gets into the Python > distribution. The best way

Re: Where can I find Mk4py.dll for python24 ?

2005-01-26 Thread Erik Johnson
I don't know what metakit or the file you are looking for is, but a simple search on google turns up the following article where a guy built it for Python 2.2 and was willing to mail that to people. Try contacting him: http://www.equi4.com/pipermail/metakit/2002-March/000560.html HTH, -ej "

Re: python without OO

2005-01-26 Thread beliavsky
John Hunter wrote: > > "Davor" == Davor <[EMAIL PROTECTED]> writes: > > Davor> not really - it was not my intention at all - but it seems > Davor> people get upset whenever this OO stuff is mentioned - and > Davor> what I did not expect at all at this forum as I believed > Davo

Re: threading.py Condition wait overflow error

2005-01-26 Thread Tim Peters
[Tim Peters] ... >> The most common cause for "impossible exceptions" > is flawed C code in an extension that fails to >> check a Python C API call for an error return. [Mark English] > Yes, I use a lot of C modules which I wrote. Then you know where to start looking . > It could certainly be o

Re: python without OO

2005-01-26 Thread Davor
I'd like to thank everyone for their replies. The main important lesson I got is: Python does not have that many issues with misuse of OO as compared to Java/C++ because it's *dynamically* typed language and extremely powerful *dictionary* data structure. I browsed docs a bit today, and they a

Re: 20050126 find replace strings in file

2005-01-26 Thread alex23
kosh wrote: > Nah it is daily humor. Just think of it like a joke list. :) Or a daily puzzler: how many blatantly stupid things can you find in 5 mins? -- http://mail.python.org/mailman/listinfo/python-list

Re: python without OO

2005-01-26 Thread John Hunter
> "Davor" == Davor <[EMAIL PROTECTED]> writes: Davor> not really - it was not my intention at all - but it seems Davor> people get upset whenever this OO stuff is mentioned - and Davor> what I did not expect at all at this forum as I believed Davor> Python people should not be

Re: building Python: up arrow broken on SuSE Linux 8.2

2005-01-26 Thread Erik Johnson
> Do you have the GNU readline library installed and within Python's > reach (lib in LD_LIBRARY_PATH or in /etc/ld.so.conf with subsequent > call of ldconfig)? I think you are on the right path. I later found an Apple article online that answered essentially my question saying libreadline w

Re: python without OO

2005-01-26 Thread Davor
Timo Virkkala wrote: This guy has got to be a troll. No other way to understand. not really - it was not my intention at all - but it seems people get upset whenever this OO stuff is mentioned - and what I did not expect at all at this forum as I believed Python people should not be so OO hardco

Re: Which is faster?

2005-01-26 Thread Aggelos I. Orfanakos
Yes, I could do the timing myself. Sorry if this was impolite -- it was not in my intentions. The main reason I asked was about the reason. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: What's so funny? WAS Re: rotor replacement

2005-01-26 Thread Skip Montanaro
phr> I don't see why you can't make up your mind enough to issue simple phr> statements like "the Python lib should have a module that does phr> so-and-so, and it should meet such-and-such requirements, so if phr> someone submits one that meets the requirements and passes code

Re: Which is faster?

2005-01-26 Thread Aldo Cortesi
Thus spake Aggelos I. Orfanakos ([EMAIL PROTECTED]): > Any idea which of the following is faster? > > 'a/b/c/'[:-1] > > or > > 'a/b/c/'.rstrip('/') > > Thanks in advance. > > P.S. I could time it but I thought of trying my luck here > first, in case someone knows already, and of course the >

RE: Which is faster?

2005-01-26 Thread Tony Meyer
> Any idea which of the following is faster? > > 'a/b/c/'[:-1] > > or > > 'a/b/c/'.rstrip('/') > > Thanks in advance. > > P.S. I could time it but I thought of trying my luck here > first, in case someone knows already, and of course the reason. Timing it is almost no work, though: >>> impo

RE: Which is faster?

2005-01-26 Thread Delaney, Timothy C (Timothy)
Aggelos I. Orfanakos wrote: > Any idea which of the following is faster? > > 'a/b/c/'[:-1] > > or > > 'a/b/c/'.rstrip('/') > > Thanks in advance. > > P.S. I could time it but I thought of trying my luck here first, in > case someone knows already, and of course the reason. First, it almost c

Which is faster?

2005-01-26 Thread Aggelos I. Orfanakos
Any idea which of the following is faster? 'a/b/c/'[:-1] or 'a/b/c/'.rstrip('/') Thanks in advance. P.S. I could time it but I thought of trying my luck here first, in case someone knows already, and of course the reason. -- http://mail.python.org/mailman/listinfo/python-list

Re: What's so funny? WAS Re: rotor replacement

2005-01-26 Thread phr
"Martin v. Löwis" <[EMAIL PROTECTED]> writes: > > That it's not appropriate for the > > distro maintainers to look at the spec and the reference (pure Python) > > implementatation and say "yes, we want this, go write the C version > > and we'll include it after it's had some testing". > > I know t

Re: 20050126 find replace strings in file

2005-01-26 Thread kosh
On Wednesday 26 January 2005 7:13 pm, Tad McClellan wrote: > [ Followup set ] > > Dan Perl <[EMAIL PROTECTED]> wrote: > > I can't imagine why or how, but there are > > actually 26 members in the perl-python Yahoo! group who have registered > > to get these bogus lessons sent to them daily! > > Ther

Re: 20050126 find replace strings in file

2005-01-26 Thread Tad McClellan
[ Followup set ] Dan Perl <[EMAIL PROTECTED]> wrote: > I can't imagine why or how, but there are > actually 26 members in the perl-python Yahoo! group who have registered to > get these bogus lessons sent to them daily! There is one born every minute. -- Tad McClellan

Re: Responding to trollish postings.

2005-01-26 Thread Peter Hansen
John Machin wrote: Indeed. Let's just nominate XL to the "Full Canvas Jacket" website (http://www.ratbags.com/ranters/) and move on. I'm not sure how reliable that site could be. After all, it contains no articles with the words "autocoding", "threeseas", or "rue" (other than as the French "street

Re: python memory blow out

2005-01-26 Thread Tim Peters
[Simon Wittber] >> According to the above post: >>a) If the allocation is > 256 bytes, call the system malloc. >>b) If the allocation is < 256, use its own malloc implementation, which >> allocates memory in 256 kB chunks and never releases it. >> >> I imagine this means that large me

python memory blow out

2005-01-26 Thread Simon Wittber
I have written some software which proxy's SQL Server database services across a network. It uses Pyro, without multiuthreading. It creates and closes a new connection and cursor object for each request. Unfortunately, the memory consumption blows out (consuming all available memory) when a large

Re: python memory blow out

2005-01-26 Thread Stephen Thorne
On Thu, 27 Jan 2005 09:08:59 +0800, Simon Wittber <[EMAIL PROTECTED]> wrote: > According to the above post: > > a) If the allocation is > 256 bytes, call the system malloc. > > b) If the allocation is < 256, use its own malloc implementation, which > > allocates memory in 256 kB chunks and never re

Re: [perl-python] 20050126 find replace strings in file

2005-01-26 Thread Eric Schwartz
To follow up on Jurgen Exner's critique, I present Xah Lee's version, and then my rewritten version. "Xah Lee" <[EMAIL PROTECTED]> writes: > if (scalar @ARGV != 4) {die "Wrong arg! Unix BNF: $0 > \n"} > $stext=$ARGV[0]; > $rtext=$ARGV[1]; > $infile = $ARGV[2]; > $outfile = $ARGV[3]; > open(F1,

Re: Browsing text ; Python the right tool?

2005-01-26 Thread Jeff Shannon
John Machin wrote: Jeff Shannon wrote: [...] For ~10 or fewer types whose spec doesn't change, hand-coding the conversion would probably be quicker and/or more straightforward than writing a spec-parser as you suggest. I didn't suggest writing a "spec-parser". No (mechanical) parsing is involved.

Re: Responding to trollish postings.

2005-01-26 Thread John Machin
Terry Reedy wrote: > > No offense taken. My personal strategy is to read only as much of trollish > threads as I find interesting or somehow instructive, almost never respond, > and then ignore the rest. I also mostly ignore discussions about such > threads. > Indeed. Let's just nominate XL to

Re: Browsing text ; Python the right tool?

2005-01-26 Thread John Machin
Jeff Shannon wrote: > John Machin wrote: > > > Jeff Shannon wrote: > > > >> [...] If each record is CRLF terminated, then > >>you can get one record at a time simply by iterating over the file > >>("for line in open('myfile.dat'): ..."). You can have a dictionary > >>classes or factory functions

Re: python without OO

2005-01-26 Thread Timo Virkkala
This guy has got to be a troll. No other way to understand. -- Timo Virkkala -- http://mail.python.org/mailman/listinfo/python-list

Re: Classical FP problem in python : Hamming problem

2005-01-26 Thread Steven Bethard
Francis Girard wrote: For the imerge function, what we really need to make the formulation clear is a way to look at the next element of an iteratable without consuming it. Or else, a way to put back "consumed" elements in the front an iteration flow, much like the list constructors in FP langua

Re: [perl-python] 20050126 find replace strings in file

2005-01-26 Thread Jürgen Exner
Xah Lee wrote: [...] > In perl, similar code can be achieved. > the following code illustrates. > > if (scalar @ARGV != 4) Why scalar()? The comparison already creates a scalar context, no need to enforce it twice. > {die "Wrong arg! Unix BNF: $0 > \n"} > $stext=$ARGV[0]; > $rtext=$ARGV[1];

Re: python without OO

2005-01-26 Thread beliavsky
Nick Coghlan wrote: > Davor wrote: > > thanks for the link > > > > > >>know what's funny: in the Lua mailing list there is currently a > >>discussion about adding OO to Lua. > > > > > > I guess most of these newer languages have no choice but to support OO > > if they want to attract a larger user

Re: exclude binary files from os.walk

2005-01-26 Thread Grant Edwards
On 2005-01-26, Larry Bates <[EMAIL PROTECTED]> wrote: > There's no definitive way of telling a file is "non-ascii". > Bytes in a binary file define perfectly good ascii characters. As long as bit 7 is a 0. Traditional ASCII only allows/defines the values 0x00 through 0x7f. If that's what is m

Re: exclude binary files from os.walk

2005-01-26 Thread Dan Perl
"rbt" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is there an easy way to exclude binary files (I'm working on Windows XP) > from the file list returned by os.walk()? > > Also, when reading files and you're unsure as to whether or not they are > ascii or binary, I've always th

Re: exclude binary files from os.walk

2005-01-26 Thread [EMAIL PROTECTED]
you might want to look up the 'isascii' function... i.e. - can be represented using just 7-bits. -- http://mail.python.org/mailman/listinfo/python-list

Re: Classical FP problem in python : Hamming problem

2005-01-26 Thread Francis Girard
Le mardi 25 Janvier 2005 19:52, Steven Bethard a écrit : Thank you Nick and Steven for the idea of a more generic imerge. To work with the Hamming problem, the imerge function _must_not_ allow duplicates and we can assume all of the specified iteratables are of the same size, i.e. infinite ! T

Re: Classical FP problem in python : Hamming problem

2005-01-26 Thread Francis Girard
Le mardi 25 Janvier 2005 09:01, Michael Spencer a ÃcritÂ: > Francis Girard wrote: > > The following implementation is even more speaking as it makes > > self-evident and almost mechanical how to translate algorithms that run > > after their tail from recursion to "tee" usage : > > Thanks, Francis a

Re: Question Regarding SocketServer

2005-01-26 Thread [EMAIL PROTECTED]
I am glad you were able to figure it out. It's strange that the pyc file didn't get updated... it should have automatically fixed itself. *shrug* that's one of those problems that aggrivate you to death... -- http://mail.python.org/mailman/listinfo/python-list

Re: inherit without calling parent class constructor?

2005-01-26 Thread Jeff Shannon
Christian Dieterich wrote: Hi, I need to create many instances of a class D that inherits from a class B. Since the constructor of B is expensive I'd like to execute it only if it's really unavoidable. Below is an example and two workarounds, but I feel they are not really good solutions. Does s

Re: inherit without calling parent class constructor?

2005-01-26 Thread Steven Bethard
Christian Dieterich wrote: On Dé Céadaoin, Ean 26, 2005, at 13:45 America/Chicago, Steven Bethard wrote: Note that: @deco def func(...): ... is basically just syntactic sugar for: def func(...): ... func = deco(func) Oh, I learned something new today :-) Nice thin

Re: MMTK Install Problem

2005-01-26 Thread David M. Cooke
Justin Lemkul <[EMAIL PROTECTED]> writes: > Hello All, > > I am hoping that someone out there will be able to help me. During the > "build" phase of MMTK installation, I receive the following series of errors: > > $ python setup.py build > running build > running build_py > running build_ext > b

Responding to trollish postings.

2005-01-26 Thread Terry Reedy
[New subject line] In response to my response to a trollish posting... > There isn't any doubt that these 'tutorials' are generally unwelcome and > unhelpful. Numerous people have kindly taken the time to flag some of the > problems. So much so that any competent google of the archives would >

Re: 20050126 find replace strings in file

2005-01-26 Thread Ala Qumsieh
[EMAIL PROTECTED] wrote: Xah Lee wrote: close(F1) or die "Perl fucked up. Reason: $!"; close(F2) or die "Perl fucked up. Reason: $!"; Same here. Never seen Perl fuck up on closing a file. Usually something in the OS or file system that does it. In this case, I'm pretty sure it's the user. --Ala

Re: 20050126 find replace strings in file

2005-01-26 Thread Dan Perl
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I guess there is no way to check if the file opened fine? What if the > filesystem or file is locked for this user/session. Pretty puny > language if it cannot tell you that it cannot do what you tell it to. > .. > Same for t

Re: access private field in python 2.4

2005-01-26 Thread [EMAIL PROTECTED]
thanks Steve pujo -- http://mail.python.org/mailman/listinfo/python-list

Re: exclude binary files from os.walk

2005-01-26 Thread Larry Bates
There's no definitive way of telling a file is "non-ascii". Bytes in a binary file define perfectly good ascii characters. Windows depends on file extensions to try to keep track of the "type" of data in a file, but that isn't foolproof. I can rename a plain ascii file with a .EXE extension. We

Re: MSI Difficulties

2005-01-26 Thread rbt
brolewis wrote: I am trying to deploy Python onto a number of laptops and have been trying to take advantage of Python 2.4's MSI installer. I have tried using the following commands to install, but to no avail: msiexec /i python-2.4.msi /qb ALLUSERS=1 -- and -- msiexec /i python-2.4.msi /qb ALLUSER

Re: exclude binary files from os.walk

2005-01-26 Thread rbt
Grant Edwards wrote: On 2005-01-26, rbt <[EMAIL PROTECTED]> wrote: Is there an easy way to exclude binary files (I'm working on Windows XP) from the file list returned by os.walk()? Sure, assuming you can provide a rigorous definition of 'binary files'. :) non-ascii -- http://mail.python.org/mai

Re: inherit without calling parent class constructor?

2005-01-26 Thread Christian Dieterich
On Dé Céadaoin, Ean 26, 2005, at 13:45 America/Chicago, Steven Bethard wrote: Note that: @deco def func(...): ... is basically just syntactic sugar for: def func(...): ... func = deco(func) Oh, I learned something new today :-) Nice thing to know, these descriptor

Re: Subclassed dict as globals

2005-01-26 Thread Lenard Lindstrom
Evan Simpson <[EMAIL PROTECTED]> writes: > In Python 2.4 the following works: > > >>> class G(dict): > ... def __getitem__(self, k): > ... return 'K' + k > ... > >>> g = G() > >>> exec 'print x, y, z' in g > Kx Ky Kz > >>> > [snip] > [Is] there a way to do this (intercept global variable

RE: On benchmarks, heaps, priority queues

2005-01-26 Thread Delaney, Timothy C (Timothy)
[EMAIL PROTECTED] wrote: > PQPython23 - the Lib implementation > PQ0 - my insertion sort based variant > PQueue - my "heap" based variant > (like PQPython23, but different). First of all, you should be running these benchmarks using Python 2.4. heapq is considerably faster there ... (Raymond Hett

Re: Subclassed dict as globals

2005-01-26 Thread Terry Reedy
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Evan Simpson wrote: > >> In Python 2.4 the following works: >> >> >>> class G(dict): >> ... def __getitem__(self, k): >> ... return 'K' + k >> ... >> >>> g = G() >> >>> exec 'print x, y, z' in g >> Kx Ky Kz >> >>>

Re: MySQLdb executemany

2005-01-26 Thread Daniel Bowett
Daniel Bowett wrote: I seem to have found a bug/limitation of executemany in MySQLdb. I am inserting 3100 records into a database. It works fine and adds them in about 1 second. I went back to the program today and realised i'd missed a field so added it to the insert statement. This seems to br

Re: python without OO

2005-01-26 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Frank Bechmann (w) wrote: > know what's funny: in the Lua mailing list there is currently a > discussion about adding OO to Lua. >From my quick glance at the language last year I recall that one can access elements of tables (in Python: dict()) with this syntax: ``tbl.att

Re: exclude binary files from os.walk

2005-01-26 Thread Grant Edwards
On 2005-01-26, rbt <[EMAIL PROTECTED]> wrote: > Is there an easy way to exclude binary files (I'm working on > Windows XP) from the file list returned by os.walk()? Sure, assuming you can provide a rigorous definition of 'binary files'. :) > Also, when reading files and you're unsure as to whet

exclude binary files from os.walk

2005-01-26 Thread rbt
Is there an easy way to exclude binary files (I'm working on Windows XP) from the file list returned by os.walk()? Also, when reading files and you're unsure as to whether or not they are ascii or binary, I've always thought it safer to 'rb' on the read, is this correct... and if so, what's the

Re: short programming projects for kids

2005-01-26 Thread bobdc
Thanks André, Adrian, Steve, Duncan, and zombiehunter for the excellent suggestions. Bob -- http://mail.python.org/mailman/listinfo/python-list

Re: Inherting from object. Or not.

2005-01-26 Thread Frans Englich
On Wednesday 26 January 2005 21:24, M.E.Farmer wrote: > Hello Frans, > What you are seeing is a step on the path to unification of types and > classes. I changed all base classes in my project to inherit object. There appears to be no reason to not do it, AFAICT. Thanks, Frans

Re: 20050126 find replace strings in file

2005-01-26 Thread takarov2003
Xah Lee wrote: > © # -*- coding: utf-8 -*- > © # Python > © > © import sys > © > © nn = len(sys.argv) > © > © if not nn==5: > © print "error: %s search_text replace_text in_file out_file" % > sys.argv[0] > © else: > © stext = sys.argv[1] > © rtext = sys.argv[2] > © input = open(sys.

Re: subprocess.Popen() redirecting to TKinter or WXPython textwidget???

2005-01-26 Thread Ivo Woltring
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ivo, my initial thought would be, you need to know how much text you > will get back from popen. My Python reference has the following > example: > > import os > dir = os.popen('ls -al', 'r') > while (1): > line = dir.readline() > if l

Re: wx.Image: Couldn't add an image to the image list.

2005-01-26 Thread Kartic
Laszlo, If you are using PIL just for scaling, you can do away with PIL. Even if you do other things with PIL, you can use the Rescale method of the wx.Image instance to resize. Here is the code (adapted from the Demo): data = open('C:/TEMP/test.bmp'), "rb").read() stream = cStringIO.StringIO(dat

Re: XOR on string

2005-01-26 Thread snacktime
> lrc == Linear Redundancy Check? or Longitudinal? Note that > such terms are not precisely defined... generally just acronyms > people make up and stick in their user manuals for stuff. :-) > Longitudinal > import operator > lrc = reduce(operator.xor, [ord(c) for c in string]) That's better t

Re: "pickle" vs. f.write()

2005-01-26 Thread Terry Reedy
For basic builtin objects, repr(ob) generally produces a string that when eval()ed will recreate the object. IE eval(repr(ob) == ob # sometimes For writing and reading class instances, pickle is the way to go. Terry J. Reedy -- http://mail.python.org/mailman/listinfo/python-list

MSI Difficulties

2005-01-26 Thread brolewis
I am trying to deploy Python onto a number of laptops, all running Windows XP, and have been trying to take advantage of Python 2.4's MSI installer. I have tried using the following commands to install, but to no avail: msiexec /i python-2.4.msi /qb ALLUSERS=1 -- and -- msiexec /i python-2.4.msi /

MSI Difficulties

2005-01-26 Thread brolewis
I am trying to deploy Python onto a number of laptops and have been trying to take advantage of Python 2.4's MSI installer. I have tried using the following commands to install, but to no avail: msiexec /i python-2.4.msi /qb ALLUSERS=1 -- and -- msiexec /i python-2.4.msi /qb ALLUSERS=1 ADDLOCAL=AL

Re: subprocess.Popen() redirecting to TKinter or WXPython textwidget???

2005-01-26 Thread [EMAIL PROTECTED]
Ivo, my initial thought would be, you need to know how much text you will get back from popen. My Python reference has the following example: import os dir = os.popen('ls -al', 'r') while (1): line = dir.readline() if line: print line, else: break that example shows how to capture the process ou

Re: Help With Python

2005-01-26 Thread Matt
Nick Vargish wrote: > Here's my Monty Pythonic answer: > > ## cut here > class Viking(): > > def __init__(): > pass > > def order(): > return 'Spam' > > # this is one viking making one order repeated 511 times. if you want > # 511 vikings making seperate orders, you'll have

Re: Inherting from object. Or not.

2005-01-26 Thread Peter Hansen
Frans Englich wrote: What is the difference between inherting form object, and not doing it? Although this doesn't provide a description of all the implications, it does give you the basic answer to the question and you can easily do further research to learn more: http://www.python.org/doc/2.2.1/

subprocess.Popen() redirecting to TKinter or WXPython textwidget???

2005-01-26 Thread Ivo Woltring
Hi Pythoneers, I am trying to make my own gui for mencoder.exe (windows port of the terrific linux mencoder/mplayer) to convert divx to Pocket_PC size. My current app creates a batch script to run the mencoder with the needed params, but now I want to integrate mencoder as a subprocess in my app.

Re: Inherting from object. Or not.

2005-01-26 Thread Lee Harr
> What is the difference between inherting form object, and not doing it? E.g, > what's the difference between the two following classes? > > class foo: > pass > > class bar(object): > pass > > Sometimes people inherit from it, and sometimes not. I don't see a pattern in > their choic

Re: smtplib bug with Windows XP

2005-01-26 Thread [EMAIL PROTECTED]
it works! you da man! At the same time as my desktop was upgraded to Windows XP, the IT people switched virus checker products to McAfee Enterprise. And indeed, as soon as I disabled that 'mass worm sending' option, my Python scripts is once again able to send mail. thanks so much for this tip!

Re: Help With Python

2005-01-26 Thread Steven Bethard
Nick Vargish wrote: Here's my Monty Pythonic answer: ## cut here class Viking(): def __init__(): pass def order(): return 'Spam' # this is one viking making one order repeated 511 times. if you want # 511 vikings making seperate orders, you'll have to write a loop. v = Vikin

Re: Inherting from object. Or not.

2005-01-26 Thread M.E.Farmer
Hello Frans, What you are seeing is a step on the path to unification of types and classes. Now we have that clear ;) Classes that inherit from object are 'new style classes'. They were introduced in 2.2 and they have different internal methods. The ones that have no declaration is an 'old style cl

Re: python without OO

2005-01-26 Thread Francis Girard
Le mercredi 26 Janvier 2005 21:44, PA a écrit : > On Jan 26, 2005, at 21:35, Francis Girard wrote: > >> Project fails for many reasons but seldomly because one language is > >> "better" or "worst" than another one. > > > > I think you're right. But you have to choose the right tools that fit > > yo

Re: XOR on string

2005-01-26 Thread Peter Hansen
snacktime wrote: I need to calculate the lrc of a string using an exclusive or on each byte in the string. How would I do this in python? lrc == Linear Redundancy Check? or Longitudinal? Note that such terms are not precisely defined... generally just acronyms people make up and stick in their u

Inherting from object. Or not.

2005-01-26 Thread Frans Englich
(Picking up a side track of the "python without OO" thread.) On Wednesday 26 January 2005 11:01, Neil Benn wrote: > I say this because you do need to be aware of the > 'mythical python wand' which will turn you from a bad programmer into a > good programmer simply by typing 'class Klass(object):

Re: Set parity of a string

2005-01-26 Thread Peter Hansen
snacktime wrote: Correction on this, ETX is ok, it seems to be just STX with the data I am using. On Wed, 26 Jan 2005 11:50:46 -0800, snacktime <[EMAIL PROTECTED]> wrote: I'm trying to figure out why the following code transforms ascii STX (control-b) into "\x82". The perl module I use returns a

Re: Set parity of a string

2005-01-26 Thread snacktime
Argh, never mind my mistake. I wasn't logging the data correctly the parity conversion works fine. Chris -- http://mail.python.org/mailman/listinfo/python-list

XOR on string

2005-01-26 Thread snacktime
I need to calculate the lrc of a string using an exclusive or on each byte in the string. How would I do this in python? Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: [perl-python] 20050126 find replace strings in file

2005-01-26 Thread Haibao Tang
OK. But please don't die throwing that string, or this post will lose its educational purpose as it was meant to be. -- http://mail.python.org/mailman/listinfo/python-list

Re: can not use __methods__

2005-01-26 Thread Steven Bethard
[EMAIL PROTECTED] wrote: I try to use __methods__ in python 2.4 and 2.2 it always fail. Can some one tell me if I want to itterate the methods in a class and print it in a string format ( it is possible using __methods__ ). Is there any replacement? py> class C(object): ... a = 1 ... b = 2

Re: python without OO

2005-01-26 Thread PA
On Jan 26, 2005, at 21:35, Francis Girard wrote: Project fails for many reasons but seldomly because one language is "better" or "worst" than another one. I think you're right. But you have to choose the right tools that fit your needs. But I think that's what you meant anyway. Yes. But even with

Re: python without OO

2005-01-26 Thread Frans Englich
On Wednesday 26 January 2005 18:55, Terry Reedy wrote: > Your Four Steps to Python Object Oriented Programming - vars, lists, dicts, > and finally classes is great. It makes this thread worthwhile. I saved it > and perhaps will use it sometime (with credit to you) to explain same to > others. I

Re: Help With Python

2005-01-26 Thread Nick Vargish
Here's my Monty Pythonic answer: ## cut here class Viking(): def __init__(): pass def order(): return 'Spam' # this is one viking making one order repeated 511 times. if you want # 511 vikings making seperate orders, you'll have to write a loop. v = Viking() orders = [

Re: python without OO

2005-01-26 Thread Francis Girard
Le mercredi 26 Janvier 2005 20:47, PA a écrit : > Project fails for many reasons but seldomly because one language is > "better" or "worst" than another one. I think you're right. But you have to choose the right tools that fit your needs. But I think that's what you meant anyway. > > Cheers >

Re: access private field in python 2.4

2005-01-26 Thread Steven Bethard
[EMAIL PROTECTED] wrote: Hello, if we want to access the private member of object we use the classname, it doesn't make sense. For example: I have class A: class A: def __init__(self, i): self.__i = i; pass __i = 0 a = A(22); b = A(33); How can I get field i in object a and how can I get field i i

  1   2   3   >