Re: slicing the end of a string in a list

2006-03-02 Thread Peter Otten
John Salerno wrote: > You can probably tell what I'm doing. Read a list of lines from a file, > and then I want to slice off the '\n' character from each line. If you are not concerned about memory consumption there is also open(filename).read().splitlines() Peter -- http://mail.python.org/mai

Re: slicing the end of a string in a list

2006-03-02 Thread Leif K-Brooks
Ben Cartwright wrote: > No, since the line variable is unused. This: > > i = 0 > for line in switches: > line = switches[i][:-1] > i += 1 > > Would be better written as: > > for i in range(len(switches)): > switches[i] = switches[i][:-1] This is better, IMHO: for i, sw

Re: RPC client class?

2006-03-02 Thread Fredrik Lundh
Dick Watson wrote: > We have a legacy device that exposes an RPC server. We have an RPCL > defininition of its interface. We want to develop an RPC client of this > interface in Python that will be usable in both Win32 and open systems > environments. > > I can find some *very* dated references to

Re: Write a GUI for a python script?

2006-03-02 Thread [EMAIL PROTECTED]
Grant Edwards wrote: > On 2006-03-02, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > Note that wxWindows wraps native widgets, > > Not on Linux/KDE systems. ;) Right, I followed that with a clarification of supported systems. You can use wxwindows with gtk-qt to get a Qt-ish look, although t

Re: newbie question

2006-03-02 Thread Tim Roberts
Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: >On 1 Mar 2006 12:47:26 -0800, "D" <[EMAIL PROTECTED]> declaimed the >following in comp.lang.python: > >> Yep, that should work. Just keep in mind that if python.exe is not in >> your path, you will need to either specify the entire path to it >> (i.e.

help in converting perl re to python re

2006-03-02 Thread eight02645999
hi i have some regular exp code in perl that i want to convert to python. if $line =~ m#<(tag1)>(.*)# { $variable = $2; } the perl code finds a line that matches something like "sometext<\tag1>" in the line and then assign $variable the value of "sometext" how can i do an equival

Qns on blank lines

2006-03-02 Thread eight02645999
hi i have some regular exp code in perl that i want to convert to python. if $line =~ m#<(tag1)>(.*)# { $variable = $2; } the perl code finds a line that matches something like "sometext<\tag1>" in the line and then assign $variable the value of "sometext" how can i do an equival

Re: how to overload sqrt in a module?

2006-03-02 Thread Michael McNeil Forbes
> On Thu, 2 Mar 2006 16:12:53 -0800, Michael McNeil Forbes wrote: > >> I would like to write a module that provides some mathematical functions >> on top of those defined in math, cmath etc. but I would like to make it >> work with "any" type that overloads the math functions. >> On Fri, 3 Mar 2006

Re: how to overload sqrt in a module?

2006-03-02 Thread Michael McNeil Forbes
>> Are there any other more generic solutions (without having to write >> "custom" functions like numpy.sqrt)? > > No. *Someone* always has to write those "custom" functions. In the case of > len() > and abs(), that someone was Guido. For numpy.sqrt(), that someone was Travis > Oliphant. For anyth

Re: Importing Files

2006-03-02 Thread Terry Hancock
On Thu, 2 Mar 2006 21:40:44 -0800 (PST) anushya beauty <[EMAIL PROTECTED]> wrote: > I am new to this python. I have installed python 2.4 > in my windows xp system. > > My issue is: > i have three directories with some files. > ex: Dir ---> Dir1 / file1.1.py > " ---

Re: how to overload sqrt in a module?

2006-03-02 Thread Robert Kern
Michael McNeil Forbes wrote: > Are there any other more generic solutions (without having to write > "custom" functions like numpy.sqrt)? No. *Someone* always has to write those "custom" functions. In the case of len() and abs(), that someone was Guido. For numpy.sqrt(), that someone was Travis

Re: slicing the end of a string in a list

2006-03-02 Thread Paul Rubin
John Salerno <[EMAIL PROTECTED]> writes: > Interesting. So I would say: > > [line.rstrip() for line in open('C:\\switches.txt')] Yes, you could do that. Note that it builds up an in-memory list of all those lines, instead of processing the file one line at a time. If the file is very large, that

Importing Files

2006-03-02 Thread anushya beauty
Hi,    I am new to this python. I have installed python 2.4 in my windows xp system. My issue is: i have three directories with some files. ex: Dir ---> Dir1 / file1.1.py    "   ---> Dir2 / file2.1.py    "   ---> Dir3 / file3.1.py These are the example directories i have. (Und

Re: how to overload sqrt in a module?

2006-03-02 Thread Michael McNeil Forbes
> Michael McNeil Forbes wrote: >> Here is one fairly ugly solution: >> >> module_g.py >> --- >> def g(x,math): >> return math.sqrt(x) >> >> > import math, cmath, module_g > module_g.g(2,math) >> >> 1.4142135623730951 >> > module_g.g(-2,cmath) >> >> 1.4142135623730951j >> >>

Re: slicing the end of a string in a list

2006-03-02 Thread John Salerno
John Salerno wrote: > Paul Rubin wrote: > >> The preferred way to remove the newline is more like: >>for line in open('C:\\switches.txt'): >> print line.rstrip() > > Interesting. So I would say: > > [line.rstrip() for line in open('C:\\switches.txt')] That seems to work. And on a relat

Swig, Python, and C++

2006-03-02 Thread Mich Peffe
Greetings All,I'm using SWIG for the first time and am running into some problems.  I've tried researching at swig.org and python.org, but unfortunately, most of the examples use programs I don't have, such as Solaris, Unix, and Irix.  I wish to make my C++ classes and functions accessible from Pyt

Re: slicing the end of a string in a list

2006-03-02 Thread John Salerno
Paul Rubin wrote: > The preferred way to remove the newline is more like: >for line in open('C:\\switches.txt'): > print line.rstrip() Interesting. So I would say: [line.rstrip() for line in open('C:\\switches.txt')] -- http://mail.python.org/mailman/listinfo/python-list

Python/Zope Jobs

2006-03-02 Thread OSS
1) Contract/Telecommute Python Crawler Developer 2) Python/C++ Developer, Greenwich, CT | 80-160k | Relo OK 3) Python/Zope Dev, Rockville, MD | 60-100k | Relo OK See http://groups.yahoo.com/group/pythonzopejobs for each job details -- http://mail.python.org/mailman/listinfo/python-list

Re: in need of some sorting help

2006-03-02 Thread ianaré
arrrg i did it again, not enough explanation... new to asking for programing help online. anyway the reason is that the list can be rearanged later in the program by another function, and i need a way to put it in order again.. so yes it is doing some pretty funky stuff, lol. so although your metho

RPC client class?

2006-03-02 Thread Dick Watson
We have a legacy device that exposes an RPC server. We have an RPCL defininition of its interface. We want to develop an RPC client of this interface in Python that will be usable in both Win32 and open systems environments. I can find some *very* dated references to a demo/rpc.py, but I can't

Re: do design patterns still apply with Python?

2006-03-02 Thread gene tani
Terry Hancock wrote: > > This sounds like an article crying out to be written, > "(Learning) Design Patterns with Python". > > Has it been written already? > > Cheers, > Terry > > -- > Terry Hancock ([EMAIL PROTECTED]) > Anansi Spaceworks http://www.AnansiSpaceworks.com There's a couple Alex M sl

Re: when do two names cease to refer to the same string object?

2006-03-02 Thread John Salerno
Farshid Lashkari wrote: > I asked a similar question a few weeks ago. I think the answers I got > will also answer your question as well. Here's a link to the thread: > > http://groups.google.com/group/comp.lang.python/browse_thread/thread/2f6f1d399ba94a7b/f564a219ffe44149?lnk=st&rnum=1&hl=en#f56

Re: slicing the end of a string in a list

2006-03-02 Thread Paul Rubin
John Salerno <[EMAIL PROTECTED]> writes: > > print [line[:-1] for line in open('C:\\switches.txt')] > > Hmm, I just realized in my original code that I didn't escape the > backslash. Why did it still work properly? The character the backslash isn't special: \s doesn't get into a code like \n, s

Re: when do two names cease to refer to the same string object?

2006-03-02 Thread Farshid Lashkari
I asked a similar question a few weeks ago. I think the answers I got will also answer your question as well. Here's a link to the thread: http://groups.google.com/group/comp.lang.python/browse_thread/thread/2f6f1d399ba94a7b/f564a219ffe44149?lnk=st&rnum=1&hl=en#f564a219ffe44149 -Farshid -- http

Re: slicing the end of a string in a list

2006-03-02 Thread John Salerno
Ben Cartwright wrote: > print [line[:-1] for line in open('C:\\switches.txt')] Hmm, I just realized in my original code that I didn't escape the backslash. Why did it still work properly? By the way, this whole 'one line' thing has blown me away. I wasn't thinking about list comprehensions w

Need help in Python Wrapper for EWFAPI from XPe

2006-03-02 Thread P Boy
I am trying to build a wrapper for the EWFAPI running on XPe. My first attempt was to use SWIG, but run to trouble with all these windows types such as WCHAR, DWORD, LPWSTR, ... I then searched further and found out about the ctypes module. However, some functions returns pointer to struct in ewfa

Re: how do you move to a new line in your text editor?

2006-03-02 Thread jussij
> One thing I like to do is use tabs for my indentation, because > this makes it easy to outdent when I need to start a new line > in column 1. I can press backspace once and move 4 spaces to > the left. Zeus has a Smart Backspace feature (configurable on or off) where by it will try to line up th

Re: Making a tiny script language using python: I need a string processing lib

2006-03-02 Thread Paul McGuire
"Sullivan WxPyQtKinter" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I do not know if there is any lib specially designed to process the > strings in scipt language. > for example: > I hope to process the string"print a,b,c,d,e "in the form"command > argumentlist" and return: > {'c

Re: slicing the end of a string in a list

2006-03-02 Thread John Salerno
Ben Cartwright wrote: > Actually, it creates a new string instance with the \n character > removed, then discards it. The original switches[0] string hasn't > changed. > Yes. You are repeated assigning a new string instance to "line", which > is then never referenced again. Ah, thank you! >

Re: slicing the end of a string in a list

2006-03-02 Thread Ben Cartwright
John Salerno wrote: > You can probably tell what I'm doing. Read a list of lines from a file, > and then I want to slice off the '\n' character from each line. But > after this code runs, the \n is still there. I thought it might have > something to do with the fact that strings are immutable, but

Re: how to overload sqrt in a module?

2006-03-02 Thread Robert Kern
Michael McNeil Forbes wrote: > Here is one fairly ugly solution: > > module_g.py > --- > def g(x,math): > return math.sqrt(x) > > import math, cmath, module_g module_g.g(2,math) > > 1.4142135623730951 > module_g.g(-2,cmath) > > 1.4142135623730951j > > I am sure there

Re: how to overload sqrt in a module?

2006-03-02 Thread mforbes
>> I would like to write a module that provides some mathematical functions on >> top of those defined in math, cmath etc. but I would like to make it work >> with "any" type that overloads the math functions. >> >> Thus, I would like to write: >> >> module_f.py >> >> def f(x): >>""" C

slicing the end of a string in a list

2006-03-02 Thread John Salerno
Here's the code I wrote: file = open('C:\switches.txt', 'r') switches = file.readlines() i = 0 for line in switches: line = switches[i][:-1] i += 1 print switches You can probably tell what I'm doing. Read a list of lines from a file, and then I want to slice off the '

Re: do design patterns still apply with Python?

2006-03-02 Thread Paul Rubin
"ajones" <[EMAIL PROTECTED]> writes: > Design patterns are kind of like sarcasm: hard to use well, not always > appropriate, and disgustingly bad when applied to problems they are not > meant to solve. +1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

Roundup Issue Tracker release 1.1.1

2006-03-02 Thread Richard Jones
I'm proud to release this, the 1.1.1 release of Roundup. Fixed in this release: - failure with browsers not sending "Accept-Language" header (sf bugs 1429646 and 1435335) - translate class name in "required property not supplied" error message (sf bug 1429669) - error in link property lookups

Re: Making a tiny script language using python: I need a string processing lib

2006-03-02 Thread James Stroud
Sullivan WxPyQtKinter wrote: > I do not know if there is any lib specially designed to process the > strings in scipt language. > for example: > I hope to process the string"print a,b,c,d,e "in the form"command > argumentlist" and return: > {'command'='print', > 'argumentlist'=['a','b','c','d','e']

Re: Question

2006-03-02 Thread Roy Smith
In article <[EMAIL PROTECTED]>, "Tom Leggio" <[EMAIL PROTECTED]> wrote: > Do I need this on my computer---Python---can I remove it without hurting > anything? > Thanks Tommy Tom, That's a very difficult question to answer without knowing more about your computer. Some systems depend on Pytho

Re: how to overload sqrt in a module?

2006-03-02 Thread Kent Johnson
Michael McNeil Forbes wrote: > I would like to write a module that provides some mathematical functions > on top of those defined in math, cmath etc. but I would like to make it > work with "any" type that overloads the math functions. > > Thus, I would like to write: > > module_f.py > > d

Question

2006-03-02 Thread Tom Leggio
Do I need this on my computer---Python---can I remove it without hurting anything? Thanks Tommy -- Please visit my web page @tomleggio.com Tom Leggio 194 NE 6th. CT. Dania Beach, Fl 33004-3633 954-205-5307 -- http://mail.python.org/mailman/listinfo/python-list

Making a tiny script language using python: I need a string processing lib

2006-03-02 Thread Sullivan WxPyQtKinter
I do not know if there is any lib specially designed to process the strings in scipt language. for example: I hope to process the string"print a,b,c,d,e "in the form"command argumentlist" and return: {'command'='print', 'argumentlist'=['a','b','c','d','e']} Are there any lib to implement this? Id

Re: setattr question

2006-03-02 Thread Kent Johnson
Gerard Flanagan wrote: > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/86900 > > mais il utilise 'apply', qui est...blah > > I was trying to implement the factory pattern. > The recipe above uses 'apply' which is deprecated according to the > docs, and I suppose I was curious how to

when do two names cease to refer to the same string object?

2006-03-02 Thread John Salerno
To test this out a wrote a little script as an exercise: for num in range(1, 10): x = 'c' * num y = 'c' * num if x is y: print 'x and y are the same object with', num, 'characters' else: print 'x and y are not the same object at', num,

Re: do design patterns still apply with Python?

2006-03-02 Thread Paul Rubin
Roy Smith <[EMAIL PROTECTED]> writes: > > Sandboxed code is a real obvious one. > What is "sandboxed code"? It's what the old rexec/bastion module tried unsuccessfully to implement: a way of running potentially hostile code while limiting the kinds of harmful stuff it can do. This is needed for t

Re: do design patterns still apply with Python?

2006-03-02 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Paul Rubin wrote: > Roy Smith <[EMAIL PROTECTED]> writes: > > > Somewhat less often, something is easy in Java and difficult in > > > Python. > > Example? > > Sandboxed code is a real obvious one. What is "sandboxed code"? -- http://ma

Re: do design patterns still apply with Python?

2006-03-02 Thread Paul Rubin
Roy Smith <[EMAIL PROTECTED]> writes: > > Somewhat less often, something is easy in Java and difficult in > > Python. > Example? Sandboxed code is a real obvious one. -- http://mail.python.org/mailman/listinfo/python-list

Re: do design patterns still apply with Python?

2006-03-02 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Paul Rubin wrote: > Somewhat less often, something is easy in Java and difficult in > Python. Example? -- http://mail.python.org/mailman/listinfo/python-list

Re: do design patterns still apply with Python?

2006-03-02 Thread Thomas G. Willis
On 3/2/06, Terry Hancock <[EMAIL PROTECTED]> wrote: On Thu, 02 Mar 2006 16:38:44 -0500Roy Smith <[EMAIL PROTECTED]> wrote:> In article <[EMAIL PROTECTED] >,>  John Salerno <[EMAIL PROTECTED]> wrote:> > Since Python does so many things different, especially> > compared to  compiled and statically ty

Re: how do you move to a new line in your text editor?

2006-03-02 Thread Sudden Disruption
John, > This is a real small point No point is small when you apply it hundreds of times a day. I spent quite a bit of time on this element and ended up allowing conversion from tabs to spaces and the reverse. Who knows what you'll find in the world of ASCII. Historically, Tabs were stops on th

Re: do design patterns still apply with Python?

2006-03-02 Thread Paul Rubin
John Salerno <[EMAIL PROTECTED]> writes: > Since Python does so many things different, especially compared to > compiled and statically typed languages, do most of the basic design > patterns still apply when writing Python code? If I were to read a > design pattern book (such as Head First Design

Re: Problem with dbi, odbc module and Oracle 9.2 - suffixed "L" with number data type

2006-03-02 Thread Andrew MacIntyre
[posted & mailed] [EMAIL PROTECTED] wrote: > The only issue I've had so far is retrieving data from Oracle when an > integer has been defined like: > >number(p)[same thing as number(p,0) evidently] > > This is from a database I didn't design and can't change. Evidently > there are n

how to overload sqrt in a module?

2006-03-02 Thread Michael McNeil Forbes
I would like to write a module that provides some mathematical functions on top of those defined in math, cmath etc. but I would like to make it work with "any" type that overloads the math functions. Thus, I would like to write: module_f.py def f(x): """ Compute sqrt of x """ retu

Re: Printing a file

2006-03-02 Thread Fabian Steiner
David Boddie wrote: > Sorry about that. I must have just skipped over the setup() call in > your code. If you're creating highly customized content then I think > you'll always need to think about getting the pages to the printer in > the right order. > > For rich text documents, there's code that

Re: in need of some sorting help

2006-03-02 Thread Ben Cartwright
ianaré wrote: > However, i need the sorting done after the walk, due to the way the > application works... should have specified that, sorry. If your desired output is just a sorted list of files, there is no good reason that you shouldn't be able sort in place. Unless your app is doing somethin

Re: Write a GUI for a python script?

2006-03-02 Thread Grant Edwards
On 2006-03-02, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Note that wxWindows wraps native widgets, Not on Linux/KDE systems. ;) -- Grant Edwards grante Yow! ANN JILLIAN'S HAIR at makes LONI ANDERSON'S

Re: do design patterns still apply with Python?

2006-03-02 Thread Terry Hancock
On Thu, 02 Mar 2006 16:38:44 -0500 Roy Smith <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > John Salerno <[EMAIL PROTECTED]> wrote: > > Since Python does so many things different, especially > > compared to compiled and statically typed languages, do > > most of the basic design

Re: do design patterns still apply with Python?

2006-03-02 Thread ajones
John Salerno wrote: > Yeah, that's what I was wondering. I wonder if, after reading a DP book, > I might have to 'unlearn' some things when applying them to Python. I would say adjust instead of unlearn. This is probably true to a lesser or greater extent of any language for which your DP book was

Re: Write a GUI for a python script?

2006-03-02 Thread [EMAIL PROTECTED]
John M. Gabriele wrote: > -- GTK+ is what most Gnome apps use. The Python binding is PyGTK. > http://www.pygtk.org/ [snip] > -- wxWindows is a lot like MS Windows MFC if I recall correctly. > The Python binding to wxWindows is called wxPython. > http://www.wxpython.org/ Note that wxWin

Re: string stripping issues

2006-03-02 Thread orangeDinosaur
thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: string stripping issues

2006-03-02 Thread Ben Cartwright
Ben Cartwright wrote: > orangeDinosaur wrote: > > I am encountering a behavior I can think of reason for. Sometimes, > > when I use the .strip module for strings, it takes away more than what > > I've specified. For example: > > > > >>> a = 'Hughes. John\r\n' > > > > >>> a.strip('') > > >

Re: Best python module for Oracle, but portable to other RDBMSes

2006-03-02 Thread skip
dananrg> Are you saying I'm getting the "L" as an artifact of printing? No, you're getting the "L" because you're printing a long integer. If you execute x = 872L y = 872 at a Python prompt, x will be a long integer and y will be an integer. Long integers can represent arbitrarily

Re: string stripping issues

2006-03-02 Thread ianaré
from the python manual: strip( [chars]) The chars argument is not a prefix or suffix; rather, all combinations of its values are stripped: >>> 'www.example.com'.strip('cmowz.') 'example' in your case since the letter 'H' is in your [chars] and the name starts with an H it gets stripped, b

Re: setattr question

2006-03-02 Thread Gerard Flanagan
Fredrik Lundh wrote: > Gerard Flanagan wrote: > > > I have the following code: > > > > builder.py # > > class HtmlBuilder(object): > > > > @staticmethod > > def page(title=''): > > return HtmlPage(title) > > > > @staticmethod > > def element(tag, text=None, **at

Re: string stripping issues

2006-03-02 Thread Ben Cartwright
orangeDinosaur wrote: > I am encountering a behavior I can think of reason for. Sometimes, > when I use the .strip module for strings, it takes away more than what > I've specified. For example: > > >>> a = 'Hughes. John\r\n' > > >>> a.strip('') > > returns: > > 'ughes. John\r\n' > > Howe

Re: wxPython memory footprint? - Re: Write a GUI for a python script?

2006-03-02 Thread ianaré
> What is the minimal memory footprint of a Hello World wxPython app > meanwhile (when you cx_freeze/py2exe it) it's kinda weird actually... I'm not 100% sure, but i think it relates more to py2exe options, not neccessarily to wxPython. in any case the least memory usage i've seen for an app that

Re: import, from and reload

2006-03-02 Thread Dave Benjamin
On Thu, 2 Mar 2006, John Salerno wrote: > Dave Benjamin wrote: > >> In general, "from X import *" should be avoided anyway, for reasons that >> have been discussed many times in the past. The annoyance with reloading is >> just one more reason. Better to just use "import X" in the first place. >

string stripping issues

2006-03-02 Thread orangeDinosaur
Hello, I am encountering a behavior I can think of reason for. Sometimes, when I use the .strip module for strings, it takes away more than what I've specified. For example: >>> a = 'Hughes. John\r\n' >>> a.strip('') returns: 'ughes. John\r\n' However, if I take another string, for

Re: Best python module for Oracle, but portable to other RDBMSes

2006-03-02 Thread dananrg
> If you actually get a suffixed L in the resulting text file, you > are using a strange way to convert your data to text. You aren't > simply printing lists or tuples are you? Then other types, such as > datetime objects will also look bizarre. (Not that the ancient > odbc would support that...) >

Re: do design patterns still apply with Python?

2006-03-02 Thread Roy Smith
In article <[EMAIL PROTECTED]>, John Salerno <[EMAIL PROTECTED]> wrote: > Since Python does so many things different, especially compared to > compiled and statically typed languages, do most of the basic design > patterns still apply when writing Python code? If I were to read a > design patt

Re: Shared memory

2006-03-02 Thread Paddy
Pylinda ? http://www-users.cs.york.ac.uk/~aw/pylinda/ -- http://mail.python.org/mailman/listinfo/python-list

Re: how do you move to a new line in your text editor?

2006-03-02 Thread Tim Chase
> I use Vim, use spaces, and have no problems. It has a > shorttabstop option, which causes backspace to backspace > to the preceding multiple of spaces when the > curser is after a set of spaces at the beginning of the > line. It feels like I'm using tabs, but I'm not. In addition, within in

Re: setattr question

2006-03-02 Thread Gerard Flanagan
bruno at modulix wrote: > Gerard Flanagan wrote: > > Hello > > > > I have the following code: > > > > builder.py # > > class HtmlBuilder(object): > > > > @staticmethod > > def page(title=''): > > return HtmlPage(title) > > > > @staticmethod > > def element(tag,

Re: wxPython memory footprint? - Re: Write a GUI for a python script?

2006-03-02 Thread Chris Mellon
On 3/2/06, robert <[EMAIL PROTECTED]> wrote: > ianaré wrote: > > > wxPython is another good option, especially since there is > > boa-constructor, which is a great GUI builder, almost makes it too easy > > to make a nice looking app in no time at all. > > > > http://www.wxpython.org/download.php >

Re: Simple System Tray Icon

2006-03-02 Thread 3c273
quoted This is untested, 'cos I'm on a Mac these days, but what you want should look something like: from SysTrayIcon import SysTrayIcon icon = SysTrayIcon('parh/to/icon.ico', "Hover text", {}) How simple do you want? /quoted I guess I still don't get it. The code you supplied c

Re: do design patterns still apply with Python?

2006-03-02 Thread Grant Edwards
On 2006-03-02, John Salerno <[EMAIL PROTECTED]> wrote: > Since Python does so many things different, especially compared to > compiled and statically typed languages, do most of the basic design > patterns still apply when writing Python code? Definitely. Especially plaid, paisley, and a nice

Re: do design patterns still apply with Python?

2006-03-02 Thread John Salerno
[EMAIL PROTECTED] wrote: > In python, you might find it more natural to do design patterns in a > completely different way than they're implemented in Java. For > example, I've heard of using the Singleton pattern in python by just > implementing it as a module, no classes necessary. Yeah, that

Re: how do you move to a new line in your text editor?

2006-03-02 Thread Michael Ekstrand
On Thu, 02 Mar 2006 18:39:55 GMT John Salerno <[EMAIL PROTECTED]> wrote: > But I read in the PEP that spaces are recommended over tabs. If this is > the case, it would involve pressing backspace 4 times (or 8, etc.) to > get back to column 1. > > So I'm wondering, how do you all handle moving ar

pickle and converting to new-style classes

2006-03-02 Thread [EMAIL PROTECTED]
Hi, I have a fairly sizable body of python code that I'm in the process of modernizing. One of the modernization steps is converting to use new-style classes, and this is leading to problems with pickle. What's happening is that part of the test suite for this code includes pickled instances of t

Re: do design patterns still apply with Python?

2006-03-02 Thread [EMAIL PROTECTED]
Hi John. Design patterns aren't tied to any specific implementation so they should apply to any language. You might find that they can even apply to solution domains outside of computer science. Implementation details will usually differ between languages. But the implementation can also be dif

Re: setattr question

2006-03-02 Thread Fredrik Lundh
Gerard Flanagan wrote: > I have the following code: > > builder.py # > class HtmlBuilder(object): > > @staticmethod > def page(title=''): > return HtmlPage(title) > > @staticmethod > def element(tag, text=None, **attribs): > return HtmlElement(tag, text

Re: wxPython memory footprint? - Re: Write a GUI for a python script?

2006-03-02 Thread Michael Ekstrand
On Thu, 02 Mar 2006 19:52:34 +0100 robert <[EMAIL PROTECTED]> wrote: > Can you debug & call functions interactively from e.g. Pythonwin while a > wxPython app is running. It's a snap to incorporate a nice GUI Python shell with object browser into any wxPython app - wxPython provides its PyCrust s

Re: Does '#hash' mean anything in IDLE?

2006-03-02 Thread John Salerno
John Coleman wrote: > John Coleman wrote: >> Greetings, >>I am currently trying to learn Python through the excellent >> "Learning Python" book. me too! > It isn't just #hash, but also things like #dict, #int, #len at the > start of a comment line which defeats IDLE's colorization algorithm.

do design patterns still apply with Python?

2006-03-02 Thread John Salerno
Since Python does so many things different, especially compared to compiled and statically typed languages, do most of the basic design patterns still apply when writing Python code? If I were to read a design pattern book (such as Head First Design Patterns), could I apply their Java examples

Re: Does '#hash' mean anything in IDLE?

2006-03-02 Thread John Coleman
John Coleman wrote: > Greetings, >I am currently trying to learn Python through the excellent > "Learning Python" book. I wrote my first non-trivial program, which > began with several comment lines. One of the comment lines began with > '#hash'. IDLE doesn't colorize it as a comment line but

Does '#hash' mean anything in IDLE?

2006-03-02 Thread John Coleman
Greetings, I am currently trying to learn Python through the excellent "Learning Python" book. I wrote my first non-trivial program, which began with several comment lines. One of the comment lines began with '#hash'. IDLE doesn't colorize it as a comment line but instead colors the word 'hash'

Re: why does close() fail miserably on popen with exit code -1 ?!

2006-03-02 Thread Tobiah
Still: phase:toby:~> echo 'exit -1' | bash phase:toby:~> echo $? 255 phase:toby:~> Jeffrey Schwab wrote: > Atanas Banov wrote: > >> i ran onto this weirdness today: seems like close() on popen-ed >> (pseudo)file fails miserably with exception instead of returning exit >> code, when said exit c

Re: how do you move to a new line in your text editor?

2006-03-02 Thread John Salerno
Bill Scherer wrote: > John Salerno wrote: > >> I use UltraEdit right now, and it is possible to convert spaces and >> tabs back and forth, but it's just an extra step. I was thinking about >> trying vim, as I've heard it's easier to learn than emacs. >> >> > Absolutely. It's also easier to lea

Re: white space in expressions and argument lists

2006-03-02 Thread Scott David Daniels
Sybren Stuvel wrote: > I just read the PEP where my way of alignment is under a 'NO' header. > Too bad, since I think it can make things a lot clearer. One reason is such code changes too much on code edits: foo= 'bar' foobar = 42 azimov = 3 to: foo = 'bar' somet

Re: Simple System Tray Icon

2006-03-02 Thread 3c273
"Simon Brunning" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] This is untested, 'cos I'm on a Mac these days, but what you want should look something like: from SysTrayIcon import SysTrayIcon icon = SysTrayIcon('parh/to/icon.ico', "Hover text", {}) How simple do you want? That'

Re: Write a GUI for a python script?

2006-03-02 Thread John M. Gabriele
John M. Gabriele wrote: > > There are Python bindings to most GUI toolkits (GTK+, Qt, fltk, wxWindows, > and Tk come to mind). Whoops. Forgot fltk with the pyFLTK Python binding. fltk is a fast, light, toolkit that's written in C++ but (again, IIRC) feels more like C-with-classes (which isn't a b

Re: Shared memory

2006-03-02 Thread Michel Claveau
mmap? -- @-salutations Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Write a GUI for a python script?

2006-03-02 Thread John M. Gabriele
Glurt Wuntal wrote: > I am a newbie with Python. It's a great language, but I would like to be > able to present a simple gui menu for some of my scripts; something better > than using 'raw_input' prompts. > > Any recommendations for a program that will allow me to create the gui > screens? Someth

Re: white space in expressions and argument lists

2006-03-02 Thread rtilley
John Salerno wrote: > All of it was a joke? You'd have to ask Guido that :) I took it literally when I first read it b/c it made sense to me and I did not notice the date. I don't think it will ever be _required_ of all Python hackers, but I may be wrong. -- http://mail.python.org/mailman/list

re-posting: web.py, incomplete

2006-03-02 Thread _wolf
hi all, this is a re-posting of my question i asked a month or so ago. i installed web.py, flups, and cheetah. when i copy'n'paste the sample app from then http://webpy.org homepage :: import web urls = ( '/(.*)', 'hello' ) class hello: def GET(self, name):

Re: compare classes and not class instances

2006-03-02 Thread [EMAIL PROTECTED]
Awesome! Perfect! Thanks Janto -- http://mail.python.org/mailman/listinfo/python-list

Re: Suggestions for documentation generation?

2006-03-02 Thread John M. Gabriele
Michael Ekstrand wrote: > > > Doxygen has recently added support for Python, [snip] Didn't know that. Thanks for the heads-up. :) -- (remove zeez if demunging email address) -- http://mail.python.org/mailman/listinfo/python-list

Re: how do you move to a new line in your text editor?

2006-03-02 Thread John Salerno
Paul McNett wrote: > That said, you should be able to tell your editor how to behave in the > indent/unindent case, no matter whether you use tabs or spaces. If not, > time to switch editors! ;) I definitely can, I'm just a little unsure about what the special outdenting cases might be. The wa

Re: how do you move to a new line in your text editor?

2006-03-02 Thread John Salerno
Carl Banks wrote: > You wouldn't know if Ultraedit has some kind of hook mechanism (whereby > it can execute a macro or script or something upon loading/saving). > That could solve your problem. Obviously, having to manually convert > isn't too helpful. I'll have to check on that. I know I can d

Re: how do you move to a new line in your text editor?

2006-03-02 Thread Bill Scherer
John Salerno wrote: >I use UltraEdit right now, and it is possible to convert spaces and tabs >back and forth, but it's just an extra step. I was thinking about trying >vim, as I've heard it's easier to learn than emacs. > > Absolutely. It's also easier to learn to ride a Huffy than a Schwinn,

Re: how do you move to a new line in your text editor?

2006-03-02 Thread Carl Banks
John Salerno wrote: > Carl Banks wrote: > > John Salerno wrote: > >> So I'm wondering, how do you all handle moving around in your code in > >> cases like this? Is there some sort of consistency to these things that > >> you can write rules for your text editor to know when to outdent? It > >> doe

Re: how do you move to a new line in your text editor?

2006-03-02 Thread John Salerno
Carl Banks wrote: > John Salerno wrote: >> So I'm wondering, how do you all handle moving around in your code in >> cases like this? Is there some sort of consistency to these things that >> you can write rules for your text editor to know when to outdent? It >> doesn't seem like you can do this re

  1   2   3   >