Re: Possible constant assignment operators ":=" and "::=" for Python

2006-05-04 Thread Fredrik Lundh
Christophe wrote: > That's easy, since A is a symbolic constant know at compile time, and > since it's a known mutable objet, the code once compiled will be > equivalent to: > > >>> b = [[]] > > >>> # much later > >>> b|0].append('1') the OP talked about constants as names for immutable object

Re: Possibly dumb question about dicts and __hash__()

2006-05-04 Thread Joel Hedlund
Hi! > Just the hash is not enough. You need to define equality, too: Thanks a million for clearing that up. Cheers! /Joel -- http://mail.python.org/mailman/listinfo/python-list

Re: stripping unwanted chars from string

2006-05-04 Thread bruno at modulix
Edward Elliott wrote: > Bryan wrote: > >> >>> keepchars = set(string.letters + string.digits + '-.') > > > Now that looks a lot better. Just don't forget the underscore. :) > You may also want to have a look at string.translate() and string.maketrans() -- bruno desthuilliers python -c "print

Re: This coding style bad practise?

2006-05-04 Thread bruno at modulix
Carl Friedrich Bolz wrote: > Bruno Desthuilliers wrote: > >> Martin P. Hellwig a écrit : >> >>> I created a class which creates a relative unique id string, now my >>> program just works fine and as expected but somehow I get the feeling >>> that I misused the __repr__ since I guess people expect

Re: This coding style bad practise?

2006-05-04 Thread bruno at modulix
Martin P. Hellwig wrote: > Bruno Desthuilliers wrote: > > >> >> Why not just use the call operator instead ? ie: >> >> >>> id = IDGenerator(...) >> >>> id() >> 01_20060424_151903_1 >> >>> id() >> 01_20060424_151905_2 >> > > Because of: > > id = IDGenerator("01",99) > id() >> >> Trace

Re: pythonic way to sort

2006-05-04 Thread Boris Borcic
Jay Parlar wrote: > > On May 4, 2006, at 12:12 AM, [EMAIL PROTECTED] wrote: > [...] > Assume that you have the lines in a list called 'lines', > as follows: > > lines = [ >"1SOME STRING ~ABC~12311232432D~20060401~", >"3SOME STRING ~ACD~14353453554G~20060401~",

Re: noob question: "TypeError" wrong number of args

2006-05-04 Thread bruno at modulix
Ben Finney wrote: > Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > > >>Ben Finney a écrit : >> >>>So now you're proposing that this be a special case when a >>>function is declared by that particular syntax, and it should be >>>different to when a function is created outside the class >>>defin

Displaying Images and getting input from Mouse

2006-05-04 Thread Wynand Singels
Hi there everyone I'm trying to figure out the best (and fastest way) to display a JPEG image and then input several (x,y) coordinate pairs from mouse clicks on the image. I figured out how to do this in pylab using matplotlib as follows: img = 256 - S.misc.pilutil.imread('pic1.jpg')

Re: Because of multithreading semantics, this is not reliable.

2006-05-04 Thread Christophe
[EMAIL PROTECTED] a écrit : > Tim and Grant > > > if q.empty(): > return > > > Of course you explanation is understood and ideally should be included > as a note in the Python documentation. And the "not reliable" should > be removed from the documentation! > > Anyway, many than

Re: noob question: "TypeError" wrong number of args

2006-05-04 Thread bruno at modulix
Edward Elliott wrote: > Ben Finney wrote: > >>As I understand it, the point was not what the code does, but to give >>a sample input (a Python program) for the "simple text processor" you >>described to wade through. > > > Ah, well then, there's no need for a full-blown parser. It should suffic

Re: Possible constant assignment operators ":=" and "::=" for Python

2006-05-04 Thread Christophe
Fredrik Lundh a écrit : > Christophe wrote: > > >>That's easy, since A is a symbolic constant know at compile time, and >>since it's a known mutable objet, the code once compiled will be >>equivalent to: >> >> >>> b = [[]] >> >> >>> # much later >> >>> b|0].append('1') > > > the OP talked about

Re: Customize IE to make a toolbar visible

2006-05-04 Thread Roger Upole
This does the trick for Google toolbar: import win32com.client ie=win32com.client.Dispatch('internetexplorer.application') ie.Visible=1 ie.ShowBrowserBar('{2318C2B1-4965-11d4-9B18-009027A5CD4F}',True,0) You should be able to just substitute the GUID for the Yahoo toolbar. Roger <[EMAIL P

Re: Dispatching operations to user-defined methods

2006-05-04 Thread Michele Simionato
Apparently Guido fell in love with generic functions, so (possibly) in future Python versions you will be able to solve dispatching problems in in an industrial strenght way. Sometimes however the simplest possible way is enough, and you can use something like this : class SimpleDispatcher(object

Fw: Swaying A Coder Away From Python

2006-05-04 Thread Tim Williams
- Original Message - From: DevWebProUK [EMAIL PROTECTED] To: Sent: Wednesday, May 03, 2006 10:14 PM Subject: Swaying A Coder Away From Python Swaying A Coder Away From Python By David A. Utter One programmer blogged about the powerful attraction he is feeling to C# programming, and

Re: Possible constant assignment operators ":=" and "::=" for Python

2006-05-04 Thread Michele Simionato
Edward Elliott wrote: > Michele Simionato wrote: > > Python solution is to rely on the intelligence of programmers. If they > > see an all caps name and then they try to change it without knowing what > > they are doing, then they are stupid. If you have stupid programmers there > > is no way the l

Re: stripping unwanted chars from string

2006-05-04 Thread John Machin
On 4/05/2006 4:30 PM, Edward Elliott wrote: > Bryan wrote: >> >>> keepchars = set(string.letters + string.digits + '-.') > > Now that looks a lot better. Just don't forget the underscore. :) > *Looks* better than the monkey business. Perhaps I should point out to those of the studio audience

Re: scope of variables

2006-05-04 Thread Gary Wessle
Ryan Forsythe <[EMAIL PROTECTED]> writes: > Gary Wessle wrote: > > the example was an in-accuretlly representation of a the problem I am > > having. my apologies. > > > > a = [] > > def prnt(): > >print len(a) > > > prnt > > > > > > I expect to get 0 "the length of list a" > > You wa

Re: scope of variables

2006-05-04 Thread bruno at modulix
Gary Wessle wrote: > Ryan Forsythe <[EMAIL PROTECTED]> writes: > > >>Gary Wessle wrote: >> >>>the example was an in-accuretlly representation of a the problem I am >>>having. my apologies. >>> (snip) > I finally was able to duplicate the error with a through away code > as follows, > >

Usage of single click or double click in Tix programming

2006-05-04 Thread praveenkumar . 117
Dear all, I am developing an GUI application using Tix I want to trigger a window on single or double click on a name displayed in the GUI. How to go about using Python your help is very much appreciated regards praveen -- http://mail.python.org/mailman/listinfo/python

Problem building extension under Cygwin (ImportError: Bad address)

2006-05-04 Thread Lars
Hi, I have problems building a simple handcoded C-extension (hello.c) with Cygwin and gcc3.4.4. I hope somebody has encountered the same problem before, and has some advice. The extension works just fine with Linux: gcc -c hello.c -I/usr/local/include/python2.4/ ld -shared hello.o -o hello.so -L

Re: This coding style bad practise?

2006-05-04 Thread Martin P. Hellwig
bruno at modulix wrote: > Martin P. Hellwig wrote: >> Bruno Desthuilliers wrote: >> >> >>> Why not just use the call operator instead ? ie: >>> >>> >>> id = IDGenerator(...) >>> >>> id() >>> 01_20060424_151903_1 >>> >>> id() >>> 01_20060424_151905_2 >>> >> Because of: >> >> id = IDGenerator

Re: Swaying A Coder Away From Python

2006-05-04 Thread Fredrik Lundh
Tim Williams wrote: > By David A. Utter who's this, and why does he think that sampling some random comments by some random bloggers should mean anything to anyone ? (and why do you seem to think that this matters, btw ?) (and yes, I recognize the names of some of the bloggers he quotes. they'

Re: ZSI usage

2006-05-04 Thread Maxim Sloyko
There is a typo there in functions name. It is called "session_open" not "open_session", but everything else is as described -- http://mail.python.org/mailman/listinfo/python-list

pleac

2006-05-04 Thread jonas
Hi, I'm new to python. After a search on http://pleac.sourceforge.net/pleac_python/index.html why python have a low %? Thanks in advance -- http://mail.python.org/mailman/listinfo/python-list

Re: Zope Guru...

2006-05-04 Thread Nico Grubert
> In doing some research into Workflow apps regarding document > management, I came across Zope. Given that it's Python Based, I > figured I'd shout to the group here... If you want to develop an application with Zope+Python from scratch, there are a few Zope products out there that handle wor

Re: pleac

2006-05-04 Thread Fredrik Lundh
"jonas" wrote: > After a search on > http://pleac.sourceforge.net/pleac_python/index.html > why python have a low %? why not ask the pleac maintainers? (it might be that pythoneers have better things to do with their time than translating old Perl stuff to Python... if you want Python cook- boo

ZSI usage

2006-05-04 Thread Maxim Sloyko
Hi all! I'm trying to make a simple SOAP call from python to SOAP::Lite (perl) SOAP server. My SOAP server has https://myserv.com/open-api URI, the function open_session has the "QW/API" namespace. SO I do the following: from ZSI.client import Binding fp = open('debug.out', 'a') client = Binding

Pythoncard question

2006-05-04 Thread DarkBlue
I am trying to port a Delphi database application to python on linux with a firebird database backend and I am using pythoncard to recreate the gui. I will have about 25 delphi forms to be recreated and I would like to know what is the best way to call them up from within each other . There is a m

RegEx with multiple occurrences

2006-05-04 Thread Mike
Hi again. I'm trying to strip all script blocks from HTML, and am using the following re to do it: p = re.compile("(\*\)",re.IGNORECASE | re.DOTALL) m = p.search(data) The problem is that I'm getting everything from the 1st script's start tag to the last script's end tag in one group - so it see

about the implement of the PyString_InternFromString

2006-05-04 Thread kyo guan
Hi : Hi guys: I have a question about the this API. PyObject * PyString_InternFromString(const char *cp) { PyObject *s = PyString_FromString(cp); if (s == NULL) return NULL; PyString_InternInPlace(&s); return s; } Why it always try to cal

about the implement of the PyString_InternFromString

2006-05-04 Thread Kyo Guan
Hi guys: I have a question about the this API. PyObject * PyString_InternFromString(const char *cp) { PyObject *s = PyString_FromString(cp); if (s == NULL) return NULL; PyString_InternInPlace(&s); return s; } Why it always try to call PyS

Re: RegEx with multiple occurrences

2006-05-04 Thread Tim Chase
> p = re.compile("(\*\)",re.IGNORECASE | re.DOTALL) > m = p.search(data) First, I presume you didn't copy & paste your expression, as it looks like you're missing a period before the second asterisk. Otherwise, all you'd get is any number of greater-than signs followed by a closing "" tag. Se

__getattr__ for global namespace?

2006-05-04 Thread Harold Fellermann
Hi, I am writing an application that initializes the global namespace, and afterwards, leaves the user with the python prompt. Now, I want to catch NameErrors in user input like e.g. >>> some_name Traceback (most recent call last): File "", line 1, in ? NameError: name 'some_name' is not define

Re: about the implement of the PyString_InternFromString

2006-05-04 Thread Heiko Wundram
Am Donnerstag 04 Mai 2006 13:44 schrieb Kyo Guan: > Hi guys: > > I have a question about the this API. > > PyObject * > PyString_InternFromString(const char *cp) > { > PyObject *s = PyString_FromString(cp); > if (s == NULL) > return NULL; > PyString_InternInPla

Re: Swaying A Coder Away From Python

2006-05-04 Thread Tim Williams
> (and why do you > seem to think that this matters, btw ?) I actually think it is complete twaddle, for the same reasons as you. It was forwarded to me by someone who knows I use Python, and I thought it might be of interest to a balanced list, especially as it shows an external perspectiv

Python function returns:

2006-05-04 Thread Michael Yanowitz
I am still new to Python but have used it for the last 2+ months. One thing I'm still not used to is that functions parameters can't change as expected. For example in C, I can have status = get_network_info (strIpAddress, &strHostname, &nPortNumber) where this fictitious function returns a st

Re: Mod_python.publisher behavior - sending .py file tobrowser not processing it in pyton

2006-05-04 Thread Daniel Nogradi
> > As Graham pointed out SetHandler and AddHandler should not be used at > > the same time. "SetHandler mod_python" causes all files to be served > > by mod_python and when you refer to them in your browser you don't > > need to specify any extension such as .py and "AddHandler mod_python > > .py"

Re: pleac

2006-05-04 Thread jonas
Thanks Fredrik, i'm going to buy the book. After all, there's nothing about the Python language power! thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: RegEx with multiple occurrences

2006-05-04 Thread Mike
Tim - you're a legend. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: RegEx with multiple occurrences

2006-05-04 Thread Tim Chase
> Tim - you're a legend. Thanks. A leg-end? I always knew something was a-foot. Sorry to make myself the butt of such joking. :) My pleasure...glad it seems to be working for you. -tkc (not much of a legend at all...just a regexp wonk) -- http://mail.python.org/mailman/listinfo/python-

Re: Pythoncard question

2006-05-04 Thread bryan rasmussen
Hi, I'm doing a sort of symbolic linking app in Windows for my own enjoyment, and figured I would do it in python for the same reason + learning the language. The following functions could obviously do with some refactoring. One obvious thing would be to make wordsetter and wordsforfolder more gen

refactoring question

2006-05-04 Thread bryan rasmussen
Hi, I'm doing a sort of symbolic linking app in Windows for my own enjoyment, and figured I would do it in python for the same reason + learning the language. The following functions could obviously do with some refactoring. One obvious thing would be to make wordsetter and wordsforfolder more gen

Re: Pythoncard question

2006-05-04 Thread bryan rasmussen
oops, sorry about that. I copied the message over in gmail but forgot to change the subject. Sorry, Bryan Rasmussen -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem building extension under Cygwin (ImportError: Bad address)

2006-05-04 Thread Jason Tishler
Lars, On Thu, May 04, 2006 at 03:50:13AM -0700, Lars wrote: > I have problems building a simple handcoded C-extension (hello.c) with > Cygwin and gcc3.4.4. I hope somebody has encountered the same problem > before, and has some advice. > > [snip] The following works for me: $ gcc -shared -I

Re: Swaying A Coder Away From Python

2006-05-04 Thread Fredrik Lundh
Tim Williams wrote: > It was forwarded to me by someone who knows I use Python, and I > thought it might be of interest to a balanced list, especially as it > shows an external perspective of Python. Are we not allowed to post > negative things about Python anymore /.../ nope, but if we were

Re: Because of multithreading semantics, this is not reliable.

2006-05-04 Thread Olaf Meding
> return result before that line, some other thread added a value ! Sure, but that is the nature of using threads and a mutex. I hope you are you not saying that every function that uses a mutex should have a comment saying this is not "reliable"? Olaf -- http://mail.python.org/mailman/list

Re: Swaying A Coder Away From Python

2006-05-04 Thread BartlebyScrivener
I'm picking this up via clp on Google Groups. I can't tell what Mr. Lundh is referring to. The first line of his post is: "Tim Williams wrote" but there's nothing that comes before. I had seen the article on Django on Digg I think, but what is article Tim Williams is referring to? Thanks, rick -

HTMLParseError: EOF in middle of construct error

2006-05-04 Thread Mike
Me again. I'm getting this error when parsing an external URL - I understand that a common cause of this is badly formed HTML (or XHTML) and that's fair enough, but is there any way to turn the parser into forgiving mode? As I'm getting this error from documents over which I have no control, I ne

Re: about the implement of the PyString_InternFromString

2006-05-04 Thread Fredrik Lundh
Kyo Guan wrote: > I have a question about the this API. > > PyObject * > PyString_InternFromString(const char *cp) > { > PyObject *s = PyString_FromString(cp); > if (s == NULL) > return NULL; > PyString_InternInPlace(&s); > return s; > } > > > Why it always try to call PyString_FromString first?

Re: HTMLParseError: EOF in middle of construct error

2006-05-04 Thread Diez B. Roggisch
Mike wrote: > Me again. > > I'm getting this error when parsing an external URL - I understand that > a common cause of this is badly formed HTML (or XHTML) and that's fair > enough, but is there any way to turn the parser into forgiving mode? > > As I'm getting this error from documents over wh

Re: Python function returns:

2006-05-04 Thread Diez B. Roggisch
Michael Yanowitz wrote: > I am still new to Python but have used it for the last 2+ months. > One thing I'm still not used to is that functions parameters can't > change as expected. For example in C, I can have > status = get_network_info (strIpAddress, &strHostname, &nPortNumber) > where th

Multiple Version Install?

2006-05-04 Thread David C.Ullrich
Would there be issues (registry settings, environment variables, whatever) if a person tried to install versions 1.x and 2.x simultaneously on one Windows system? Windows 98, if it matters. (I can handle the file associations with no problem.) Thanks. ** If anyone feels

Re: Python function returns:

2006-05-04 Thread Duncan Booth
Michael Yanowitz wrote: > In Python, there does not seem to be an easy way to have functions > return > multiple values except it can return a list such as: > strHostname, nPortNumber, status = get_network_info (strIpAddress, > strHostname, >

Re: Gettings subdirectories

2006-05-04 Thread Philippe Martin
Hi, The second edition of "Programming Python - O'REILLY - Mark Lutz" shows how to do that using "os.path.walk" Philippe Florian Lindner wrote: > Hello, > how can I get all subdirectories of a given directories? os.listdir() > gives me all entries and I've found no way to tell if an object

Re: Python function returns:

2006-05-04 Thread Tim Chase
> In Python, there does not seem to be an easy way to have > functions return multiple values except it can return a > list such as: strHostname, nPortNumber, status = > get_network_info (strIpAddress, strHostname, nPortNumber) > Am I missing something obvious? Is there a better, or > more standar

Re: Because of multithreading semantics, this is not reliable.

2006-05-04 Thread Sergei Organov
"Olaf Meding" <[EMAIL PROTECTED]> writes: >> return result before that line, some other thread added a value ! > > Sure, but that is the nature of using threads and a mutex. I hope you are > you not saying that every function that uses a mutex should have a comment > saying this is not "reliabl

Subclassing array

2006-05-04 Thread TG
Hi. i've already something about inheriting from array a few weeks ago and had my answer. But again, there is something that I don't understand. Here is my vector class, which works quite well : class Vector(array): def __new__(cls,length,data=None): return super(Vector,cls).__new__(c

Python sample code for PLSQL REF CURSORS

2006-05-04 Thread A.M
Hi, I am having hard time to find a sample that shows me how to return an OUT REF CURSOR from my oracle stored procedure to my python program. The technique is explained here for Java and Visual Basic: http://www.oracle-base.com/articles/8i/UsingRefCursorsToReturnRecordsets.php I am look

Re: This coding style bad practise?

2006-05-04 Thread Martin P. Hellwig
Thanks for the input folks! I adapted my script to the given suggestions and it's now far more 'logical', for reference I added it below. -- mph - script - > import string > import time > > class IDGenerator(object): > """(leading_id, subversion_length, tz) # tz = 'local' or 'gm'

Re: Python function returns:

2006-05-04 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Tim Chase <[EMAIL PROTECTED]> wrote: > They Python way (that you deride) is much clearer. Your > input goes in the parameters, and your output gets assigned > the way functions are intended to work. Unambiguous. It's probably worth mentioning that the only rea

Re: Swaying A Coder Away From Python

2006-05-04 Thread Tim Williams
On 04/05/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > nope, but if we were to post to the list every time some random blogger says > something about Python, we wouldn't have room for much other stuff. > It wasn't from a random blogger, it was from an email newsletter for this site: http://www.

Shed Skin Python-to-C++ Compiler - Summer of Code?

2006-05-04 Thread Mark Dufour
Hello all, As Bearophile pointed out, I have just released Shed Skin 0.0.8. For those of you that do not know Shed Skin, it is an optimizing Python-to-C++ compiler, that allows for translation of pure (unmodified) Python programs into optimized machine language. The speed of generated code is typi

Re: Python function returns:

2006-05-04 Thread bruno at modulix
Michael Yanowitz wrote: > I am still new to Python but have used it for the last 2+ months. > One thing I'm still not used to is that functions parameters can't > change as expected. > > For example in C, I can have > status = get_network_info (strIpAddress, &strHostname, &nPortNumber) You hav

Re: Swaying A Coder Away From Python

2006-05-04 Thread bruno at modulix
BartlebyScrivener wrote: > I'm picking this up via clp on Google Groups. I can't tell what Mr. > Lundh is referring to. The first line of his post is: "Tim Williams > wrote" but there's nothing that comes before. I had seen the article on > Django on Digg I think, but what is article Tim Williams i

Re: Problem building extension under Cygwin (ImportError: Bad address)

2006-05-04 Thread Lars
Thanks Jason, it works now. There seems to be some sort of issue with ld in cygwin when compiling shared libraries (e.g. DLL's). This worked on my Cygwin installation also: -- gcc hello.c -I/usr/include/python2.4/ -L/usr/lib/python2.4/config/ -lpython2.4 -shared -o hel

Re: Because of multithreading semantics, this is not reliable.

2006-05-04 Thread Christophe
Olaf Meding a écrit : >>return result before that line, some other thread added a value ! > > > Sure, but that is the nature of using threads and a mutex. I hope you are > you not saying that every function that uses a mutex should have a comment > saying this is not "reliable"? That function

Re: Swaying A Coder Away From Python

2006-05-04 Thread Tim Williams
On 4 May 2006 05:24:40 -0700, BartlebyScrivener <[EMAIL PROTECTED]> wrote: > I'm picking this up via clp on Google Groups. I can't tell what Mr. > Lundh is referring to. The first line of his post is: "Tim Williams > wrote" but there's nothing that comes before. I had seen the article on > Django o

Re: unable to resize mmap object

2006-05-04 Thread Georg Brandl
Carl Banks wrote: > Frankly, I'm not so sure matching Windows behavior is a great idea. > mmap module seems to be having an identity crisis. Is it a low-level > system call, or a high-level, OS-independent way to access files as > blocks of memory? The modules is moving towards the latter (what

Re: Because of multithreading semantics, this is not reliable.

2006-05-04 Thread Grant Edwards
On 2006-05-04, Olaf Meding <[EMAIL PROTECTED]> wrote: >> return result before that line, some other thread added a value ! > > Sure, but that is the nature of using threads and a mutex. Yes. > I hope you are you not saying that every function that uses a > mutex should have a comment saying th

Re: Gettings subdirectories

2006-05-04 Thread Lou Losee
import os.pathos.path.isdir(file)LouOn 5/4/06, Philippe Martin <[EMAIL PROTECTED]> wrote: Hi,The second edition of "Programming Python - O'REILLY - Mark Lutz" shows how to do that using "os.path.walk"PhilippeFlorian Lindner wrote:> Hello,> how can I get all subdirectories of a given directories? os

Re: Python sample code for PLSQL REF CURSORS

2006-05-04 Thread Gerhard Häring
A.M wrote: > Hi, > > I am having hard time to find a sample that shows me how to return an OUT > REF CURSOR from my oracle stored procedure to my python program. [...] import cx_Oracle con = cx_Oracle.connect("me/[EMAIL PROTECTED]") cur = con.cursor() outcur = con.cursor() cur.execute("""

Re: Because of multithreading semantics, this is not reliable.

2006-05-04 Thread OlafMeding
Christophe > Same reason that there is a warning in the "os.access" manual I understand the if file exists open it code. I looked at the os.access documentation and see no "warning" or "not reliable" wording there. 6.1.4 Files and Directories access(path, mode) Olaf -- http://mail.python

Re: pleac

2006-05-04 Thread Thomas Guettler
Am Thu, 04 May 2006 04:05:49 -0700 schrieb jonas: > Hi, > > I'm new to python. > After a search on > http://pleac.sourceforge.net/pleac_python/index.html > why python have a low %? Python has the highest percentage of all languages at pleac. For those who don't know pleac: """Following the gre

Re: Multiple Version Install?

2006-05-04 Thread Fredrik Lundh
David C.Ullrich wrote: > Would there be issues (registry settings, environment > variables, whatever) if a person tried to install > versions 1.x and 2.x simultaneously on one Windows > system? Windows 98, if it matters. > > (I can handle the file associations with no problem.) in general, no. (

Re: Sorting a list of dictionaries by dictionary key

2006-05-04 Thread Alex Martelli
Tim Chase <[EMAIL PROTECTED]> wrote: > > assuming that DateTime returns something that compares correctly, you can > > do something like: > > > > def sortkey(item): > > return item.get("from_datetime") > > > > data.sort(key=sortkey) > > > > (assuming Python 2.4 or later) > > Bu

Re: Because of multithreading semantics, this is not reliable.

2006-05-04 Thread Christophe
[EMAIL PROTECTED] a écrit : > Christophe > > >>Same reason that there is a warning in the "os.access" manual > > > I understand the if file exists open it code. > > I looked at the os.access documentation and see no "warning" or "not > reliable" wording there. > 6.1.4 Files and Directories >

Re: simultaneous assignment

2006-05-04 Thread Dave Hansen
On Tue, 02 May 2006 18:52:48 GMT in comp.lang.python, John Salerno <[EMAIL PROTECTED]> wrote: [...] > >Yeah, after trying some crazy things, I just wrote it this way: > >def truth_test(seq): > truth = 0 > for item in seq: > if item: > truth += 1 > if truth == 1: >

Re: simultaneous assignment

2006-05-04 Thread Paul Rubin
Dave Hansen <[EMAIL PROTECTED]> writes: > Well, if you want something minimalist, you could try > >def truth_test(seq): > return sum(1 for item in seq if item) == 1 def truth_test(seq): return sum(map(bool, seq)) == 1 -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling a Postgres Function using CGI written in Python

2006-05-04 Thread Fuzzydave
cheers :) thats what i wanted to know :) David -- http://mail.python.org/mailman/listinfo/python-list

Re: python strings

2006-05-04 Thread Sion Arrowsmith
Bryan <[EMAIL PROTECTED]> wrote: > >>> s = '\x00' > >>> s[0] == chr(0) >True That's a little excessive when: >>> s = '\0' >>> s[0] == chr(0) True Oh, and to reassure the OP that that null really is *in* the string: >>> len(s) 1 -- \S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/ _

Unicode code has no method float() ?

2006-05-04 Thread Rony Steelandt
How can I get the value of a Unicode object ? When I do myobject.float() I get the error message that it doesn't have a float() attribute tia R_ -- --- Rony Steelandt BuCodi rony dot steelandt (at) bucodi dot com Visit the python blog at http://360.yahoo.com/bucodi -- http://mail.python.o

Re: Unicode code has no method float() ?

2006-05-04 Thread Alexandre Fayolle
Le 04-05-2006, Rony <[EMAIL PROTECTED]> nous disait: > How can I get the value of a Unicode object ? > > When I do myobject.float() I get the error message that it doesn't have > a float() attribute Try to use the float builtin function, as in: float(myobject) instead of a method. -- Alexandr

Re: Subclassing array

2006-05-04 Thread Alex Martelli
TG <[EMAIL PROTECTED]> wrote: ... > When I call Vector.__init__() in Stimulus, doesn't it also call __new__ > ? I don't understand the detail of callings to __new__ and __init__ in > python inheritance ... Calling a (new-style) class does __new__ first, THEN calls the class's __init__ on the re

Tuple assignment and generators?

2006-05-04 Thread Tim Chase
Just as a pedantic exercise to try and understand Python a bit better, I decided to try to make a generator or class that would allow me to unpack an arbitrary number of calculatible values. In this case, just zeros (though I just to prove whatever ends up working, having a counting generator

Re: stripping unwanted chars from string

2006-05-04 Thread Alex Martelli
Edward Elliott <[EMAIL PROTECTED]> wrote: > I'm looking for the "best" way to strip a large set of chars from a filename > string (my definition of best usually means succinct and readable). I > only want to allow alphanumeric chars, dashes, and periods. This is what I > would write in Perl (bl

Re: Python function returns:

2006-05-04 Thread Sion Arrowsmith
Michael Yanowitz <[EMAIL PROTECTED]> wrote: > In Python, there does not seem to be an easy way to have functions return >multiple values except it can return a list such as: >strHostname, nPortNumber, status = get_network_info (strIpAddress, >strHostname, >

Re: Multiple Version Install?

2006-05-04 Thread David C.Ullrich
On Thu, 4 May 2006 16:17:57 +0200, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: >David C.Ullrich wrote: > >> Would there be issues (registry settings, environment >> variables, whatever) if a person tried to install >> versions 1.x and 2.x simultaneously on one Windows >> system? Windows 98, if it m

Re: Unicode code has no method float() ?

2006-05-04 Thread Rony Steelandt
Works, thank you > Le 04-05-2006, Rony <[EMAIL PROTECTED]> nous disait: >> How can I get the value of a Unicode object ? >> >> When I do myobject.float() I get the error message that it doesn't have >> a float() attribute > > Try to use the float builtin function, as in: float(myobject) instead

Re: Wake on LAN and Shutdown for Windows and Linux

2006-05-04 Thread diffuser78
Any help is appreciated -- http://mail.python.org/mailman/listinfo/python-list

Re: Swaying A Coder Away From Python

2006-05-04 Thread Sion Arrowsmith
>On 4 May 2006 05:24:40 -0700, BartlebyScrivener <[EMAIL PROTECTED]> wrote: >> I'm picking this up via clp on Google Groups. I can't tell what Mr. >> Lundh is referring to. The first line of his post is: "Tim Williams >> wrote" but there's nothing that comes before. Similarly, I'm reading this via

pyuno and oootools with OpenOffice 2.0

2006-05-04 Thread Sells, Fred
I'm using windows xp and OpenOffice 2.0 and doing my first project with pyuno. I've got the basics to work,. An example I googled at http://blogs.nuxeo.com/sections/aggregators/openoffice_org/blogaggregator_vi ew?b_start:int=0 imported an ootools module. When I try to import it, it does not exis

Re: Subclassing array

2006-05-04 Thread Sion Arrowsmith
Alex Martelli <[EMAIL PROTECTED]> wrote: >TG <[EMAIL PROTECTED]> wrote: >> When I call Vector.__init__() in Stimulus, doesn't it also call __new__ >> ? I don't understand the detail of callings to __new__ and __init__ in >> python inheritance ... >Calling a (new-style) class does __new__ first, THE

Re: Swaying A Coder Away From Python

2006-05-04 Thread Rony Steelandt
"One problem is that python tools suck," he wrote. Wallace compared the various IDEs and other developer tools available to Microsoft's freely available Visual Studio Express and called them "toys." What s wrong with VI ??? :) R_ >> On 4 May 2006 05:24:40 -0700, BartlebyScrivener <[EMAIL P

Re: Problem building extension under Cygwin (ImportError: Bad address)

2006-05-04 Thread Jason Tishler
On Thu, May 04, 2006 at 06:23:23AM -0700, Lars wrote: > But first compiling hello.c with gcc, then linking it with gnu-ld just > won't work. I only really need to compile one C-file to a shared > library so it doesn't matter so much for me. But bigger projects will > have a problem.. No, it works

Progamming python without a keyboard

2006-05-04 Thread Rony Steelandt
http://www.newscientisttech.com/article/dn9066 To nice to be true ? R_ -- --- Rony Steelandt BuCodi rony dot steelandt (at) bucodi dot com Visit the python blog at http://360.yahoo.com/bucodi -- http://mail.python.org/mailman/listinfo/python-list

Calling superclass

2006-05-04 Thread Florian Lindner
Hello, I try to call the superclass of the ConfigParser object: class CustomizedConfParser(ConfigParser.SafeConfigParser): def get(self, section, attribute): try: return super(CustomizedConfParser, self).get(section, attribute) # [...] but that gives only ret

Re: Tuple assignment and generators?

2006-05-04 Thread Diez B. Roggisch
Tim Chase wrote: > Just as a pedantic exercise to try and understand Python a > bit better, I decided to try to make a generator or class > that would allow me to unpack an arbitrary number of > calculatible values. In this case, just zeros (though I > just to prove whatever ends up working, havi

Re: Swaying A Coder Away From Python

2006-05-04 Thread Adam Jones
Rony Steelandt wrote: > > "One problem is that python tools suck," he wrote. Wallace compared the > various IDEs and other developer tools available to Microsoft's freely > available Visual Studio Express and called them "toys." > > > > What s wrong with VI ??? :) User error, evidently. Someti

Re: Calling superclass

2006-05-04 Thread Diez B. Roggisch
Florian Lindner wrote: > Hello, > I try to call the superclass of the ConfigParser object: > > class CustomizedConfParser(ConfigParser.SafeConfigParser): > def get(self, section, attribute): > try: > return super(CustomizedConfParser, self).get(section, > attri

Python for Perl programmers

2006-05-04 Thread A.M
Hi, Is there any efficient online resource or book that help experienced Perl programmers to Python? Thank you, Alan -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >