Re: Problem loading a file of words

2005-07-24 Thread Peter Otten
teoryn wrote: > I've been spending today learning python and as an exercise I've ported > a program I wrote in java that unscrambles a word. Before describing > the problem, here's the code: > line = str.lower(line[:-1]) # convert to lowercase just in case > have to add exceptions later)

Re: Importing User-defined Modules

2005-07-24 Thread Steve Holden
Walter Brunswick wrote: I need to import modules with user-defined file extensions that differ from '.py', and also (if possible) redirect the bytecode output of the file to a file of a user-defined extension. I've already read PEP 302 (http://www.python.org/peps/pep-0302.html), but I didn't full

Re: PyGTK or wxPython (not a flame war) on Windows

2005-07-24 Thread Robert Kern
Torsten Bronger wrote: > As far as i know, there is nothing official. But I've read several > times that it's the most likely candidate for a seconds GUI system > for being included. I think you're reading *way* too much into people engaging in wishful thinking. -- Robert Kern [EMAIL PROTECTE

Re: PyGTK or wxPython (not a flame war) on Windows

2005-07-24 Thread Torsten Bronger
Hallöchen! Bryan <[EMAIL PROTECTED]> writes: > Torsten Bronger wrote: > >> Besides, wxPython prepares for being included into the standard >> distribution. > > wow, i've never heard this said so explicitly. is there a > reference link backing up this statement? i really really hope > this is tr

Re: Invoke a method to a specific thread

2005-07-24 Thread en.karpachov
Mon, Jul 25, 2005 at 01:20:39PM +0800, Varghj?rta пишет: > When doing GUI apps in C# I often have to call a method that will > modify the GUI somehow from a different thread then the GUI is on (to > allow for GUI responsiveness). I simply call Invoke() or BeginInvoke > which resides in another thre

Re: How to run python script in background after i logout

2005-07-24 Thread Steve Holden
Harlin Seritt wrote: > I have a remote linux server where I can only access it via ssh. I have > a script that I need to have run all the time. I run like so: > > python script.py & > > It runs fine. When I log off ssh I notice that the script died when I > logged off. How do I make sure it stays

Invoke a method to a specific thread

2005-07-24 Thread Varghjärta
Taking the opportunity to ask yet another python question as a newbie to this list, that's been bugging a wee but that I've managed to put off. When doing GUI apps in C# I often have to call a method that will modify the GUI somehow from a different thread then the GUI is on (to allow for GUI resp

Re: Problem loading a file of words

2005-07-24 Thread Devan L
Robert Kern wrote: > That's definitely not the kind of dictionary that he wants. > > -- > Robert Kern > [EMAIL PROTECTED] > > "In the fields of hell where the grass grows high > Are the graves of dreams allowed to die." >-- Richard Harter Oh, I missed the part where he put values in a list

Re: Fire event when variable is Set/Get

2005-07-24 Thread Varghjärta
Thank you! Wow, this might be exactly what I want! Thanks to the pythonness (syntax) the code might even be shorter then implementing it in C#! Gonna go and play around with this some more(now), and can't wait til I get home (there will be some massive code cleaning). I wonder why I've never com

Re: Fire event when variable is Set/Get

2005-07-24 Thread gene tani
this recipe takes medium-deep copies (shallow copies of embedded sequences/dict's) of an obj's __dict__ when you need to monitor changes to the object's state from that point on: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/302742 -- http://mail.python.org/mailman/listinfo/python-list

Re: Fire event when variable is Set/Get

2005-07-24 Thread Mike C. Fletcher
Varghjärta wrote: ... But there is something that keeps bugging me, and that keeps me from embracing Python even more as a serious alternative to C#(for me). In C# I make heavy use of Get & Set, mainly to fire an event that some property has changed so that one can act on that _if one would need

Re: Problem loading a file of words

2005-07-24 Thread Robert Kern
Devan L wrote: > Heh, it reminds me of the code I used to write. > > def sort_string(word): > return ''.join(sorted(list(word.lower( > f = open('dictionary.txt','r') > lines = [line.rstrip('\n') for line in f.readlines()] > f.close() > dictionary = dict((sort_string(line),line) for line i

Re: Problem loading a file of words

2005-07-24 Thread Terrance N. Phillip
Kevin, I'm pretty new to Python too. I'm not sure why you're seeing this problem... is it possible that this is an "out-by-one" error? Is zymotechnics the *last* word in dictionary.txt? Try this slightly simplified version of your program and see if you have the same problem def sor

Re: Problem loading a file of words

2005-07-24 Thread Robert Kern
teoryn wrote: > I've been spending today learning python and as an exercise I've ported > a program I wrote in java that unscrambles a word. Before describing > the problem, here's the code: > > *--beginning of file--* > #!/usr/bin/python > # Filename: unscram.py > > def sort_string(word): >

Re: Problem loading a file of words

2005-07-24 Thread Devan L
teoryn wrote: > I've been spending today learning python and as an exercise I've ported > a program I wrote in java that unscrambles a word. Before describing > the problem, here's the code: > > *--beginning of file--* > #!/usr/bin/python > # Filename: unscram.py > > def sort_string(word): >

Re: Fire event when variable is Set/Get

2005-07-24 Thread tharaka
You are in luck because Python has "Properties" just like .NET. For details lookup the documentation of the built-in function property(). I'll just paste it here: property( [fget[, fset[, fdel[, doc) Return a property attribute for new-style classes (classes that derive from object). fget i

Re: Fire event when variable is Set/Get

2005-07-24 Thread Robert Kern
Varghjärta wrote: > Hey! > > I'm a hobby programmer since many years now and I've done most of my > latest 'real application' coding in C#. I've played with python of and > on yet not catching on until a few months ago when I got myself hocked > on it for real and now I love C# _and_ Python. > >

Re: Getting a dictionary from an object

2005-07-24 Thread Dark Cowherd
> voiceless-ly'rs What does this mean?? Just curious (googled that and ly'rs and didnt find anything relevant) -- Dark Cowherd -- http://mail.python.org/mailman/listinfo/python-list

Problem loading a file of words

2005-07-24 Thread teoryn
I've been spending today learning python and as an exercise I've ported a program I wrote in java that unscrambles a word. Before describing the problem, here's the code: *--beginning of file--* #!/usr/bin/python # Filename: unscram.py def sort_string(word): '''Returns word in lowercase s

Fire event when variable is Set/Get

2005-07-24 Thread Varghjärta
Hey! I'm a hobby programmer since many years now and I've done most of my latest 'real application' coding in C#. I've played with python of and on yet not catching on until a few months ago when I got myself hocked on it for real and now I love C# _and_ Python. But there is something that keeps

RE: [path-PEP] Path inherits from basestring again

2005-07-24 Thread Tony Meyer
[...] > Open issues: [...] > What about path * 4? If you keep the current join meaning of __div__, then assigning any sort of multiplication meaning to __mul__ would not be a good idea, IMO. It's natural to expect that __div__ and __mul__ are opposites. I suppose this means that you could make _

Re: PyGTK or wxPython (not a flame war) on Windows

2005-07-24 Thread Paul Rubin
I've had miserable experiences trying to use WxPython or GTK under both RH9 and Fedora Core 3. There is some version skew between the installed versions of GTK and the WxWidgets on the distro site. I made some progress by installing an old version of GTK but there was still some problem. I decid

Re: What is your favorite Python web framework?

2005-07-24 Thread Tim Lesher
I was using CherryPy quite a bit until recently, but I've since switched to Spyce: http://spyce.sf.net (and blogged it at http://apipes.blogspot.com/2005/07/first-taste-of-spyce.html). Spyce has been around since 2002 (so it's fairly stable and mature) but it's also under active development--a new

Re: PyGTK or wxPython (not a flame war) on Windows

2005-07-24 Thread Tim Lesher
Yes, it's not that hard to get the native file dialogs, as described in the FAQ: http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq21.013.htp It would be nice if PyGTK had a knob for making it use win32 dialogs by default, though. -- http://mail.python.org/mailman/listinfo/python-list

Re: PyGTK or wxPython (not a flame war) on Windows

2005-07-24 Thread Dave Cook
On 2005-07-24, Torsten Bronger <[EMAIL PROTECTED]> wrote: > Is PyGTK more Pythonic by the way? I find it more Pythonic than "raw" wxpython. However, the API still has the fingerprints of C programmers all over it. Compare the gtk's clunky treemodel/treeview API to Cocoa's elegant delegates.

Re: what's wrong with my code using subprocess?

2005-07-24 Thread Tim Lesher
I see the same behavior as you do. On Windows, the wait() isn't hanging--what's happening is that the subprocess just never receives anything. I don't quite understand why, but it works fine when I change the "if" clause in receiver.py to this: if count >= 1000: p.communicate('exit')

Re: return None

2005-07-24 Thread Christopher Subich
Repton wrote: > 'Well, there's your payment.' said the Hodja. 'Take it and go!' +1: the koan of None "Upon hearing that, the man was enlightened." -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple Problem

2005-07-24 Thread ncf
Thank you all for your replies. The repr() solution wasn't exactly what I was looking for, as I wasn't planning on eval()ing it, but the (en|de)code solution was exactly what I was looking for. An extended thanks to Jp for informing me of the version compatibility :) Have a GREAT day :) -Wes --

Re: Simple Problem

2005-07-24 Thread Jp Calderone
On 24 Jul 2005 18:14:13 -0700, ncf <[EMAIL PROTECTED]> wrote: >I know I've seen this somewhere before, but does anyone know what the >function to escape a string is? (i.e., encoding newline to "\n" and a >chr(254) to "\xfe") (and visa-versa) > >Thanks for helping my ignorance :P Python 2.4.1 (

Re: Simple Problem

2005-07-24 Thread Robert Kern
ncf wrote: > I know I've seen this somewhere before, but does anyone know what the > function to escape a string is? (i.e., encoding newline to "\n" and a > chr(254) to "\xfe") (and visa-versa) In [1]: s = "foo\n\xfe" In [2]: s.encode("string_escape") Out[2]: 'foo\\n\\xfe' In [3]: repr(s)[1:-1]

Re: Simple Problem

2005-07-24 Thread Paul Rubin
"ncf" <[EMAIL PROTECTED]> writes: > I know I've seen this somewhere before, but does anyone know what the > function to escape a string is? (i.e., encoding newline to "\n" and a > chr(254) to "\xfe") (and visa-versa) repr(s) -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple Problem

2005-07-24 Thread Cyril Bazin
By any chance are you speaking about the function "repr" ? Cyril On 24 Jul 2005 18:14:13 -0700, ncf <[EMAIL PROTECTED]> wrote: I know I've seen this somewhere before, but does anyone know what thefunction to escape a string is? (i.e., encoding newline to "\n" and achr(254) to "\xfe") (and visa-vers

Re: PyGTK or wxPython (not a flame war) on Windows

2005-07-24 Thread Peter Decker
On 7/24/05, Torsten Bronger <[EMAIL PROTECTED]> wrote: > Is PyGTK more Pythonic by the way? I had a look at wxPython > yesterday and didn't like that it has been brought into the Python > world nearly unchanged. You can see its non-Python origin clearly. > How does PyGTK feel in this respect? T

Simple Problem

2005-07-24 Thread ncf
I know I've seen this somewhere before, but does anyone know what the function to escape a string is? (i.e., encoding newline to "\n" and a chr(254) to "\xfe") (and visa-versa) Thanks for helping my ignorance :P -Wes -- http://mail.python.org/mailman/listinfo/python-list

Re: return None

2005-07-24 Thread Repton
geon wrote: > Ximo wrote: > > Can I do a function which don't return anything? > Nothing is None, or isnt? A woodman was carrying a sack full of chopped wood on his back. His sack was heavy and filled beyond its limit. The man, bent under his bulky burden, was struggling not to drop any of the woo

Re: PyGTK or wxPython (not a flame war) on Windows

2005-07-24 Thread Bryan
Torsten Bronger wrote: > > Besides, wxPython prepares for being included > into the standard distribution. > wow, i've never heard this said so explicitly. is there a reference link backing up this statement? i really really hope this is true. i'm very much in favor to see wx included in t

Re: Getting the --options of configure on installed python

2005-07-24 Thread gene tani
look in distutils.cfg: http://www.python.org/doc/2.4.1/inst/config-syntax.html for modules compiled in, sys.builtin_module_names -- http://mail.python.org/mailman/listinfo/python-list

Re: consistency: extending arrays vs. multiplication ?

2005-07-24 Thread Christopher Subich
Soeren Sonnenburg wrote: > On Sat, 2005-07-23 at 23:35 +0200, Marc 'BlackJack' Rintsch wrote: >>Both operate on the lists themselves and not on their contents. Quite >>consistent if you ask me. > But why ?? Why not have them operate on content, like is done on > *arrays ? Because they're lists,

Re: Path inherits from basestring again

2005-07-24 Thread Carl Banks
Reinhold Birkenfeld wrote: > Peter Hansen wrote: > > Reinhold Birkenfeld wrote: > >> One thing is still different, though: a Path instance won't compare to a > >> regular > >> string. > > > > Could you please expand on what this means? Are you referring to doing > > < and >= type operations on Pa

Getting the --options of configure on installed python

2005-07-24 Thread Thanos Tsouanas
Hello! Is there a way to get the --options with which python was configured on a system? Thanks in advance. -- Thanos Tsouanas .: My Music: http://www.thanostsouanas.com/ http://thanos.sians.org/ .: Sians Music: http://www.sians.org/ -- http://mail.python.org/mailman/listinfo/python-l

Re: [path-PEP] Path inherits from basestring again

2005-07-24 Thread Andrew Dalke
Reinhold Birkenfeld wrote: > Okay. While a path has its clear use cases and those don't need above methods, > it may be that some brain-dead functions needs them. "brain-dead"? Consider this code, which I think is not atypical. import sys def _read_file(filename): if filename == "-": # Ca

Re: [path-PEP] Path inherits from basestring again

2005-07-24 Thread Michael Hoffman
Reinhold Birkenfeld wrote: > I'm in no way the last instance on this. > For example, everyone with CVS access is free to change the files ;) I don't have CVS write access :(, so I'll have to keep kibitzing for now. > Honestly, I'm in constant fear that allowing too much and loading too much > fe

Re: consistency: extending arrays vs. multiplication ?

2005-07-24 Thread Carl Banks
Soeren Sonnenburg wrote: > On Sun, 2005-07-24 at 13:36 +1000, Steven D'Aprano wrote: > > On Sat, 23 Jul 2005 18:30:02 +0200, Soeren Sonnenburg wrote: > > > > > Hi all, > > > > > > Just having started with python, I feel that simple array operations '*' > > > and '+' don't do multiplication/additi

Re: How to run python script in background after i logout

2005-07-24 Thread James David
"Harlin Seritt" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I have a remote linux server where I can only access it via ssh. I have > a script that I need to have run all the time. I run like so: > > python script.py & > > It runs fine. When I log off ssh I notice that the script

Re: Getting a dictionary from an object

2005-07-24 Thread Bruno Desthuilliers
*Grandmaster* Steven Bethard a écrit : > > How about something like: > dict((name, getattr(obj, name)) for name in dir(obj)) > ... voiceless-ly'rs -- http://mail.python.org/mailman/listinfo/python-list

Re: Initializing interactive Python

2005-07-24 Thread Tomasz Rola
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 24 Jul 2005 [EMAIL PROTECTED] wrote: > Hi all, > is it possible to enter an interactive session and automatically > do some initialization? > I explain better: > I want that when I start interactive Python on a console (I use Linux) > two command l

Re: Try this

2005-07-24 Thread Michael Hoffman
RunLevelZero wrote: > I'm not sure I understand your first question but checkout the " glob " > module. Sounds like it may help. Who are you talking to? It would help if you quoted text from the original message, left some of the original subject, and replied to the original message instead of

Re: PyGTK or wxPython (not a flame war) on Windows

2005-07-24 Thread Torsten Bronger
Hallöchen! Marek Kubica <[EMAIL PROTECTED]> writes: > [...] > > I have started GUIs in Python with wx, but after a short time I > was annoyed how many things were buggy. I don't know why, but I > fell from one bug to the other while programming one application. I'm very suprised. wxPython is st

Re: Getting a dictionary from an object

2005-07-24 Thread Steven Bethard
Thanos Tsouanas wrote: > Steven Bethard wrote: > >>Maybe I'm not understanding your problem, but have you looked at the >>builtin "vars()"? > > I didn't know about it, but I knew about object.__dict__ which is, as I > see equivalent with vars(object). But it doesn't do the job for me, > since i

Re: How to run python script in background after i logout

2005-07-24 Thread Marek Kubica
Hello! On 24 Jul 2005 12:59:04 -0700 Steve M wrote: > Another is that when I use putty.exe from Windows for > my ssh client, I can't get scroll-back buffers to work correctly with > screen. (Screen is really powerful with its own scrollback buffers and > screendumps and stuff but I don't have tim

Re: How to run python script in background after i logout

2005-07-24 Thread Tomasz Rola
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 24 Jul 2005, Harlin Seritt wrote: > I have a remote linux server where I can only access it via ssh. I have > a script that I need to have run all the time. I run like so: > > python script.py & > > It runs fine. When I log off ssh I notice that

Re: How to run python script in background after i logout

2005-07-24 Thread Steve M
Harlin Seritt wrote: > I have a remote linux server where I can only access it via ssh. I have > a script that I need to have run all the time. I run like so: > > python script.py & > > It runs fine. When I log off ssh I notice that the script died when I > logged off. How do I make sure it stays r

Re: How to run python script in background after i logout

2005-07-24 Thread Mike Meyer
Thanos Tsouanas <[EMAIL PROTECTED]> writes: > On Sun, Jul 24, 2005 at 12:51:17PM +0300, Thanos Tsouanas wrote: >> On Sun, Jul 24, 2005 at 02:43:44AM -0700, Harlin Seritt wrote: >> > I have a remote linux server where I can only access it via ssh. I have >> > a script that I need to have run all th

Re: Friend wants to learn python

2005-07-24 Thread Marek Kubica
Hello, On 23 Jul 2005 10:24:02 -0700 Pietro Campesato wrote: > Maybe diveintopython.org can help I consider diveintopython a little bit to hard for the beginner. I really like this book, it's excellent, great thanks to Mike Pilgrim for providing us the book. I pointed a friend to Python Programm

Re: [path-PEP] Path inherits from basestring again

2005-07-24 Thread Reinhold Birkenfeld
Peter Hansen wrote: > Reinhold Birkenfeld wrote: >> Peter Hansen wrote: >>> if mypath.splitpath()[0] == 'c:/temp': > > vs. > >>> if mypath.splitpath()[0] == Path('c:/temp'): >> >> But you must admit that that't the cleaner solution. > > "Cleaner"? Not at all. I'd say it's the more express

Re: Detecting computers on network

2005-07-24 Thread Marek Kubica
Hello! On Fri, 22 Jul 2005 10:32:04 -0600 Sandeep Arya wrote: > Sybren.. Does nmap is available on every systems? I tried on my linux fc4 > machine in user previleage. it was not working. Does this just belongs to > superuser... I'm not Sybren, but I think I'm able to respond. nmap is only avai

Re: PyGTK or wxPython (not a flame war) on Windows

2005-07-24 Thread Marek Kubica
Hi! Am Sun, 24 Jul 2005 19:47:30 +0200 schrieb Torsten Bronger: > Is PyGTK more Pythonic by the way? I had a look at wxPython > yesterday and didn't like that it has been brought into the Python > world nearly unchanged. You can see its non-Python origin clearly. > How does PyGTK feel in this r

Try this

2005-07-24 Thread RunLevelZero
I'm not sure I understand your first question but checkout the " glob " module. Sounds like it may help. Here is how you could get the folders and filenames import os list = os.walk("C:\python24\Tools") for file in list: folderlist = os.path.split(file[0]) print "Folder*

Re: tuple to string?

2005-07-24 Thread Peter Hansen
Steven D'Aprano wrote: > Still, the subject is rapidly losing whatever interest it may have had. It had none. Kill it. "Kill the witch!" -- http://mail.python.org/mailman/listinfo/python-list

Re: consistency: extending arrays vs. multiplication ?

2005-07-24 Thread Robert Kern
Soeren Sonnenburg wrote: > On Sun, 2005-07-24 at 13:36 +1000, Steven D'Aprano wrote: > >>On Sat, 23 Jul 2005 18:30:02 +0200, Soeren Sonnenburg wrote: >> >>>Hi all, >>> >>>Just having started with python, I feel that simple array operations '*' >>>and '+' don't do multiplication/addition but instea

Re: consistency: extending arrays vs. multiplication ?

2005-07-24 Thread Soeren Sonnenburg
On Sat, 2005-07-23 at 12:15 -0700, Robert Kern wrote: > Soeren Sonnenburg wrote: > > Hi all, > > > > Just having started with python, I feel that simple array operations '*' > > and '+' don't do multiplication/addition but instead extend/join an > > array: > > > > a=[1,2,3] > > This isn't an arr

Re: consistency: extending arrays vs. multiplication ?

2005-07-24 Thread Soeren Sonnenburg
On Sat, 2005-07-23 at 20:25 -0700, Dan Bishop wrote: > Soeren Sonnenburg wrote: > > Hi all, > > > > Just having started with python, I feel that simple array operations '*' > > and '+' don't do multiplication/addition but instead extend/join an > > array: > > > > a=[1,2,3] > > >>> b=[4,5,6] > > >>>

Re: consistency: extending arrays vs. multiplication ?

2005-07-24 Thread Soeren Sonnenburg
On Sun, 2005-07-24 at 13:36 +1000, Steven D'Aprano wrote: > On Sat, 23 Jul 2005 18:30:02 +0200, Soeren Sonnenburg wrote: > > > Hi all, > > > > Just having started with python, I feel that simple array operations '*' > > and '+' don't do multiplication/addition but instead extend/join an > > array

Re: consistency: extending arrays vs. multiplication ?

2005-07-24 Thread Soeren Sonnenburg
On Sat, 2005-07-23 at 23:35 +0200, Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, Soeren > Sonnenburg wrote: > > > Just having started with python, I feel that simple array operations '*' > > and '+' don't do multiplication/addition but instead extend/join an > > array: > > > > a=[1,2,

Re: Getting a dictionary from an object

2005-07-24 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : > On Sun, 24 Jul 2005 12:07:02 +0300, Thanos Tsouanas wrote: >> >>>Thanos Tsouanas wrote: >>> (snip) >>I didn't know about it, but I knew about object.__dict__ which is, as I >>see equivalent with vars(object). But it doesn't do the job for me, >>since it fails to grab al

Re: [path-PEP] Path inherits from basestring again

2005-07-24 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Sat, 23 Jul 2005 17:51:31 -0600, John Roth wrote: > >> I also like to know the number of elements, which seems to make >> sense as len(path). Again, the number of characters in the path seems >> to be utterly useless information - at least, I can't

Re: tuple to string?

2005-07-24 Thread Steven D'Aprano
On Sun, 24 Jul 2005 10:39:44 -0700, Robert Kern wrote: > John Machin wrote: > >> No precedence rules -> no relevance to the topic > > Precedence rules of other languages -> no relevance to the topic I thought the topic was -- or at least had wandered in the direction of -- whether or not it wa

Re: PyGTK or wxPython (not a flame war) on Windows

2005-07-24 Thread Torsten Bronger
Hallöchen! Marek Kubica <[EMAIL PROTECTED]> writes: > Hello! > >> AFAIK PyGTK doesn't look native on Win as well, but I don't care. > > [...] The native look and feel is not as good as the look and feel > of wx but still really _much_ better than older versions of GTK. Is PyGTK more Pythonic by

Re: tuple to string?

2005-07-24 Thread Robert Kern
John Machin wrote: > No precedence rules -> no relevance to the topic Precedence rules of other languages -> no relevance to the topic -- Robert Kern [EMAIL PROTECTED] "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter -- http:/

Re: [path-PEP] Path inherits from basestring again

2005-07-24 Thread Peter Hansen
Reinhold Birkenfeld wrote: > Peter Hansen wrote: >> if mypath.splitpath()[0] == 'c:/temp': vs. >> if mypath.splitpath()[0] == Path('c:/temp'): > > But you must admit that that't the cleaner solution. "Cleaner"? Not at all. I'd say it's the more expressive solution, perhaps, but I definit

Re: tuple to string?

2005-07-24 Thread Steven D'Aprano
On Sun, 24 Jul 2005 21:55:19 +1000, John Machin wrote: >>>Look up the precedence rules? Are you aware of any language where * / >>>and % _don't_ have the same precedence?? >> >> >> Do languages like Pascal that don't have string formatting expressions, or >> use the % operator, count? > > A th

Importing User-defined Modules

2005-07-24 Thread Walter Brunswick
I need to import modules with user-defined file extensions that differ from '.py', and also (if possible) redirect the bytecode output of the file to a file of a user-defined extension. I've already read PEP 302 (http://www.python.org/peps/pep-0302.html), but I didn't fully understand it. Would

Re: tuple to string?

2005-07-24 Thread Francois De Serres
Robert Kern wrote: >Francois De Serres wrote: > > > >>I'll pick ('%c' * len(t)) % t, for it's readability and the fact that >>join() is on the deprec'd list. >> >> > >''.join() is certainly not deprecated. What made you think that? > > > this: http://www.python.org/doc/2.4.1/lib/node110.h

ANN: Veusz 0.7 - a scientific plotting package

2005-07-24 Thread Jeremy Sanders
Veusz 0.7 - Velvet Ember Under Sky Zenith - http://home.gna.org/veusz/ Veusz is a scientific plotting package written in Python (currently 100% Python). It uses PyQt for display and user-interfaces, and numarray for handling the numeric data. Veusz is designed

Re: Getting a dictionary from an object

2005-07-24 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : > On Sun, 24 Jul 2005 12:03:47 +0300, Thanos Tsouanas wrote: >> >>Please, tell me, how would you print it in my case? > > If I have understood you, you have some object like such: > > obj.foo = 1 > obj.bar = 2 > obj.spam = 'a' > obj.eggs = 'b' > > say. > > You want to

Re: tuple to string?

2005-07-24 Thread Robert Kern
Francois De Serres wrote: > I'll pick ('%c' * len(t)) % t, for it's readability and the fact that > join() is on the deprec'd list. ''.join() is certainly not deprecated. What made you think that? -- Robert Kern [EMAIL PROTECTED] "In the fields of hell where the grass grows high Are the gra

Re: FAQ?

2005-07-24 Thread tiissa
Michael Hoffman wrote: > Keith P. Boruff wrote: > >> Michael Hoffman wrote: >> >>> Keith P. Boruff wrote: >>> Is there an FAQ available specific to this NG as I'm sure some of the list slicing questions I have have been asked before. > > Therefore I asked a question on why you want a *

Re: [path-PEP] Path inherits from basestring again

2005-07-24 Thread Reinhold Birkenfeld
Michael Hoffman wrote: > Reinhold Birkenfeld wrote: > >> * __iter__() iterates over the parts(). >> * the following methods raise NotImplemented: >> capitalize, expandtabs, join, splitlines, title, zfill > > Why? They *are* implemented. I do not understand this desire to wantonly > break bases

Re: How to realize ssh & scp by Python

2005-07-24 Thread Jesse Noller
On 7/23/05, 刚 王 <[EMAIL PROTECTED]> wrote: > I would like to write a Python code like this: > > It can login a host by SSH > after login the host, use SCP to get a remote file, so it can deliver file > to the host. > then execute the program > then leave the host > > For example : > > STEP 1. ss

Re: PyGTK or wxPython (not a flame war) on Windows

2005-07-24 Thread Marek Kubica
Hello! > AFAIK PyGTK doesn't look native on Win as well, but I don't care. It does have a nearly-native look and feel: http://gtk-wimp.sourceforge.net/screenshots/ And yes, the theme adjusts itself to Windows XP themes, so GTK+ apps look nearly like any other Windows Program. The native look and f

Re: FAQ?

2005-07-24 Thread Michael Hoffman
Keith P. Boruff wrote: > Michael Hoffman wrote: >> Keith P. Boruff wrote: >>> Is there an FAQ available specific to this NG as I'm sure some of the >>> list slicing questions I have have been asked before. >> >> Try Google for . > > I tried and didn't find one. That's why I asked here. When I G

Re: "Aliasing" an object's __str__ to a different method

2005-07-24 Thread Jeffrey E. Forcier
On Jul 24, 2005, at 5:00 AM, Bengt Richter wrote: > Actually, it's not just the "magic" methods. [...] Thanks for the clarification/explanation =) > This looks a little strange because the repr of the bound method > includes a repr of the thing bound to, > which returns the Edit/View presentat

Re: How to realize ssh & scp in Python

2005-07-24 Thread Jeff Epler
Rather than doing anything with passwords, you should instead use public key authentication. This involves creating a keypair with ssh_keygen, putting the private key on the machine opening the ssh connection (~/.ssh/id_rsa), then listing the public key in the remote system's ~/.ssh/authorized_key

Re: FAQ?

2005-07-24 Thread rafi
Keith P. Boruff wrote: > Michael Hoffman wrote: > >> Keith P. Boruff wrote: >> >>> Is there an FAQ available specific to this NG as I'm sure some of the >>> list slicing questions I have have been asked before. >> >> Try Google for . > > I tried and didn't find one. That's why I asked here. su

Re: Getting a dictionary from an object

2005-07-24 Thread Steven D'Aprano
On Sun, 24 Jul 2005 12:07:02 +0300, Thanos Tsouanas wrote: > On Sat, Jul 23, 2005 at 06:59:43PM -0600, Steven Bethard wrote: >> Thanos Tsouanas wrote: >> > I would like to have a quick way to create dicts from object, so that a >> > call to foo['bar'] would return obj.bar. >> > >> > The following

Re: FAQ?

2005-07-24 Thread Keith P. Boruff
gene tani wrote: > Here's my trove of FAQ/Gotcha lists > > http://www.ferg.org/projects/python_gotchas.html > http://zephyrfalcon.org/labs/python_pitfalls.html > http://zephyrfalcon.org/labs/beginners_mistakes.html > > > http://www.onlamp.com/pub/a/python/2004/02/05/learn_python.html > http://ww

Re: FAQ?

2005-07-24 Thread gene tani
Here's my trove of FAQ/Gotcha lists http://www.ferg.org/projects/python_gotchas.html http://zephyrfalcon.org/labs/python_pitfalls.html http://zephyrfalcon.org/labs/beginners_mistakes.html http://www.onlamp.com/pub/a/python/2004/02/05/learn_python.html http://www.norvig.com/python-iaq.html http:/

Re: FAQ?

2005-07-24 Thread Keith P. Boruff
Michael Hoffman wrote: > Keith P. Boruff wrote: > >> Is there an FAQ available specific to this NG as I'm sure some of the >> list slicing questions I have have been asked before. > > > Try Google for . I tried and didn't find one. That's why I asked here. > I don't know why you would want t

Re: [path-PEP] Path inherits from basestring again

2005-07-24 Thread Ivan Van Laningham
Hi All-- Reinhold Birkenfeld wrote: > > Reinhold Birkenfeld wrote: > > Hi, > > > > the arguments in the previous thread were convincing enough, so I made the > > Path class inherit from str/unicode again. > Thanks. > * the following methods raise NotImplemented: > capitalize, expandtabs, joi

Re: Friend wants to learn python

2005-07-24 Thread TPJ
Why not start with Python's standard documentation? There are Python Tutorial and Library Reference. IMHO it's the best place to start. -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting a dictionary from an object

2005-07-24 Thread Steven D'Aprano
On Sun, 24 Jul 2005 12:03:47 +0300, Thanos Tsouanas wrote: > On Sun, Jul 24, 2005 at 01:43:43PM +1000, Steven D'Aprano wrote: >> On Sun, 24 Jul 2005 02:09:54 +0300, Thanos Tsouanas wrote: >> > >> > print foo %do >> > >> > where do is a dictobj object... >> >> Are you telling me that the ONLY th

Re: [path-PEP] Path inherits from basestring again

2005-07-24 Thread Michael Hoffman
Reinhold Birkenfeld wrote: > * __iter__() iterates over the parts(). > * the following methods raise NotImplemented: > capitalize, expandtabs, join, splitlines, title, zfill Why? They *are* implemented. I do not understand this desire to wantonly break basestring compatiblity for the sake of b

Re: PyGTK or wxPython (not a flame war) on Windows

2005-07-24 Thread TPJ
Thanks a lot! Now I know I can choose PyGTK. I really like it because of its rich documentation. > You could also bundle the runtime DLLs with your py2exe'd application That's great. I think my clients will appreciate a single one executable. -- http://mail.python.org/mailman/listinfo/python-l

Re: PyGTK or wxPython (not a flame war) on Windows

2005-07-24 Thread TPJ
> PyQt works equally well on both systems. I believe you. The problem is I don't like GPL. -- http://mail.python.org/mailman/listinfo/python-list

Re: FAQ?

2005-07-24 Thread Michael Hoffman
Keith P. Boruff wrote: > Is there an FAQ available specific to this NG as I'm sure some of the > list slicing questions I have have been asked before. Try Google for . I don't know why you would want to look in a FAQ *specific* to a newsgroup to look up slicing questions, since slicing has lit

Re: PyGTK or wxPython (not a flame war) on Windows

2005-07-24 Thread TPJ
> I've used pygtk with success on windows. (...) > > [will] I be able to make an executable (using Py2Exe) of an application > > that uses PyGTK? > > Yes. So PyGTK is now my favourite. Better documentation, runs on Linux and Windows, the possibility to make an executable program with Py2Exe. It's

Re: Getting a dictionary from an object

2005-07-24 Thread Thanos Tsouanas
On Sun, Jul 24, 2005 at 03:01:40PM +0200, Bruno Desthuilliers wrote: > I gave you a solution based on the Decorator pattern in another post, > but there is also the possibility to add a __getitem__ method directly > to the to-be-formatted object's class: > > def mygetitem(obj, name): >return

Re: [path-PEP] Path inherits from basestring again

2005-07-24 Thread Reinhold Birkenfeld
Reinhold Birkenfeld wrote: > Hi, > > the arguments in the previous thread were convincing enough, so I made the > Path class inherit from str/unicode again. Further changes by now: * subdirs() is now dirs(). * fixed compare behaviour for unicode base (unicode has no rich compare) * __iter__() it

Re: tuple to string?

2005-07-24 Thread John Machin
Francois De Serres wrote: > Francois De Serres wrote: > >> hiho, >> >> what's the clean way to translate the tuple (0x73, 0x70, 0x61, 0x6D) >> to the string 'spam'? >> >> TIA, >> Francois >> >> > thanks to all! > > I'll pick ('%c' * len(t)) % t, for it's readability and the fact that > join()

Re: [path-PEP] Path inherits from basestring again

2005-07-24 Thread Reinhold Birkenfeld
Peter Hansen wrote: > Reinhold Birkenfeld wrote: > [on comparing Paths and stings] >> Do you have a use case for the comparison? Paths should be compared only >> with other paths. > > I can think of lots, though I don't know that I've used any in my > existing (somewhat limited) code that uses Pa

  1   2   >