Re: What is different with Python ?

2005-06-13 Thread Mike Meyer
Andrea Griffini <[EMAIL PROTECTED]> writes: >>In short, you're going to start in the middle. > > I've got "bad" news for you. You're always in the > middle :-D. That's what I just said. >>Is it really justified to confuse them all >>by introducing what are really extraneous details early on? > >

new string function suggestion

2005-06-13 Thread Andy
What do people think of this? 'prefixed string'.lchop('prefix') == 'ed string' 'string with suffix'.rchop('suffix') == 'string with ' 'prefix and suffix.chop('prefix', 'suffix') == ' and ' The names are analogous to strip, rstrip, and lstrip. But the functionality is basically this: def lchop(

Re: os.system

2005-06-13 Thread Austin
>> My code is " os.system("NET SEND computer hihi") " >> i use this funtion on Windows server 2003. >> it's ok. >> >> But the same code running on Windows XP SP2, it shows the command window >> twice. >> How do i remove the command window? > > Hi, > > You can remove the command window which comes

Re: What is different with Python ?

2005-06-13 Thread Andreas Kostyrka
On Mon, Jun 13, 2005 at 06:13:13AM +, Andrea Griffini wrote: > >Andrea Griffini <[EMAIL PROTECTED]> writes: > >So you're arguing that a CS major should start by learning electronics > >fundamentals, how gates work, and how to design hardware(*)? Because > >that's what the concrete level *really

Re: new string function suggestion

2005-06-13 Thread Andrew Dalke
Andy wrote: > What do people think of this? > > 'prefixed string'.lchop('prefix') == 'ed string' > 'string with suffix'.rchop('suffix') == 'string with ' > 'prefix and suffix.chop('prefix', 'suffix') == ' and ' Your use case is > I get tired of writing stuff like: > > if path.startswith('html/'

Re: how to operate the excel by python?

2005-06-13 Thread McBooCzech
> i want to compare the content in excel,but i don't know whick module to use! > can you help me? Read "Python programming on Win32" book, use win32api module. According to Chad's advices about Excel (VBA) constants, you can find following link usefull as well. http://fox.wikis.com/wc.dll?Wiki~Exce

Re: Dynamic Lists, or...?

2005-06-13 Thread Raymond Hettinger
# Professional driver on a closed course. # Don't try this at home. data = """ rose, 1, 500 lilac, 1, 300 lilly, 1, 400 rose, 0, 100 """ data = data.replace(', 1, ', ' += ') data = data.replace(', 0, ', ' -= ') class DefaultDict(dict): def __getitem__(self, key): return self.get(key,

Re: Learning more about "The Python Way"

2005-06-13 Thread TechBookReport
Kalle Anke wrote: > Those who have read my posts today have probably understood that I'm > not a "true" Python programmer ... but I want to learn more (I think > that Python is rather fun). > > I've read "Learning Python" pretty thoroughly, I've looked at some of > the tutorials, some of online

Re: new string function suggestion

2005-06-13 Thread Steven D'Aprano
On Mon, 13 Jun 2005 07:05:39 +, Andy wrote: > What do people think of this? > > 'prefixed string'.lchop('prefix') == 'ed string' > 'string with suffix'.rchop('suffix') == 'string with ' > 'prefix and suffix.chop('prefix', 'suffix') == ' and ' > > The names are analogous to strip, rstrip, and

Re: count string replace occurances

2005-06-13 Thread William Park
Xah Lee <[EMAIL PROTECTED]> wrote: > if i have > mytext.replace(a,b) > how to find out many many occurances has been replaced? If 'a' and 'b' are different length, - Count the string length, before and after. The difference should be multiple of difference between length of 'a' and 'b'.

Re: new string function suggestion

2005-06-13 Thread Raymond Hettinger
[Andrew Dalke] <200 lines of thorough analysis> > To summarize: > - I don't think it's needed that often > - I don't think your implementation's behavior (using an >exception) is what people would expect > - I don't think it does what you expect Wow, that was a remarkably thoughtful,

Re: How to test if an object IS another object?

2005-06-13 Thread bruno modulix
[EMAIL PROTECTED] wrote: > > Tuples (which are immutable) also appear to be reused > > foo = () bar = () foo is bar > > True Not always: foo = (1,) bar = (1,) foo is bar => False -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p i

Re: Dynamic Lists, or...?

2005-06-13 Thread Steven D'Aprano
On Sat, 11 Jun 2005 10:30:53 -0700, Lorn wrote: > I'm trying to figure out a way to create dynamic lists or possibly > antother solution for the following problem. I have multiple lines in a > text file (every line is the same format) that are iterated over and > which need to be compared to previ

Re: new string function suggestion

2005-06-13 Thread John Machin
Andy wrote: > What do people think of this? > > 'prefixed string'.lchop('prefix') == 'ed string' > 'string with suffix'.rchop('suffix') == 'string with ' > 'prefix and suffix.chop('prefix', 'suffix') == ' and ' > > The names are analogous to strip, rstrip, and lstrip. But the functionality > is

Request for help on naming conventions

2005-06-13 Thread Steven D'Aprano
Are there any useful naming conventions for modules, classes and functions? For instance, should I name functions as verbs and classes as nouns? eg class Transformer(): pass def transform(): do_stuff What about the module name? transformations.py or transform.py? What do people do wit

why python on debian without the module profile?

2005-06-13 Thread kyo guan
Hi All: Python 2.4.1 (#2, May 5 2005, 11:32:06) [GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import hotshot,hotshot.stats Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.4/hotshot/stats.py

Re: ElementTree Namespace Prefixes

2005-06-13 Thread Fredrik Lundh
Chris Spencer wrote: > If an XML parser reads in and then writes out a document without having > altered it, then the new document should be the same as the original. says who? > With Elementtree this isn't so. Lundh apparently believes he knows > better than you and I on how our namespaces shou

Re: re - multiple results

2005-06-13 Thread Fredrik Lundh
Pingveno wrote: > I'm working on the Python Challenge (make sure to try it: > http://www.pythonchallenge.com). One of the puzzles requires the use of > regular expressions, but with multiple matches in the text. I tried to > use re.findall(), but I only go one result instead of a list of results.

Re: os.system

2005-06-13 Thread Fredrik Lundh
Austin wrote: >>> My code is " os.system("NET SEND computer hihi") " >>> i use this funtion on Windows server 2003. >>> it's ok. >>> >>> But the same code running on Windows XP SP2, it shows the command window >>> twice. >>> How do i remove the command window? >> >> Hi, >> >> You can remove the c

Re: why python on debian without the module profile?

2005-06-13 Thread Tim Leslie
My understanding is that there are licence issues (someone please correct me if I'm wrong). The moral of the story is that there's a seperate (non-free) package for the profiler: http://packages.debian.org/testing/python/python2.4-profiler HTH Tim On 6/13/05, kyo guan <[EMAIL PROTECTED]> wrote:

Re: \r\n or \n notepad editor end line ???

2005-06-13 Thread Fredrik Lundh
<[EMAIL PROTECTED]> wrote: > It means in windows we should use 'wb' to write and 'rb' to read ? > Am I right? no. you should use "wb" to write *binary* files, and "rb" to read *binary* files. if you're working with *text* files (that is, files that contain lines of text separated by line separa

Java to Python - how to??

2005-06-13 Thread ka_czor
Hello I just start programing in Python. I've got a qestion, how translate the example code writen in Java to Python?? public class ConnectionManager { public ConnectionManager() { super(); } public void sendAgent(Agent anAgent, WorkplaceAddress anAddress) { } } bye -- http

Re: About size of Unicode string

2005-06-13 Thread Fredrik Lundh
Frank Abel Cancio Bello wrote: > Can I get how many bytes have a string object independently of its encoding? strings hold characters, not bytes. an encoding is used to convert a stream of characters to a stream of bytes. if you need to know the number of bytes needed to hold an encoded string

Re: Java to Python - how to??

2005-06-13 Thread George Sakkis
[EMAIL PROTECTED] wrote: > Hello > > I just start programing in Python. > I've got a qestion, how translate the example code writen in Java to > Python?? > > > public class ConnectionManager { > > public ConnectionManager() { > super(); > } > public void sendAgent(Agent anAgent, Workplac

asyncore and GUI (wxPython)

2005-06-13 Thread Zunbeltz Izaola
Hi, I have the followin situation. 1) I've a machine controled by a computer programn that can comunicate with TCP/IP ("server")to recive the request of other program to knwo what the machine should do. 2) The other program ("client") has a GUI (with wxPython), recives data from the machine an

Re: DB API 2.0 and transactions

2005-06-13 Thread Magnus Lycka
I'm CC:ing this to D'Arcy J.M. Cain. (See comp.lang.python for prequel D'Arcy.) Christopher J. Bottaro wrote: > Check this out... > > > import pgdb > import time > > print time.ctime() > db = pgdb.connect(user='test', host='localhost', database='test') > time.sleep(5) > db.cursor().execute('ins

translating C++ exceptions to python

2005-06-13 Thread calin . hanchevici
Hi all, I have a C++ library I call from python. The problem is I have c++ exceptions that i want to be translated to python. I want to be able to do stuff like: try: my_cpp_function() except cpp_exception_1: do_stuff except cpp_exception_2: do_other_stuff any ideas how can i do the t

Re: How to use 8bit character sets?

2005-06-13 Thread John Roth
""Martin v. Löwis"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > copx wrote: >> For some reason Python (on Windows) doesn't use the system's default >> character set and that's a serious problem for me. > > I very much doubt this statement: Python does "use" the system's default >

Re: What is different with Python ?

2005-06-13 Thread Peter Maas
Andrea Griffini schrieb: > On Sat, 11 Jun 2005 21:52:57 -0400, Peter Hansen <[EMAIL PROTECTED]> > wrote: > > >>I think new CS students have more than enough to learn with their >>*first* language without having to discover the trials and tribulations >>of memory management (or those other thing

Re: What is different with Python ?

2005-06-13 Thread Tom Anderson
On Sun, 12 Jun 2005, Roy Smith wrote: > Andrea Griffini <[EMAIL PROTECTED]> wrote: > >> I think that for a programmer skipping the understanding of the >> implementation is just impossible: if you don't understand how a >> computer works you're going to write pretty silly programs. Note that >>

Re: What is different with Python ?

2005-06-13 Thread Tom Anderson
On Sun, 12 Jun 2005, Peter Hansen wrote: > Andrea Griffini wrote: >> On Sat, 11 Jun 2005 21:52:57 -0400, Peter Hansen <[EMAIL PROTECTED]> >> wrote: >> >>> I think new CS students have more than enough to learn with their >>> *first* language without having to discover the trials and >>> tribulat

Re: What is different with Python ?

2005-06-13 Thread Tom Anderson
On Mon, 13 Jun 2005, Andrea Griffini wrote: > On Sun, 12 Jun 2005 20:22:28 -0400, Roy Smith <[EMAIL PROTECTED]> wrote: > >>> Also concrete->abstract shows a clear path; starting in the middle and >>> looking both up (to higher abstractions) and down (to the >>> implementation details) is IMO muc

Re: What language to manipulate text files

2005-06-13 Thread Jim
Roose wrote: > Why do people keep asking what language to use for certain things in the > Python newsgroup? Obviously the answer is going to biased. > > Not that it's a bad thing because I love Python, but it doesn't make sense > if you honestly want an objective opinion. It will, however, have

Re: What is different with Python ?

2005-06-13 Thread Roy Smith
Andrea Griffini <[EMAIL PROTECTED]> wrote: > There's no way you will remember what is O(n), > what O(1) and what is O(log(n)) among containers > unless you roughly understand how it works. People were thinking about algorithmic complexity before there was random access memory. Back in the unit r

Re: why python on debian without the module profile?

2005-06-13 Thread Thomas Lotze
kyo guan wrote: > ImportError: No module named profile They moved it to non-free because the module's license isn't DFSG compliant. -- Thomas -- http://mail.python.org/mailman/listinfo/python-list

MD5 problem

2005-06-13 Thread fargo
Hi. I'm in trouble with the md5 module. Under Linux, it's ok, I get real signatures. The problem is under Windows XP, with some kind of files. If I use the md5 module with .txt files, it'ok. The Problem comes from the .msg files. I get the same signature for every .msg file I try to hash with

Re: MD5 problem

2005-06-13 Thread Roel Schroeven
fargo wrote: > Hi. > > I'm in trouble with the md5 module. > > Under Linux, it's ok, I get real signatures. > > The problem is under Windows XP, with some kind of files. > > If I use the md5 module with .txt files, it'ok. > > The Problem comes from the .msg files. I get the same signature for

NIST Ihead Image format

2005-06-13 Thread Ahmed Shinwari
Hello Charles, I am Ahmed, I read your query regarding image reader for NIST's ihead standard. You mentioned that NIST has a sample database of such images for downloading, could please do me a favour, (i) forward me the link of NIST where sample data of ihead image is stored, I can not find it.

Re: Learning more about "The Python Way"

2005-06-13 Thread Neuruss
> As someone else mentioned, get a copy of the 2nd edition of the Python > Cookbook. It's full of gold. Or you can read the recipes online here: http://aspn.activestate.com/ASPN/Python/Cookbook/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Request for help on naming conventions

2005-06-13 Thread Benjamin Niemann
Steven D'Aprano wrote: > Are there any useful naming conventions for modules, classes and > functions? > > For instance, should I name functions as verbs and classes as nouns? > > eg > class Transformer(): > pass > > def transform(): > do_stuff > > What about the module name? transform

Re: Learning more about "The Python Way"

2005-06-13 Thread Robert Kern
Neuruss wrote: [Me:] >>As someone else mentioned, get a copy of the 2nd edition of the Python >>Cookbook. It's full of gold. > > Or you can read the recipes online here: > http://aspn.activestate.com/ASPN/Python/Cookbook/ While most (all?) of the recipes are there, the book is still worth buyi

Re: MD5 problem

2005-06-13 Thread fargo
Roel Schroeven wrote: > fargo wrote: > >> Hi. >> >> I'm in trouble with the md5 module. >> >> Under Linux, it's ok, I get real signatures. >> >> The problem is under Windows XP, with some kind of files. >> >> If I use the md5 module with .txt files, it'ok. >> >> The Problem comes from the .msg fil

Re: separate IE instances?

2005-06-13 Thread Chris Curvey
the good news is that if run the ShellExecute bit twice, I get two instances of explorer in Task Manager The bad news is that the line "ioObj = hwnds[1]" tells me either "This object does not support enumeration" (if I have not used makepy to generate the classes) or "object has no attribute __get

Re: What is different with Python ?

2005-06-13 Thread F. Petitjean
Le Mon, 13 Jun 2005 07:53:03 -0400, Roy Smith a écrit : > Python let's you concentrate on the real universal > fundamentals of data structures, algorithms, and control flow without > getting bogged down in details. +1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

Re: Dealing with marketing types...

2005-06-13 Thread Thomas Bartkus
"Steve Jorgensen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Sat, 11 Jun 2005 11:51:02 -0500, tom <[EMAIL PROTECTED]> wrote: > > ... > >Let me add an Item #3 - > >If you have some entrepeneurial savvy and can keep your emotions out of > >it tou can simply tell them you have de

Controlling assignation

2005-06-13 Thread =?ISO-8859-1?Q?Xavier_D=E9coret?=
I would like to know if there is for python's classes an equivalent of the operator= that can be overidden. Let's say I have >>> a=A() and I want to write >>> a=5 and I want this to change some internal value of a instead of making a point to a new object (an int 5) In other word, I would lik

Re: separate IE instances?

2005-06-13 Thread erinhouston
Sorry about that I had an instance of ie running in the background that was version 0 didn't see the problem tell this morining when my computer started to not work. it should be hwnds[1] should be hwnds[0]. I woud enumerate them like in the code below. If you have ie as your default browser yo

Re: Controlling assignation

2005-06-13 Thread Peter Hansen
Xavier Décoret wrote: > I would like to know if there is for python's classes an equivalent of > the operator= that can be overidden. > > Let's say I have > >>> a=A() > and I want to write > >>> a=5 > and I want this to change some internal value of a instead of making a > point to a new objec

Re: \r\n or \n notepad editor end line ???

2005-06-13 Thread Steven D'Aprano
On Mon, 13 Jun 2005 11:53:25 +0200, Fredrik Lundh wrote: > <[EMAIL PROTECTED]> wrote: > >> It means in windows we should use 'wb' to write and 'rb' to read ? >> Am I right? > > no. > > you should use "wb" to write *binary* files, and "rb" to read *binary* > files. > > if you're working with *t

Re: How to receive events (eg. user mouse clicks) from IE

2005-06-13 Thread J Correia
> <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Resurrecting an old thread.. > > It seems that this solution does not return events on objects within > > frames in webpages eg . if you go to www.andersondirect.com - the page > > is composed of three frames called as topFrame main

Re: Controlling assignation

2005-06-13 Thread harold fellermann
On 13.06.2005, at 15:52, Xavier Décoret wrote: > I would like to know if there is for python's classes an equivalent of > the operator= that can be overidden. > > Let's say I have a=A() > and I want to write a=5 > and I want this to change some internal value of a instead of making a >

Re: Controlling assignation

2005-06-13 Thread Steven D'Aprano
On Mon, 13 Jun 2005 15:52:14 +0200, Xavier Décoret wrote: > I would like to know if there is for python's classes an equivalent of > the operator= that can be overidden. > > Let's say I have > >>> a=A() > and I want to write > >>> a=5 > and I want this to change some internal value of a instea

Tk() doesn't bring up a window in Python2.4

2005-06-13 Thread [EMAIL PROTECTED]
Hello. I recently installed Python2.4 on both Linux (Redhat FC3) and Windows XP. The build and installed went fine as far as I could tell. I Windows, when I bring up IDLE, or pythonwin, I can't bring up a new Frame widget with Tk(). If I use idle from a DOS window, everything's fine. Python progr

Re: Controlling assignation

2005-06-13 Thread egbert
On Mon, Jun 13, 2005 at 03:52:14PM +0200, Xavier Décoret wrote: > In other word, I would like to be able to use a=5 instead of a.set(5) If a(5) is acceptable to you in stead of a=5 you can make your instance callable with the __call__ method: class A(object): def __init__(self): self

Tiff Image Reader/writer

2005-06-13 Thread PyPK
Hi I am looking for a simple tiff Image reader/writer in python.Can anyone point me to the right one. -- http://mail.python.org/mailman/listinfo/python-list

Re: \r\n or \n notepad editor end line ???

2005-06-13 Thread Peter Hansen
Steven D'Aprano wrote: > When you read a Windows text file using "r" mode, what happens to the \r > immediately before the newline? Do you have to handle it yourself? Or will > Python cleverly suppress it so you don't have to worry about it? > > And when you write a text file under Python using "w

ANN: pyparsing-1.3.1 released

2005-06-13 Thread Paul McGuire
Pyparsing is a pure-Python class library for quickly and easily constructing recursive-descent parsers. Pyparsing takes a "building-block" approach to parser construction, as opposed to code generation methods (such as lex/yacc) or pattern definition strings (such as regular expressions). Version

program call graph

2005-06-13 Thread Robert Cimrman
Hi, After much googling, I still cannot find any tool/module for producing a (static) call graph of a program. I have got nearly to my aim with trace.py, though it must actually run the program and the output would have to be parsed after; and doxygen + pythfilter.py, which should work, but did n

ANN: pyparsing-1.3.1 released

2005-06-13 Thread Paul McGuire
(sorry if this is a double-post - I tried posting this last night but I think GoogleGroups ate it) Pyparsing is a pure-Python class library for quickly and easily constructing recursive-descent parsers. Pyparsing takes a "building-block" approach to parser construction, as opposed to code generat

string formatting using the % operator

2005-06-13 Thread William Gill
I am using the % operator to create queries for a db app. It works fine when exact strings, or numbers are used, but some queries need partial matching that use the '%' as a wildcards. So for example the resultant string should be 'WHERE name LIKE %smith%' (would match silversmith, smithy, an

Show current ip on Linux

2005-06-13 Thread David Van Mosselbeen
Hi, Im a newbie in Python, and also in Fedora Core 3. (Yes, Linux is fine man :-) My question is : How can i rwite a script that show my current ip. If i have more than one network card, the script must then show all used ip. It's important that this will work on a linux. i Have rwite some piece

Re: string formatting using the % operator

2005-06-13 Thread fargo
William Gill wrote: > I am using the % operator to create queries for a db app. It works fine > when exact strings, or numbers are used, but some queries need partial > matching that use the '%' as a wildcards. So for example the resultant > string should be 'WHERE name LIKE %smith%' (would ma

Re: string formatting using the % operator

2005-06-13 Thread harold fellermann
> to return 'WHERE name LIKE %smith%'I have tried using escapes, > character codes for the % sign, and lots of other gyrations with no > success. The only thing that works is if I modify searchterm first: > >searchterm = 'smith' >searchterm ='%'+'smith'+'%' >sql += 'WHE

Re: Show current ip on Linux

2005-06-13 Thread Qiangning Hong
David Van Mosselbeen wrote: > Hi, > Im a newbie in Python, and also in Fedora Core 3. (Yes, Linux is fine > man :-) > > My question is : How can i rwite a script that show my current ip. If i have > more than one network card, the script must then show all used ip. > > It's important that this wi

Re: Tiff Image Reader/writer

2005-06-13 Thread Dan Sommers
On 13 Jun 2005 07:55:04 -0700, "PyPK" <[EMAIL PROTECTED]> wrote: > Hi I am looking for a simple tiff Image reader/writer in python.Can > anyone point me to the right one. I don't know what your definition of "simple" is, but check out the Python Imaging Library (PIL) at effbot.org. Regards, Dan

[OT ?] (Pythonic) detection word protected files

2005-06-13 Thread Gilles Lenfant
Hi, This is certainly off topic, but as my problem must have a pythonic answer. I'm building an utility that makes a catalog of M$ word files in a giant directory tree. The password protected files must be marked, and I didn't find how to guess which files are password protected and which ones

Re: string formatting using the % operator

2005-06-13 Thread Dan Sommers
On Mon, 13 Jun 2005 15:12:54 GMT, William Gill <[EMAIL PROTECTED]> wrote: > I am using the % operator to create queries for a db app. It works fine > when exact strings, or numbers are used, but some queries need partial > matching that use the '%' as a wildcards. So for example the resultant > s

Tkinter app structure

2005-06-13 Thread Richard Lewis
Hi there, I've just started my first project with Tkinter. I've already coded all the data handling classes and have a nice interface to work with (it happens to be a wrapper around the DOM of a large(ish) XML document but thats probably not important ;-) I'm new to Tkinter so I've started in a

Re: Show current ip on Linux

2005-06-13 Thread James Tanis
Previously, on Jun 13, Qiangning Hong said: # David Van Mosselbeen wrote: # > Hi, # > Im a newbie in Python, and also in Fedora Core 3. (Yes, Linux is fine # > man :-) # > # > My question is : How can i rwite a script that show my current ip. If i have # > more than one network card, the script

Re: separate IE instances?

2005-06-13 Thread J Correia
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Sorry about that I had an instance of ie running in the background that > was version 0 didn't see the problem tell this morining when my > computer started to not work. it should be hwnds[1] should be > hwnds[0]. I woud enumerate the

Re: case/switch statement?

2005-06-13 Thread Steve Holden
Peter Hansen wrote: > Chinook wrote: > >>On Sun, 12 Jun 2005 17:19:06 -0400, Peter Hansen wrote: >> >>>Case statements are actually more suitable in many cases even when >>>performance is not a goal for reasons of *readability*. >>> >>>When reading an if statement, you have to scan down through e

Re: [OT ?] (Pythonic) detection word protected files

2005-06-13 Thread Gerald Klix
Perhaps you can use OpenOffice and it's python UNO Bindings? I only know about their existence, but perhaps this will be a starting point: http://udk.openoffice.org/ HTH, Gerald Gilles Lenfant schrieb: > Hi, > > This is certainly off topic, but as my problem must have a pythonic answer. > > I'

RE: [OT ?] (Pythonic) detection word protected files

2005-06-13 Thread Tim Golden
[Gilles Lenfant] | I'm building an utility that makes a catalog of M$ word files | in a giant | directory tree. The password protected files must be marked, and I | didn't find how to guess which files are password protected and which | ones are not. | | I can't use the COM interface for this

Re: Controlling a generator the pythonic way

2005-06-13 Thread Steve Holden
Thomas Lotze wrote: > Peter Hansen wrote: > > >>Thomas Lotze wrote: >> >>>I can see two possibilities to do this: either the current file position >>>has to be read from somewhere (say, a mutable object passed to the >>>generator) after each yield, [...] >> >>The third approach, which is certain

extending Python base class in C

2005-06-13 Thread harold fellermann
Hi all, I once read that it is possible to use a python base class for a C extension class. To be precise, I want to achieve the following behavior: class PythonClass : pass class CClass(PythonClass) : "this class should be implemented as C extension" pass Unfortunate

Re: Controlling assignation

2005-06-13 Thread =?ISO-8859-1?Q?Xavier_D=E9coret?=
Xavier Décoret a écrit : > I would like to know if there is for python's classes an equivalent of > the operator= that can be overidden. > > Let's say I have > >>> a=A() > and I want to write > >>> a=5 > and I want this to change some internal value of a instead of making a > point to a new ob

RE: [python-win32] NTService detecting if the Windows System is Idle

2005-06-13 Thread Hughes, Chad O
-Original Message- From: Hughes, Chad O Sent: Monday, June 13, 2005 9:09 AM To: 'Fred Dixon' Subject: RE: [python-win32] NTService detecting if the Windows System is Idle There may be important processes running in the background (headless process with no user interaction) that need re

Re: searching for IDE

2005-06-13 Thread Trent Mick
[Grumman wrote] > alexrait1 wrote: > > I need an IDE for python that has the ability to show the filds of a > > class when I write "." > > Just the way it works in eclipse/JBuilder with java or visual studio > > with c++ > > For now I treid eric3 and IDLE they don't do this... > > > > The ActiveS

implicit variable declaration and access

2005-06-13 Thread Ali Razavi
Is there any reflective facility in python that I can use to define a variable with a name stored in another variable ? like I have : x = "myVarName" what can I do to declare a new variable with the name of the string stored in x. And how can I access that implicitly later ? -- http://mail.python

Re: string formatting using the % operator

2005-06-13 Thread William Gill
Dan Sommers wrote: > On Mon, 13 Jun 2005 15:12:54 GMT, > William Gill <[EMAIL PROTECTED]> wrote: > > >>I am using the % operator to create queries for a db app. It works fine >>when exact strings, or numbers are used, but some queries need partial >>matching that use the '%' as a wildcards. So f

Re: What is different with Python ?

2005-06-13 Thread Tom Anderson
On Mon, 13 Jun 2005, Roy Smith wrote: > O(2) behavior Um ... > Lisp, of course, expanded my mind in ways that only Lisp can (the same > could be said for many things I tried back in those days). Surely you're not saying you experimented with ... APL? > I think it's probably just as important

Re: What is different with Python ?

2005-06-13 Thread Terry Hancock
On Monday 13 June 2005 12:55 am, Andrea Griffini wrote: > On Sun, 12 Jun 2005 20:22:28 -0400, Roy Smith <[EMAIL PROTECTED]> wrote: > > >How far down do you have to go? What makes bytes of memory, data busses, > >and CPUs the right level of abstraction? > > They're things that can be IMO genuine

Re: ElementTree Namespace Prefixes

2005-06-13 Thread Oren Tirosh
Fredrik Lundh wrote: > Chris Spencer wrote: > > > If an XML parser reads in and then writes out a document without having > > altered it, then the new document should be the same as the original. > > says who? Good question. There is no One True Answer even within the XML standards. It all boils

Re: implicit variable declaration and access

2005-06-13 Thread Ali Razavi
Ali Razavi wrote: > Is there any reflective facility in python > that I can use to define a variable with a > name stored in another variable ? > like I have : > x = "myVarName" > > what can I do to declare a new variable with the name of the string > stored in x. And how can I access that implici

Re: case/switch statement?

2005-06-13 Thread Terry Hancock
On Sunday 12 June 2005 07:33 am, Dan Sommers wrote: > > There is no case statement in Python. If you don't care about > > readability, one alternative is to use a dictionary: > > > case = {5: do_this, 6: do_that} > > case.get(x, do_something_else)() > > I find this very readable. YMMV. Yeah, an

Re: string formatting using the % operator

2005-06-13 Thread Peter Hansen
Dan Sommers wrote: > Let the DB-API do more work for you: > > cursor = connection.cursor( ) > sql = """SELECT column2, columns3 FROM table WHERE name LIKE %s""" > values = ('%%%s%%' % searchterm,) # note that this is a tuple It looks like this might be a rare case where not using the

Re: Tkinter app structure

2005-06-13 Thread Richard Lewis
On Mon, 13 Jun 2005 16:45:11 +0100, "Richard Lewis" <[EMAIL PROTECTED]> said: > > Whats going wrong? Is it a 'circular import'? Is there a better way that > I could organise these modules? > I've got a hack which I'm not happy with: I've got rid of the main.py module and put its code into the s

Re: Controlling assignation

2005-06-13 Thread Peter Hansen
Xavier Décoret wrote: > What I wanted to do is something like this: > > def change(x,v): > x = v > > class A(object): > def __init__(self,v): > self.x = v > > a = A(3) > print a.x # displays 3 > change(a.x,4) > print a.x # still displays 3 How about this? def change(x, v):

Re: implicit variable declaration and access

2005-06-13 Thread Benji York
Ali Razavi wrote: > Ali Razavi wrote: > >>Is there any reflective facility in python >>that I can use to define a variable with a >>name stored in another variable ? > Got it! use higher order functions like Lisp! No, you use higher order functions like Python. :) > code = x + '= 0' > exec(cod

Re: Controlling assignation

2005-06-13 Thread Terry Reedy
"harold fellermann" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >if you write > >>> a=A() >an instance of class A is created and bound to the local identifier 'a'. I think it perhaps better to think of the label 'a' being bound to the object rather than vice versa. For one,

Re: Controlling assignation

2005-06-13 Thread harold fellermann
On 13.06.2005, at 19:23, Terry Reedy wrote: > > "harold fellermann" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >> if you write > a=A() >> an instance of class A is created and bound to the local identifier >> 'a'. > > I think it perhaps better to think of the label 'a' b

Re: subprocess module and blocking

2005-06-13 Thread Dieter Maurer
Robin Becker <[EMAIL PROTECTED]> writes on Sun, 12 Jun 2005 09:22:52 +: > I'm using a polling loop in a thread that looks approximately like this > > while 1: > p = find_a_process() > rc = p.poll() > if rc is not None: > out, err = p.communicate() > #deal with

Re: implicit variable declaration and access

2005-06-13 Thread Peter Dembinski
Benji York <[EMAIL PROTECTED]> writes: [snap] >> code = x + '= 0' >> exec(code) > > You should generally stay away from exec for lots of reasons. Code 'refactorizability' is one of them. -- http://mail.python.org/mailman/listinfo/python-list

Re: case/switch statement?

2005-06-13 Thread Skip Montanaro
Terry> Yeah, and I find this even more so: Terry> case = { Terry> 5: do_this, Terry> 6: do_that, Terry> } Terry> case.get(x, do_default)() Terry> Which is looking pretty close to a case statement, anyway. Sure, modulo namespace issues. Skip

Re: searching for IDE

2005-06-13 Thread RM
You should also check out eric3. It is cross-platform, free, very advanced, and with a super active development community. -RM alexrait1 wrote: > I need an IDE for python that has the ability to show the filds of a > class when I write "." > Just the way it works in eclipse/JBuilder with java or

Re: searching for IDE

2005-06-13 Thread RM
oops. I didn't see the part about you having tried eric3 already. For your part, you may have missed the very good auto-completion tools available for eric3. Look here: http://www.die-offenbachs.de/detlev/eric3-contrib.html -RM -- http://mail.python.org/mailman/listinfo/python-list

Is Python Suitable for Large Find & Replace Operations?

2005-06-13 Thread rbt
Here's the scenario: You have many hundred gigabytes of data... possible even a terabyte or two. Within this data, you have private, sensitive information (US social security numbers) about your company's clients. Your company has generated its own unique ID numbers to replace the social securi

Re: Dealing with marketing types...

2005-06-13 Thread Terry Hancock
On Monday 13 June 2005 08:46 am, Thomas Bartkus wrote: > "Steve Jorgensen" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > On Sat, 11 Jun 2005 11:51:02 -0500, tom <[EMAIL PROTECTED]> wrote: > > > > ... > > >Let me add an Item #3 - > > >If you have some entrepeneurial savvy and can

Re: What is different with Python ?

2005-06-13 Thread Mike
>there should be no room for "magic" in a computer >for a professional programmer. > well put. sounds like the makings of a good signature... -- http://mail.python.org/mailman/listinfo/python-list

Re: Annoying behaviour of the != operator

2005-06-13 Thread Rocco Moretti
Before I answer, let me clarify my position. I am NOT advocating any change for the 2.x series. I'm not even forwarding any particular proposal for 3.0/3000. My key (and close to sole) point is that behavior of > & < is conceptually distinct from ordering in a sorted list, even though the beha

  1   2   3   >