February Toronto Python User's Group meeting is tomorrow, 7PM at Linux Caffe

2006-02-27 Thread Mike C. Fletcher
I'll be doing a short presentation on my recent work on the StarPy Asterisk Protocols for Twisted. These protocols allow Python programmers to write Asterisk FastAGI and AMI customisation and management scripts in the same process as code running any other Twisted clients/servers. After that

New Module: CmdLoop - Base class for writing simple interactive command loop environments.

2006-02-27 Thread Crutcher Dunnavant
Code available here: http://littlelanguages.com/web/software/python/modules/cmdloop.py Base class for writing simple interactive command loop environments. CommandLoop provides a base class for writing simple interactive user environments. It is designed around sub-classing, has a simple

Re: Is Python a Zen language?

2006-02-27 Thread none
Cameron Laird wrote: In article [EMAIL PROTECTED], Kay Schluehr [EMAIL PROTECTED] wrote: . . . Lucid in the mid 80s that gone down a few years later. As it turned out that time Lisp was not capable to survive in what we call

Re: ls files -- list packer

2006-02-27 Thread kpp9c
nice! two little lines that do a boatload of work! hee hee pth = '/Users/kpp9c/snd/01' samples = [os.path.join(pth, f) for f in os.listdir(pth) if f.endswith('.aif')] thank you Kent! (and Jeremy and Magnus and Singletoned and I V ... and john boy and mary ellen .. ) --

Callback

2006-02-27 Thread Ramkumar Nagabhushanam
Hello All, I am writing an application in C/C++ (VC++ 6.0 compiler) within which I want to make calls using the python FTP client (ftplib). I want to call (for example) after the necessary iniialization has been done: PyObject *t = PyObject_CallMethod (_FTP, retrlines, , LIST, c_function);

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Paul Rubin
Steven D'Aprano [EMAIL PROTECTED] writes: Steven D'Aprano [EMAIL PROTECTED] writes: What is an empty enum? An empty enum is an enum with no identifiers, just like an empty list is a list with no elements. How and when would you use it? The best I can come up with is that an empty enum would

Re: Using repr() with escape sequences

2006-02-27 Thread nummertolv
myString = bar\foo\12foobar print repr(myString) My problem was that I wanted to know if there is a way of printing unraw strings like myString so that the escape characters are written like a backslash and a letter or number. My understanding was that repr() did this and it does in most cases

Re: cx_Oracle and UTF8

2006-02-27 Thread Harald Armin Massa
Gerhard, thanks, that import os os.environ[NLS_LANG] = German_Germany.UTF8 import cx_Oracle con = cx_Oracle.connect(me/[EMAIL PROTECTED]) really helped. At least now the query returns something encoded differently. I dared not to believe that there is no direct encoding change api without

Re: Modifying body of select message in a 'mbox' file.

2006-02-27 Thread Cowmix
Well.. I hate to reply to my own post.. but here is an update.. When I flatten a 'mbox' mail message and suck it into a 'email' mail message.. things look fine except that every MIME encoded section has a 'UNIX From' header added to the top of it and the From user is set to 'nobody'.. Does

Re: regular expresson for Unix and Dos Lineendings wanted

2006-02-27 Thread Franz Steinhaeusler
On 24 Feb 2006 14:12:05 + (GMT), Sion Arrowsmith [EMAIL PROTECTED] wrote: Franz Steinhaeusler [EMAIL PROTECTED] wrote: On Thu, 23 Feb 2006 13:54:50 +, Martin Franklin why not use string methods strip, rstrip and lstrip because this removes only the last spaces, [given r = 'erewr

Re: wxPython: help(wx) causes segfaulting?

2006-02-27 Thread Franz Steinhaeusler
On Sun, 26 Feb 2006 10:35:13 -0600, Tim Chase [EMAIL PROTECTED] wrote: Trying to get my feet wet with wxPython (moving from just command-line apps), I tried the obvious (or, at least to me was obvious): Start python, import wx and then do a help(wx) to see what it can tell me. I tried it on

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Felipe Almeida Lessa
Em Seg, 2006-02-27 às 00:43 -0800, Paul Rubin escreveu: def print_members(header, e): # print header, then members of enum e print header for m in e: print '\t', str(m) months_longer_than_february = enum('jan', 'mar', 'apr', ) # etc

Re: sort one list using the values from another list

2006-02-27 Thread Ron Adam
Ron Adam wrote: Alex Martelli wrote: Ron Adam [EMAIL PROTECTED] wrote: ... Considering the number time I sort keys after getting them, It's the behavior I would prefer. Maybe a more dependable dict.sortedkeys() method would be nice. ;-) sorted(d) is guaranteed to do exactly the same

how do I factor a number down to one digit?

2006-02-27 Thread Allan
I'm trying to write a numerology program where I have each letter identified by a numerical value like a=1 b=2 c=3 as so forth. I then input a name. How do I treat each letter as a single value? That is, instead of print myname I have to do a print m+y+n+a+m+e which returns a number. I next want

Re: Reading from socket file handle took too long

2006-02-27 Thread Ben Sizer
Etienne Desautels wrote: Everything works well but one thing. My problem is that running nextFrame() took, most of the time, more then 0,0414 sec. so my video is lagging. I monitor every call and I found that the culprit is when I read from the socket file handle. It's the only bottleneck in

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Paul Rubin
Felipe Almeida Lessa [EMAIL PROTECTED] writes: print_members('shorter:', months_shorter_than_february) print_members('longer:', months_longer_than_february) IMHO, you should be using sets, not enums. Something like: If enums aren't supposed to work in that construction then the PEP

Re: sort one list using the values from another list

2006-02-27 Thread Dolmans Sun
Kent Johnson wrote: [a for b,a in sorted(zip(B,A))] also, [a for _,a in sorted(zip(B,A))] didn't read refs, tested above python-2.2.3. -- Sun Yi Ming you can logout any time you like, but you can never leave... -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Felipe Almeida Lessa
Em Seg, 2006-02-27 às 02:42 -0800, Paul Rubin escreveu: Felipe Almeida Lessa [EMAIL PROTECTED] writes: IMHO, you should be using sets, not enums. Something like: If enums aren't supposed to work in that construction then the PEP shouldn't specify that they work that way. Sorry, but where

Re: how do I factor a number down to one digit?

2006-02-27 Thread bearophileHUGS
AllanI hope this isn't too stupid of a question. It's a simple problem, but it's not a stupid question, this is a possible solution: data = myname radix = str(sum(ord(c)-96 for c in data)) while len(radix) 1: radix = str(sum(int(c) for c in radix)) print The radix of:\n, data, \n\nIs:\n,

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Steven D'Aprano
On Mon, 27 Feb 2006 00:43:45 -0800, Paul Rubin wrote: Steven D'Aprano [EMAIL PROTECTED] writes: What is an empty enum? An empty enum is an enum with no identifiers, just like an empty list is a list with no elements. No, I don't think that is the case. A list is a container. You can take

Re: how do I factor a number down to one digit?

2006-02-27 Thread Steven D'Aprano
On Mon, 27 Feb 2006 02:31:42 -0800, Allan wrote: I'm trying to write a numerology program where I have each letter identified by a numerical value like a=1 b=2 c=3 as so forth. I then input a name. How do I treat each letter as a single value? That is, instead of print myname I have to do

minimize a program into an icon on the taskbar.

2006-02-27 Thread Rajesh Sathyamoorthy
Hi, I would know how to minimize a program (wxpython app) into an icon on the taskbar on windows (the one at the side near the clock, i can't remember what is it called.) Is it easy to be done? Is there a way to do the same thing on Linux? Thank You. --

Re: TypeError when subclassing 'list'

2006-02-27 Thread looping
Gerard Flanagan wrote: Hello all Could anyone shed any light on the following Exception? The code which caused it is below. Uncommenting the 'super' call in 'XmlNode' gives the same error. If I make XmlNode a subclass of 'object' rather than 'list' then the code will run. Thanks in

Re: TypeError when subclassing 'list'

2006-02-27 Thread Gerard Flanagan
Simon Percivall wrote: The error you're seeing is because you've rebound 'list' to something else. Try putting list = type([]) somewhere above your code. That's it! I had rebound 'list' earlier (in error), and though I deleted the code it must have been remembered somehow. Restarting

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Paul Rubin
Felipe Almeida Lessa [EMAIL PROTECTED] writes: If enums aren't supposed to work in that construction then the PEP shouldn't specify that they work that way. Sorry, but where do they say that? The PEP gives an example of iterating through the members of an enum. I'm not sure if that's what

Help getting started with Pycurl / libcurl ?

2006-02-27 Thread gjzusenet
Hi I just couldn't google up any docs or tutorial on how to set up everything necessary to use pycurl on windows. When I try running the pycurl setup I get a 'CURL_DIR' not found error, but no where can I find a detailed explanation of what is this dir, what dlls I need to install and where etc.

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Paul Rubin
Steven D'Aprano [EMAIL PROTECTED] writes: All of the machinery of the enum class created by Ben Finney is just to make sure that red, green and blue behave correctly, without extraneous string-like or number-like methods. Of course Ben could modify his code so that enum() returned an object.

Re: including directories with py2exe

2006-02-27 Thread Larry Bates
Mr BigSmoke wrote: Hi All how do i include directories into my project when using py2exe? I have a module that has it's images directory and when it's searches it (into ../dist/library.zip/.../mymodule/) it generates an error because the directory wasn't imported... tnx Fabio You may

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Antoon Pardon
Op 2006-02-27, Steven D'Aprano schreef [EMAIL PROTECTED]: Paul Rubin wrote: Ben Finney [EMAIL PROTECTED] writes: Enumerations with no values are meaningless. The exception ``EnumEmptyError`` is raised if the constructor is called with no value arguments. Why are empty enumerations not

making 'utf-8' default codec

2006-02-27 Thread Nikola Skoric
Hi there, Is there a way of making 'utf-8' default codec for the whole program, so I don't have to do .encode('utf-8') every time I print out a string? -- Now the storm has passed over me I'm left to drift on a dead calm sea And watch her forever through the cracks in the beams Nailed across

wxPython and Py2Exe... 2 questions

2006-02-27 Thread Durumdara
Hi ! I have an application that I compile to exe. 1.) I want to compile main.ico into exe, or int zip. Can I do it ? 2.) Can I compile the result to my specified directory, not into the dist ? I want to structure my projects like this: \src\ python codes, etc. \res\ icons, etc \bin\ the

Re: Hiding a column at the root of a plone site ...

2006-02-27 Thread bruno at modulix
Paul Ertz wrote: Hello, We would like to hide the left column for the main/home page of our plone sites dynamically using a tal: expression. Then please post on a Zope/Plone related mailing-list. -- bruno desthuilliers python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')])

Re: how do I factor a number down to one digit?

2006-02-27 Thread bearophileHUGS
Sounds like homework to me. Sorry Steven, you may be right, next time I'll be more careful. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: making 'utf-8' default codec

2006-02-27 Thread Jarek Zgoda
Nikola Skoric napisał(a): Is there a way of making 'utf-8' default codec for the whole program, so I don't have to do .encode('utf-8') every time I print out a string? Bad idea. You may accidentally break some libraries that depend on ASCII being default standard. -- Jarek Zgoda

Re: wxPython: help(wx) causes segfaulting?

2006-02-27 Thread André
Franz Steinhaeusler wrote: On Sun, 26 Feb 2006 10:35:13 -0600, Tim Chase [EMAIL PROTECTED] wrote: Trying to get my feet wet with wxPython (moving from just command-line apps), I tried the obvious (or, at least to me was obvious): Start python, import wx and then do a help(wx) to see

Py2Exe - how to set BDist (Build) directory ?

2006-02-27 Thread Durumdara
Hi ! I want to set the temp. build directory that it is does not placed in python source directory. I want to set this: \bin\ compiled version \src\ python source \tmp\ temp build dir How to I do it ? Thanx for help: dd -- http://mail.python.org/mailman/listinfo/python-list

How to do an 'inner join' with dictionaries

2006-02-27 Thread cyborg4
Let's say I have two dictionaries: dict1 is 1:23, 2:76, 4:56 dict2 is 23:A, 76:B, 56:C How do I get a dictionary that is 1:A, 2:B, 4:C -- http://mail.python.org/mailman/listinfo/python-list

Re: How to do an 'inner join' with dictionaries

2006-02-27 Thread Xavier Morel
[EMAIL PROTECTED] wrote: Let's say I have two dictionaries: dict1 is 1:23, 2:76, 4:56 dict2 is 23:A, 76:B, 56:C How do I get a dictionary that is 1:A, 2:B, 4:C dict1 = {1:23,2:76,4:56} dict2 = {23:'A',76:'B',56:'C'} dict((k, dict2[v]) for k, v in dict1.items()) {1: 'A', 2: 'B',

Re: How to do an 'inner join' with dictionaries

2006-02-27 Thread Kent Johnson
[EMAIL PROTECTED] wrote: Let's say I have two dictionaries: dict1 is 1:23, 2:76, 4:56 dict2 is 23:A, 76:B, 56:C How do I get a dictionary that is 1:A, 2:B, 4:C dict1 = {1:23, 2:76, 4:56} dict2 = {23:'A', 76:'B', 56:'C'} dict((key, dict2[value]) for key, value in

Re: How to do an 'inner join' with dictionaries

2006-02-27 Thread Tim Chase
Let's say I have two dictionaries: dict1 is 1:23, 2:76, 4:56 dict2 is 23:A, 76:B, 56:C How do I get a dictionary that is 1:A, 2:B, 4:C d1={1:23,2:76,4:56} d2={23:a, 76:b, 56:c} result = dict([(d1k,d2[d1v]) for (d1k, d1v) in d1.items()]) result {1: 'a', 2: 'b', 4: 'c'} If

Re: wxPython: help(wx) causes segfaulting?

2006-02-27 Thread Franz Steinhaeusler
On 27 Feb 2006 04:55:15 -0800, André [EMAIL PROTECTED] wrote: Franz Steinhaeusler wrote: On Sun, 26 Feb 2006 10:35:13 -0600, Tim Chase [EMAIL PROTECTED] wrote: Trying to get my feet wet with wxPython (moving from just command-line apps), I tried the obvious (or, at least to me was

Re: How to do an 'inner join' with dictionaries

2006-02-27 Thread Antoon Pardon
Op 2006-02-27, [EMAIL PROTECTED] schreef [EMAIL PROTECTED]: Let's say I have two dictionaries: dict1 is 1:23, 2:76, 4:56 dict2 is 23:A, 76:B, 56:C How do I get a dictionary that is 1:A, 2:B, 4:C Well how about the straight forward: dict3 = {} for key, value in dict1.iteritems():

Re: Python Indentation Problems

2006-02-27 Thread [EMAIL PROTECTED]
As far as i know, gedit is the weak link, this is because of the way it handles its whitespaces, had that trouble myself though not this *severe* -- http://mail.python.org/mailman/listinfo/python-list

Re: How to do an 'inner join' with dictionaries

2006-02-27 Thread Claudio Grondi
[EMAIL PROTECTED] wrote: Let's say I have two dictionaries: dict1 is 1:23, 2:76, 4:56 dict2 is 23:A, 76:B, 56:C How do I get a dictionary that is 1:A, 2:B, 4:C Just copy/paste the following source code to a file and run it: code sourceCodeToExecute = dict1 = { 1:23,2:76, 4:56

Re: Use of __slots__

2006-02-27 Thread Don Taylor
Steve Juranich wrote: I might be a little confused about a couple of things (I'm sure many will correct me if I'm not), but as I understand it the __slots__ attribute is a class-attribute, which means it cannot be modified by an instance of the class (think of a static class member, if you

Re: ImportError in Unpickle

2006-02-27 Thread [EMAIL PROTECTED]
It is indeed the problem. Thanks. May be, this fact could have been mentioned in the documentation. I have suggested the change using bug tracker. Raghu. -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Tim Chase
Uniqueness imposes an odd constraint that you can't have synonyms in the set: shades = enum({white:100, grey:50, gray:50, black:0}) Blast, I hate responding to my own posts, but as soon as I hit Send, I noticed the syntax here was biffed. Should have been something like shades =

Re: sort one list using the values from another list

2006-02-27 Thread Magnus Lycka
Dolmans Sun wrote: Kent Johnson wrote: [a for b,a in sorted(zip(B,A))] also, [a for _,a in sorted(zip(B,A))] didn't read refs, tested above python-2.2.3. Is there something here I can't see, or did you just change a variable name and present that as another solution? --

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

2006-02-27 Thread dananrg
How about DBdesigner4 or Dia as free ER diagrammers? [EMAIL PROTECTED] wrote: Thanks Olivier and Jonathan. Do either of you, or anyone else, know of a good open source data modeling / ER-diagram / CASE tools? I'd like to be able to build relatively simple schemas in one open source tool

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Roy Smith
In article [EMAIL PROTECTED], Steven D'Aprano [EMAIL PROTECTED] wrote: But if you have a good usage case for an empty enum, please feel free to tell us. I could see empty enums being useful in machine-generated code, perhaps when generating wrappers around C library APIs. There might be

Re: how do I factor a number down to one digit?

2006-02-27 Thread johnzenger
Your tools are: 1. map lets you apply a function to every element of a list. Strings are lists. (List comprehensions let you do the same thing, but map is better to use if you are turning in homework). 2. sum lets you calculate the sum of all numbers in a list. 3. val and str let you turn

Re: Use of __slots__

2006-02-27 Thread Alex Martelli
Don Taylor [EMAIL PROTECTED] wrote: ... Does Python have the notion of static class attributes? No. Just what was going on when I redefined my __slots__ attribute? Nothing. It looks as if __slots__ is something really special, or I am managing Yep: it acts at *class-creation time*, only

PEP 354 -- in operator?

2006-02-27 Thread Roy Smith
If I have an enum, how can I verify that it's a legal value? Can I do: Weekdays = enum('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat') def foo (day): if day not in Weekdays: raise ValueError Also, do enums have __dict__ slots? Can I do something like: day = 'sun' print

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Eric Nieuwland
On 27 feb 2006, at 10:13, Tim Chase wrote: Uniqueness imposes an odd constraint that you can't have synonyms in the set: shades = enum({white:100, grey:50, gray:50, black:0}) Blast, I hate responding to my own posts, but as soon as I hit Send, I noticed the syntax here was biffed. Should

Waiting for Connection

2006-02-27 Thread D
I am trying to do the following using Python and Tkinter: 1) Display a window with 1 button 2) When user clicks the button, Python attempts to call a function that opens a socket and listens for a connection - what I want to do is, if the socket has been successfully opened and the system is

Re: spaces at ends of filenames or directory names on Win32

2006-02-27 Thread rtilley
[EMAIL PROTECTED] wrote: Please post your Python code. I don't see the problem you're describing. OK, here's a copy. This works on Mac/Unix/Linux yet has no effect on Windows: - import os import os.path for root, dirs, files

Re: spaces at ends of filenames or directory names on Win32

2006-02-27 Thread rtilley
[EMAIL PROTECTED] wrote: Please post your Python code. I don't see the problem you're describing. OK, here's a copy. This works on Mac/Unix/Linux yet has no effect on Windows: - import os import os.path for root, dirs, files

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Dan Sommers
On Mon, 27 Feb 2006 03:13:08 -0600, Tim Chase [EMAIL PROTECTED] wrote: Same could go for days of the week: dow=enum((sunday, 0), (monday, 1), (start_of_work_week, 1), ... (friday, 5), (end_of_work_week, 5)...) Not really: In some parts of the world, calendar weeks begin on Monday and end

Re: Using ElementTree to tidy up an XML string to my liking

2006-02-27 Thread Magnus Lycka
Richard Townsend wrote: On Fri, 24 Feb 2006 18:21:59 +0100, Magnus Lycka wrote: Concerning element names, it's your coice of course, but I agree more and more with Guido and PEP008 that camelCase is ugly. (Not that ALLCAPS is better...) I can see in PEP008 where it says

Re: making 'utf-8' default codec

2006-02-27 Thread Scott David Daniels
Nikola Skoric wrote: Is there a way of making 'utf-8' default codec for the whole program, so I don't have to do .encode('utf-8') every time I print out a string? Explicit is better than implicit (so setting up a default codec is considered bad practice). However, you could wrap an output

Re: Use of __slots__

2006-02-27 Thread Don Taylor
Alex Martelli wrote: meant for extremely RARE use, and only by very advanced programmers who fully know what they're doing Yea, from the table of my memory I ’ll wipe away all trivial fond records of __slots__ (Bet you wish Mark Lutz had not mentioned it in Learning Python ...) Don. --

Re: Waiting for Connection

2006-02-27 Thread Kent Johnson
D wrote: I am trying to do the following using Python and Tkinter: 1) Display a window with 1 button 2) When user clicks the button, Python attempts to call a function that opens a socket and listens for a connection - what I want to do is, if the socket has been successfully opened and

Re: ls files -- list packer

2006-02-27 Thread Scott David Daniels
kpp9c wrote: Thank you... i was looking in the wrong place cause all i found was this relatively useless doc: http://docs.python.org/lib/module-os.html which says almost nothing. In one of its subsections, cleverly named Files and Directories, I see a nice description of listdir.

Firebird and Python

2006-02-27 Thread Magnus Lycka
Jarek Zgoda wrote: They just hired Jim Starkey. Perhaps MySQL AB hopes he will write a transactional engine for MySQL, as he previously wrote one for Interbase (which is known to be one of the best a man could imagine). Anyway, we got far off topic, so we better go somewhere else. Ok, to

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-27 Thread Magnus Lycka
Peter Hansen wrote: Magnus Lycka wrote: With an operating system such as Windows, this is probably something you can expect to happen, although I'm surprised if such long lag times as 200 s are typical. No way. I mean, I'm the biggest critic of Windows operating systems when used in

Re: Unicode and MoinMoin

2006-02-27 Thread Fredrik Lundh
Neil Hodgson wrote: The only issue I'm having relates to Unicode. MoinMoin and python are pretty unforgiving about files that contain Unicode characters that aren't included in the coding properly. I've spent hours reading about Unicode, and playing with different encoding/decoding

''.join() with encoded strings

2006-02-27 Thread Sandra-24
I'd love to know why calling ''.join() on a list of encoded strings automatically results in converting to the default encoding. First of all, it's undocumented, so If I didn't have non-ascii characters in my utf-8 data, I'd never have known until one day I did, and then the code would break.

Re: unicode question

2006-02-27 Thread Walter Dörwald
Edward Loper wrote: [...] Surely there's a better way than converting back and forth 3 times? Is there a reason that the 'backslashreplace' error mode can't be used with codecs.decode? 'abc \xff\xe8 def'.decode('ascii', 'backslashreplace') Traceback (most recent call last): File

Re: making 'utf-8' default codec

2006-02-27 Thread Jorge Godoy
Jarek Zgoda [EMAIL PROTECTED] writes: Bad idea. You may accidentally break some libraries that depend on ASCII being default standard. And what would those produce as output when fed with unicode data? How would they handle this input? IMVHO nothing should rely on having a standard charset

Re: ''.join() with encoded strings

2006-02-27 Thread Diez B. Roggisch
Sandra-24 wrote: I'd love to know why calling ''.join() on a list of encoded strings automatically results in converting to the default encoding. First of all, it's undocumented, so If I didn't have non-ascii characters in my utf-8 data, I'd never have known until one day I did, and then the

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-27 Thread Magnus Lycka
Claudio Grondi wrote: I mean, that using time.clock() solves the problem, because the output of the following code: On Windows that it. At least on Linux and Solaris, time.clock() returns CPU time. If time.clock() returns significantly different values before and after time.sleep(1), there's

different ways to strip strings

2006-02-27 Thread rtilley
s = ' qazwsx ' # How are these different? print s.strip() print str.strip(s) Do string objects all have the attribute strip()? If so, why is str.strip() needed? Really, I'm just curious... there's a lot don't fully understand :) -- http://mail.python.org/mailman/listinfo/python-list

Re: different ways to strip strings

2006-02-27 Thread Crutcher
It is something of a navel (left over feature). xyz.strip() is (I think) newer than string.strip() -- http://mail.python.org/mailman/listinfo/python-list

Re: different ways to strip strings

2006-02-27 Thread Crutcher
It is something of a navel (left over feature). xyz.strip() is (I think) newer than string.strip() -- http://mail.python.org/mailman/listinfo/python-list

Re: problem(s) with import from parent dir: from ../brave.py import sir_robin

2006-02-27 Thread Magnus Lycka
per9000 wrote: ...and there was much rejoicing... Even better, thanks - you guys are the best. import string, time, sys sys.path.append(../../py_scripts) Works just nice, and yes, I removed the env.variable before I tried it :-D The *right* thing to do might be to install the python

Re: sort one list using the values from another list

2006-02-27 Thread Scott David Daniels
Ron Adam wrote: Ron Adam wrote: Alex Martelli wrote: Ron Adam [EMAIL PROTECTED] wrote: ... Considering the number time I sort keys after getting them, It's the behavior I would prefer. Maybe a more dependable dict.sortedkeys() method would be nice. ;-) sorted(d) is guaranteed to do

converting binary data

2006-02-27 Thread piotr maliński
I have a game file described here: http://iesdp.gibberlings3.net/ieformats/itm_v1.htm and I'm trying to read all the data: plik = open('bow08.itm', 'rb') try: tekst = plik.read() finally: plik.close() # char array - works print tekst[0x0004:0x0004+4] #

Re: Waiting for Connection

2006-02-27 Thread D
Thanks Kent! update_idletasks() does exactly what I needed, which as you mentioned was just to give it enough time to reconfigure the button. Doug -- http://mail.python.org/mailman/listinfo/python-list

Re: different ways to strip strings

2006-02-27 Thread Kent Johnson
rtilley wrote: s = ' qazwsx ' # How are these different? print s.strip() print str.strip(s) They are equivalent ways of calling the same method of a str object. Do string objects all have the attribute strip()? If so, why is str.strip() needed? Really, I'm just curious... there's a lot

Re: different ways to strip strings

2006-02-27 Thread Kent Johnson
Crutcher wrote: It is something of a navel (left over feature). xyz.strip() is (I think) newer than string.strip() Yes, but the question as written was about str.strip() which is an unbound method of the str class, not string.strip() which is a deprecated function in the string module. Kent

Re: making 'utf-8' default codec

2006-02-27 Thread Jarek Zgoda
Jorge Godoy napisał(a): Bad idea. You may accidentally break some libraries that depend on ASCII being default standard. And what would those produce as output when fed with unicode data? How would they handle this input? IMVHO nothing should rely on having a standard charset as input.

Re: PEP 354: Enumerations in Python

2006-02-27 Thread Terry Reedy
Steven D'Aprano [EMAIL PROTECTED] wrote A list of X is like a box containing X, and in another post A list is a container. I think it is misleading, if not wrong, to refer to Python collections as 'containers', 'boxes', or similar. A object in a box cannot be in another disjoint box. A

Re: How many web framework for python ?

2006-02-27 Thread robin
Steve Holden [EMAIL PROTECTED] wrote: Damn. More reading ... Even more reading as of tomorrow, when I get my Web Application Framework article up on my blog. Even listing the vast number of frameworks toolkits out there is daunting, so I figured I may as well share my own outlook. And FWIW, I

type = instance instead of dict

2006-02-27 Thread Cruella DeVille
I'm trying to implement a bookmark-url program, which accepts user input and puts the strings in a dictionary. Somehow I'm not able to iterate myDictionary of type Dict{} When I write print type(myDictionary) I get that the type is instance, which makes no sense to me. What does that mean? Thanks

newbie : econometrics in python

2006-02-27 Thread MARK LEEDS
i've used python in the pastbut only for data processing, writing to files, midifying files, reading from files. now, my boss wants me to do some econometrics using python. would anyone who has done this ( var, vecm, cointegration, ols, kalman filter whatever) mind sending me some sample

Re: different ways to strip strings

2006-02-27 Thread rtilley
Kent Johnson wrote: So... s.strip() gets a bound method object from the class and calls it with no additional argument. str.strip(s) gets an unbound method object from the class and calls it, passing a class instance as the first argument. Kent Thank you Kent. That's a very informative

Re: new wooden door step - fixing and finishing

2006-02-27 Thread robin
Jeffrey Schwab [EMAIL PROTECTED] wrote: I was wondering about treating it wilth liberal amounts of Teak Oil or similar... Some people, when confronted with a problem, think I know, I?ll use Teak Oil. Now they have two problems. +1 QOTW BTW, I integrated a similar line into one of my

PDB on a large threaded application (QMTest)

2006-02-27 Thread [EMAIL PROTECTED]
Hi, I'm trying to debug QMTest from Code Sourcery with PDB from inside Emacs. My problem is that without PDB, I have no problem, but when I'm using PDB, I get exceptions thrown. Has anyone else tried using PDB on QMTest? My python is 2.2, and QMTest is 2.0.3. Thanks / Claes --

Re: Use of __slots__

2006-02-27 Thread MrJean1
An example of the RARE use case may be this particular one http://mail.python.org/pipermail/python-list/2004-May/220513.html /Jean Brouwers -- http://mail.python.org/mailman/listinfo/python-list

Re: type = instance instead of dict

2006-02-27 Thread Kent Johnson
Cruella DeVille wrote: I'm trying to implement a bookmark-url program, which accepts user input and puts the strings in a dictionary. Somehow I'm not able to iterate myDictionary of type Dict{} When I write print type(myDictionary) I get that the type is instance, which makes no sense to

newbie

2006-02-27 Thread Brain Murphy
I have some questions, 1) I am trying to have multiple def's but it is not working. for instance, i am using the tutoreals and am trying to combine the phone book as well as the grades..ect so that it would look somthing like this:def print_options(): print "options:" print " 'p' print

Re: type = instance instead of dict

2006-02-27 Thread Cruella DeVille
So what you are saying is that my class Dict is a subclass of Dict, and user defined dicts does not support iteration? What I'm doing is that I want to write the content of a dictionary to a file, and send the dictionary (favDict) as a parameter like this: favDict = Dict() -- my own class (or

Re: spaces at ends of filenames or directory names on Win32

2006-02-27 Thread rtilley
This will at least allow me to ID folders that start with whitespace... from within Windows too :) yet I still cannot rename the folders after stripping the whitespace... attempting to gives an [Errno 2] No such file or directory. The strip seems to work right too according to the prints

expat

2006-02-27 Thread Katja Suess
Hi, may I have a hint what the problem is in my situation? Is it a syntax error in sweetone.odt or in xml.parsers.expat? Same problem with different file instead of sweetone.odt means that it's not the file that has a syntax error. xml.parsers.expat is a standard module that probably has no

Matplotlib logarithmic scatter plot

2006-02-27 Thread Derek Basch
Can anyone give any suggestions on how to make a logarithmic (base 10) x and y axis (loglog) plot in matplotlib? The scatter function doesn't seem to have any log functionality built into it. Thanks, Derek Basch P.S. I suck at math so feel free to make me feel stupid if it is really easy to do

Re: expat

2006-02-27 Thread Fredrik Lundh
Katja Suess wrote: may I have a hint what the problem is in my situation? Is it a syntax error in sweetone.odt or in xml.parsers.expat? xml.parsers.expat.ExpatError: syntax error: line 1, column 0 it's a problem with the file you're parsing (either because it's not a valid XML file, or

Re: expat

2006-02-27 Thread Jarek Zgoda
Katja Suess napisał(a): may I have a hint what the problem is in my situation? Is it a syntax error in sweetone.odt or in xml.parsers.expat? Same problem with different file instead of sweetone.odt means that it's not the file that has a syntax error. xml.parsers.expat is a standard module

Re: Matplotlib logarithmic scatter plot

2006-02-27 Thread Bas
Try this, don't know if this works for al versions: from pylab import * x=10**linspace(0,5,100) y=1/(1+x/1000) loglog(x,y) show() If you only need a logarithm along one axis you can use semilogx() or semilogy(). For more detailed questions go to the matplotlib mailing list. Cheers, Bas --

Re: Kill forked processes

2006-02-27 Thread kmkz
I didn't mean that you'd have to write it for me, I meant that if what you said works (atexit, signal) I will paypal you $10 for your generous contribution to my project. -- http://mail.python.org/mailman/listinfo/python-list

Re: type = instance instead of dict

2006-02-27 Thread Kent Johnson
Cruella DeVille wrote: So what you are saying is that my class Dict is a subclass of Dict, and user defined dicts does not support iteration? I don't know what your class Dict is, I was guessing. The built-in is dict, not Dict. What I'm doing is that I want to write the content of a

  1   2   >