Re: Iterating over test data in unit tests

2005-12-05 Thread Ben Finney
Ben Finney <[EMAIL PROTECTED]> wrote: > Summary: I'm looking for idioms in unit tests for factoring out > repetitive iteration over test data. Thanks to those who've offered suggestions, especially those who suggested I look at generator functions. This leads to:: import unittest import

Re: ANN: pygene - genetic algorithms package

2005-12-05 Thread Erik Max Francis
aum wrote: > I looked at a few genetic algorithms/genetic programming packages for > Python, and found them somewhat convoluted, complicated and > counter-intuitive to use. > > So I've written a genetic algorithms package which I hope will be more > approachable to beginners. > > The first relea

Re: win32com 'catastrophic failure'

2005-12-05 Thread Tim Roberts
"g.franzkowiak" <[EMAIL PROTECTED]> wrote: > >I'm trying to interface to an .ocx file. >After successfully running makepy over it, the following is my problem: > > com_error: (-2147418113, 'catastrophic failure', None, None) That's not nearly enough information. -2147418113 is 0x8000, which

ANN: pygene - genetic algorithms package

2005-12-05 Thread aum
Hi all, I looked at a few genetic algorithms/genetic programming packages for Python, and found them somewhat convoluted, complicated and counter-intuitive to use. So I've written a genetic algorithms package which I hope will be more approachable to beginners. The first release of pygene is up

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-05 Thread Tim Roberts
Christopher Subich <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] wrote: >> >>>From "The Design of Everyday Things", docs are a sign of poor design. >> Even a single word, such as the word "Push" on the face of a door, is >> an indication that the design can be improved. Please, rethink the >> de

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-05 Thread Tim Roberts
Peter Decker <[EMAIL PROTECTED]> wrote: > >I'm starting to suspect that the same people who are zealous about >spaces are also the same people who look down on anyone who doesn't >agree with their choice of text editor. Text editors are like underwear. Everyone has their own favorite brand, and n

Re: Tabs bad

2005-12-05 Thread Paul Rubin
[EMAIL PROTECTED] (Björn Lindström) writes: > Actually using tabs for eight spaces and then filling out with spaces to > the correct indentation is the convention for Emacs Lisp. Of course, > since everyone coding Emacs Lisp does it with the same editor, it's no > problem. The variable `indent-tab

Re: Tabs bad

2005-12-05 Thread Björn Lindström
Lee Harr <[EMAIL PROTECTED]> writes: > I have never seen anyone suggest mixing tabs and spaces, and I > have read a lot of tabs-vs-spaces flamewars in my time. > > Everyone agrees that mixing is bad. I might even go so far as to > say that the only real problem is mixing. The question is, if we >

Re: Python riddle

2005-12-05 Thread Dan Bishop
kyle.tk wrote: > SPE - Stani's Python Editor wrote: > > I know that this code is nonsense, but why does this print 'Why?' > > > > a = 1 > > if a >2: > > try: > > 5/0 > > except: > > raise > > else: > > print 'why?' > > last time i checked this should print 'why?' > I hav

Re: Iterating over test data in unit tests

2005-12-05 Thread Steven Bethard
Ben Finney wrote: > Maybe I need to factor out the iteration into a generic iteration > function, taking the actual test as a function object. That way, the > dataset iterator doesn't need to know about the test function, and > vice versa. > > def iterate_test(self, test_func, test_params=

Re: PythonMagick on Windows

2005-12-05 Thread Do Re Mi chel La Si Do
+1 Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic Link Library

2005-12-05 Thread Andreas Kostyrka
Am Montag, den 05.12.2005, 21:30 -0500 schrieb Ervin J. Obando: > Hi everyone, > > Apologies if my question is a bit novice-ish. I was wondering if there > was a way of creating a Dynamic Link Library with Python. Probably yes. But why would you want to do that? Actually the way would be to crea

Re: what's wrong with "lambda x : print x/60,x%60"

2005-12-05 Thread Dan Bishop
[EMAIL PROTECTED] wrote: > [EMAIL PROTECTED] wrote: > > [EMAIL PROTECTED] wrote: > > > [EMAIL PROTECTED] wrote: > > > > > and, as you just found out, a rather restrictive one > > > > > at that. > > > > > > > > In part because Python's designers failed to make "print" a function > > > > or provide

Re: what's wrong with "lambda x : print x/60,x%60"

2005-12-05 Thread Devan L
Steve Holden wrote: > [EMAIL PROTECTED] wrote: > > "Gary Herron" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > >>--snip-- > >>So just use a def. It is constantly pointed out on > >>this list that the lambda provides no extra expressive power, it is > >>merely a shortcut > >

Re: Usenet falsehoods (was Re: Bitching about the documentation...)

2005-12-05 Thread Grant Edwards
On 2005-12-06, Aahz <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Grant Edwards <[EMAIL PROTECTED]> wrote: >> >>Hmm, I though he explained it: >> >> 1) Not using your real name. >> >> 2) A yahoo, aol, or hotmail address. >> >>In the ancient and hallowed (by net standards) histor

Re: Python 2.4.2 make failure in posixmodule on OSX 10.4.3

2005-12-05 Thread smurphus
configure also reports checking for statvfs... yes -- http://mail.python.org/mailman/listinfo/python-list

Re: what's wrong with "lambda x : print x/60,x%60"

2005-12-05 Thread bonono
[EMAIL PROTECTED] wrote: > [EMAIL PROTECTED] wrote: > > [EMAIL PROTECTED] wrote: > > > > and, as you just found out, a rather restrictive one > > > > at that. > > > > > > In part because Python's designers failed to make "print" a function > > > or provide an if-then-else expression. > > > > > Wh

Re: Python 2.4.2 make failure in posixmodule on OSX 10.4.3

2005-12-05 Thread smurphus
I just re-ran the configure script. It reports: checking for lchown... yes checking for fstatvfs... yes ?? -- http://mail.python.org/mailman/listinfo/python-list

Re: Usenet falsehoods (was Re: Bitching about the documentation...)

2005-12-05 Thread Erik Max Francis
Aahz wrote: > To use a Panix in-joke, how old are you, anyway? > > I've been on the Net for more than fifteen years, and while this canard > about real names gets trotted out from time to time, it's quite clear > that many many people have been active on the Net *and* taken seriously > using name

Re: Python 2.4.2 make failure in posixmodule on OSX 10.4.3

2005-12-05 Thread smurphus
Thanks for the reply, Martin. I know a bit of C. I thought maybe I was missing something simple, since I don't have an exotic system configuration. Re: lchown the file posixmodule.c in Python does include and I have that header where it should be, i.e. /usr/include/sys/types.h so I don't know w

Re: Memoizing decorator

2005-12-05 Thread Alex Martelli
Scott David Daniels <[EMAIL PROTECTED]> wrote: > Daishi Harada wrote: > > ... I've managed to get these working for both > > functions and methods by wrapping them in > > yet another function (the following is for the > > cookbook example, replacing 'cachedmethod'): > > > > --- > > def memoize(f

Re: join dictionaries using keys from one & values

2005-12-05 Thread Alex Martelli
ProvoWallis <[EMAIL PROTECTED]> wrote: ... > The keys in the new dictionary would be the keys from the old > dictionary one (dict1) and the values in the new dictionary would be > the keys from the old dictionary two (dict2). The keys would be joined > by matching the values from dict1 and dict2

Re: Bitching about the documentation...

2005-12-05 Thread Ben Finney
[EMAIL PROTECTED] wrote: > If one is required to buy a book to use free software, it is not > really free, is it? If one is required to buy a computer to use free software, is it free? You should well know that cost and freedom are orthogonal. -- \"I got fired from my job the o

Re: join dictionaries using keys from one & values

2005-12-05 Thread Devan L
ProvoWallis wrote: > Thanks so much. I never would have been able to figure this out on my > own. > > def dictionary_join(one, two): > > dict2x = dict( ((dict2[k], k) for k in dict2.iterkeys())) > dict3 = dict(((k, dict2x[v]) for k,v in dict1.iteritems())) > print dict3 > > dict1 =

Re: Iterating over test data in unit tests

2005-12-05 Thread Bengt Richter
On Tue, 6 Dec 2005 12:19:40 +1100 (EST), Ben Finney <[EMAIL PROTECTED]> wrote: >Howdy all, > >Summary: I'm looking for idioms in unit tests for factoring out >repetitive iteration over test data. I explain my current practice, >and why it's unsatisfactory. > Does this do what you want? http:/

Re: Iterating over test data in unit tests

2005-12-05 Thread Ben Finney
Scott David Daniels <[EMAIL PROTECTED]> wrote: > Ben Finney wrote: > > Summary: I'm looking for idioms in unit tests for factoring out > > repetitive iteration over test data > > How about something like: > > > class Test_Game(unittest.TestCase): [...] >def runs(self, throws):

Re: Memoizing decorator

2005-12-05 Thread Bengt Richter
On 5 Dec 2005 16:15:38 -0800, "Daishi Harada" <[EMAIL PROTECTED]> wrote: >Hi, > >I'm trying to find/write a memoizing decorator >that works both for functions and methods. ISTM you can't do that without defining exactly what the instance that a method is bound to (i.e., the self argument) contrib

Re: join dictionaries using keys from one & values

2005-12-05 Thread ProvoWallis
Thanks so much. I never would have been able to figure this out on my own. def dictionary_join(one, two): dict2x = dict( ((dict2[k], k) for k in dict2.iterkeys())) dict3 = dict(((k, dict2x[v]) for k,v in dict1.iteritems())) print dict3 dict1 = {1:'bbb', 2:'aaa', 3:'ccc'} dict2 =

Re: Bitching about the documentation...

2005-12-05 Thread Paul Rubin
"BartlebyScrivener" <[EMAIL PROTECTED]> writes: > >>The solution is clear: the distro maintainers should require that all > code contributions must come with good docs. > Well, that might be asking a bit too much of the programmers, who > perhaps don't exactly enjoy mucking about in the lowlands o

Re: Iterating over test data in unit tests

2005-12-05 Thread Scott David Daniels
Ben Finney wrote: > Summary: I'm looking for idioms in unit tests for factoring out > repetitive iteration over test data How about something like: > import unittest, bowling > class Test_Game(unittest.TestCase): > def setUp(self): > """ Set up test fixtures """ >

Re: what's wrong with "lambda x : print x/60,x%60"

2005-12-05 Thread rurpy
[EMAIL PROTECTED] wrote: > [EMAIL PROTECTED] wrote: > > > and, as you just found out, a rather restrictive one > > > at that. > > > > In part because Python's designers failed to make "print" a function > > or provide an if-then-else expression. > > > Why would one need print in lambda ? I like t

Re: Xah's Edu Corner: Examples of Quality Technical Writing

2005-12-05 Thread Steve Holden
Xah Lee wrote: [...] > • No author masturbation. (if fact, you won't see a first-person > perspective, as is the case with most quality tech writing.) > > We [...] Will new readers please note that this author is well-known for posting inflammatory and irrelevant material on many inappropriate n

Re: Bitching about the documentation...

2005-12-05 Thread rurpy
<[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > [EMAIL PROTECTED] wrote: --snip-- > > > If you prefer the latest documentation, bookmark this page: > > > > > > http://www.python.org/dev/doc/devel/index.html > > > > Thanks I will keep that in mind. But the obvious risk is that it > >

Re: Bitching about the documentation...

2005-12-05 Thread Paul Rubin
[EMAIL PROTECTED] writes: > Redhat's Fedora project seems to have a fairly well developed > program for recruiting and encouraging writers. Frankly I haven't been that impressed with the Fedora docs I've seen. The LDP docs have generally been better. Maybe I'm looking at the wrong Fedora docs. F

Re: Bitching about the documentation...

2005-12-05 Thread François Pinard
[Ben Finney] >> please study this form, carefully read the small print, fill it >> properly and send the yellow copy at this address." > ... "so that it can go with all the other requests I get at various > times from various people". If he wants pink forms with blue borders, let him grant himse

Re: hash()

2005-12-05 Thread Scott David Daniels
Aahz wrote: > QOTW: Timbot makes an error ;-) Now exactly who was in charge of the replacement capacitors? --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Detect character encoding

2005-12-05 Thread The new guy
Michal wrote: > Hello, > is there any way how to detect string encoding in Python? > > I need to proccess several files. Each of them could be encoded in > different charset (iso-8859-2, cp1250, etc). I want to detect it, and > encode it to utf-8 (with string function encode). Well, about how to

Re: Bitching about the documentation...

2005-12-05 Thread rurpy
"Paul Rubin" wrote: > Steve Holden <[EMAIL PROTECTED]> writes: > > Or, better still, by an accomplished writer who has access to the > > code's author. This was indeed my experience in writing the docs for > > previously undocumented modules. The author was happy to help

Xah's Edu Corner: Examples of Quality Technical Writing

2005-12-05 Thread Xah Lee
i had the pleasure to read the PHP's manual today. http://www.php.net/manual/en/ although Pretty Home Page is another criminal hack of the unix lineage, but if we are here to judge the quality of its documentation, it is a impeccability. it has or possesses properties of: • To the point and use

Re: hash()

2005-12-05 Thread Aahz
In article <[EMAIL PROTECTED]>, Tim Peters <[EMAIL PROTECTED]> wrote: > >First, if `st` is a string, `st[::-1]` is a list. Do you really mean >to compare string hashes with list hashes here? I'm going to assume >not. QOTW: Timbot makes an error ;-) -- Aahz ([EMAIL PROTECTED]) <*>

Usenet falsehoods (was Re: Bitching about the documentation...)

2005-12-05 Thread Aahz
In article <[EMAIL PROTECTED]>, Grant Edwards <[EMAIL PROTECTED]> wrote: > >Hmm, I though he explained it: > > 1) Not using your real name. > > 2) A yahoo, aol, or hotmail address. > >In the ancient and hallowed (by net standards) history of Usenet, both >of these (particularly the first one) ha

Re: join dictionaries using keys from one & values

2005-12-05 Thread bonono
ProvoWallis wrote: > I'm still learning python so this might be a crazy question but I > thought I would ask anyway. Can anyone tell me if it is possible to > join two dictionaries together to create a new dictionary using the > keys from the old dictionaries? > > The keys in the new dictionary wo

Re: Bitching about the documentation...

2005-12-05 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > Or, better still, by an accomplished writer who has access to the > code's author. This was indeed my experience in writing the docs for > previously undocumented modules. The author was happy to help me by > answering questions, and this did make the docs

Re: join dictionaries using keys from one & values

2005-12-05 Thread Erik Max Francis
ProvoWallis wrote: > I'm still learning python so this might be a crazy question but I > thought I would ask anyway. Can anyone tell me if it is possible to > join two dictionaries together to create a new dictionary using the > keys from the old dictionaries? There is no builtin method. The usu

join dictionaries using keys from one & values

2005-12-05 Thread ProvoWallis
I'm still learning python so this might be a crazy question but I thought I would ask anyway. Can anyone tell me if it is possible to join two dictionaries together to create a new dictionary using the keys from the old dictionaries? The keys in the new dictionary would be the keys from the old di

Re: Bitching about the documentation...

2005-12-05 Thread BartlebyScrivener
>>Or, better still, by an accomplished writer who has access to the code's author. This was indeed my experience in writing the docs for previously undocumented modules. The author was happy to help me by answering questions, and this did make the docs better than they'd otherwise have been. << No

Re: Python 2.4.2 make failure in posixmodule on OSX 10.4.3

2005-12-05 Thread Martin v. Löwis
smurphus wrote: > Any suggestions on how I can remedy this? It would be good if you could try to understand and to analyse these error messages; your message does not indicate whether you have knowledge of the C language and could analyse them or not. For example, it is very puzzling that there i

Re: Bitching about the documentation...

2005-12-05 Thread Steve Holden
Paul Rubin wrote: > [EMAIL PROTECTED] writes: > >>Sounds like a subject matter expert is needed here, not a garden variety >>tech writer or Python programmer. Documentation of esoteric stuff requires, >>well, esoteric knowledge. > > > Yes, that's what I mean; coding a library module for an esot

Re: Need help implementing an algorithm in python

2005-12-05 Thread ech0
wow. nevermind. i figured it out. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python riddle

2005-12-05 Thread kyle.tk
SPE - Stani's Python Editor wrote: > I know that this code is nonsense, but why does this print 'Why?' > > a = 1 > if a >2: > try: > 5/0 > except: > raise > else: > print 'why?' last time i checked this should print 'why?' I have no idea how you got it to print 'Why?'

Re: Bitching about the documentation...

2005-12-05 Thread Paul Rubin
[EMAIL PROTECTED] writes: > Sounds like a subject matter expert is needed here, not a garden variety > tech writer or Python programmer. Documentation of esoteric stuff requires, > well, esoteric knowledge. Yes, that's what I mean; coding a library module for an esoteric function requires that sa

Re: Bitching about the documentation...

2005-12-05 Thread BartlebyScrivener
>>The solution is clear: the distro maintainers should require that all code contributions must come with good docs. When a code submission comes in, the distro maintainers should critically review the accompanying docs, note any shortcomings and constructively ask for improvements from the contri

Re: Bitching about the documentation...

2005-12-05 Thread Ben Finney
François Pinard <[EMAIL PROTECTED]> wrote: > More than LaTeX, the main frozener is when people in charge tell you > to use bug trackers to speak to them. > > This is like standing up with someone, having a conversation, ... in which you informally ask them to do something... > and your > partne

Re: what's wrong with "lambda x : print x/60,x%60"

2005-12-05 Thread bonono
Paul Rubin wrote: > > Why use temporary variables when all you have to do is make your > > expressions three lines long to avoid "polluting the namespace"? > > Indeed. I'd much rather say > > x = a + b + (c * d) + e > > than > > temp1 = a + b > temp2 = c * d > temp3 = temp1 + temp2 > x

Re: tricky time interval billing problem

2005-12-05 Thread Steve Holden
[EMAIL PROTECTED] wrote: > I am currently working on a tricky problem at work. I googled around a > bit, but "time intervals" did not come up with anything useful. > Although I have some rough idea of how I could solve it, I still would > value some input. > > I have information of (It has only co

Re: Bitching about the documentation...

2005-12-05 Thread skip
Paul> For example, writing a good doc patch for urllib2 would mean Paul> checking RFC 2616(?) against the urllib2 code to see what parts of Paul> the RFC got implemented and what parts didn't. It might also mean Paul> comparing urllib2 with other libraries like LWP (Perl) or whate

Re: Bitching about the documentation...

2005-12-05 Thread skip
François> More than LaTeX, the main frozener is when people in charge François> tell you to use bug trackers to speak to them. Understood. I wish either a) SourceForge supported email interaction with their trackers or b) someone would finish off the Roundup issue tracker

Re: what's wrong with "lambda x : print x/60,x%60"

2005-12-05 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > Defining a function, and giving it a name, > isn't "polluting the namespace", any more than assigning > sub-expressions to temporary variables is polluting the namespace. Nor any less. > Why use temporary variables when all you have to do is make your >

Re: hash()

2005-12-05 Thread Steven Bethard
Tim Peters wrote: > First, if `st` is a string, `st[::-1]` is a list. I hate to question the great timbot, but am I missing something? >>> 'abcde'[::-1] 'edcba' STeVe -- http://mail.python.org/mailman/listinfo/python-list

Python 2.4.2 make failure in posixmodule on OSX 10.4.3

2005-12-05 Thread smurphus
Hi All- I'm trying to build Python 2.4.2 on OSX 10.4.3 (gcc ver. 3.3 apple build 1495) and have the following error when running 'make': gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I. -I./Include -DPy_BUILD_CORE -c ./Modul

Re: Bitching about the documentation...

2005-12-05 Thread Paul Rubin
François Pinard <[EMAIL PROTECTED]> writes: > > Let me repeat this for the umpteenth time: You do not have to learn > > LaTeX to contribute to docs. Submit plain text. One of us with > > some LaTeX knowledge will do the markup. Content is the hard part. > > Markup is nothing, so don't let it be

Re: what's wrong with "lambda x : print x/60,x%60"

2005-12-05 Thread Steve Holden
[EMAIL PROTECTED] wrote: > "Gary Herron" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>--snip-- >>So just use a def. It is constantly pointed out on >>this list that the lambda provides no extra expressive power, it is >>merely a shortcut > > > No, it is not merely a shortcu

Re: what's wrong with "lambda x : print x/60,x%60"

2005-12-05 Thread bonono
[EMAIL PROTECTED] wrote: > > and, as you just found out, a rather restrictive one > > at that. > > In part because Python's designers failed to make "print" a function > or provide an if-then-else expression. > Why would one need print in lambda ? I like ternary operator(and there is ugly work ar

Re: Memoizing decorator

2005-12-05 Thread Scott David Daniels
Daishi Harada wrote: > ... I've managed to get these working for both > functions and methods by wrapping them in > yet another function (the following is for the > cookbook example, replacing 'cachedmethod'): > > --- > def memoize(function): > im = Memoize(function) > def fn(*args, **kwa

Re: Bitching about the documentation...

2005-12-05 Thread François Pinard
[EMAIL PROTECTED] > Let me repeat this for the umpteenth time: You do not have to learn > LaTeX to contribute to docs. Submit plain text. One of us with some > LaTeX knowledge will do the markup. Content is the hard part. Markup > is nothing, so don't let it be a barrier for you. More than

Re: Bitching about the documentation...

2005-12-05 Thread Steve Holden
BartlebyScrivener wrote: >>>Let me repeat this for the umpteenth time: You do not have to learn LaTeX to > > contribute to docs. << > > Noted. And thanks again to all who responded. The tone of this whole > thing is really antagonistic in parts, which is unfortunate. I'll offer > my services thro

Re: hash()

2005-12-05 Thread Tim Peters
[John Marshall] >>> For strings of > 1 character, what are the chances >>> that hash(st) and hash(st[::-1]) would return the >>> same value? [Tim Peters] >> First, if `st` is a string, `st[::-1]` is a list. Do you really mean >> to compare string hashes with list hashes here? I'm going to assume

Re: insert a dictionary into sql data base

2005-12-05 Thread Carsten Haese
On Mon, 05 Dec 2005 18:00:21 -0700, David Bear wrote > Fredrik Lundh wrote: > > DON'T MANUALLY CONSTRUCT THE SQL INSERT STATEMENT. Use string > > formatting to insert the field names, but let the database layer deal with > > the values. > > > > If you want to do things in two steps, do the fields

Re: wxPython : getting started

2005-12-05 Thread Steve Holden
David Sulc wrote: > Hi ! > > I've looked all over (internet, books, etc.) and I haven't found a very > good ressource to get started with wxPython (yes, I've been through > their tutorial). > > What I would basically like to do for starters is to be able to define > the main panel being displa

Re: timeit's environment

2005-12-05 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > Scott David Daniels wrote: ... >> Perhaps you could write a paragraph or two that would have >> informed you and send it to the destination mentioned on the >> documentation page. > > Yes, but I was hoping to get some sense of how such > a submission might be viewed prio

Re: Use python to test Java and Windows (dll) applciations

2005-12-05 Thread jb
Thanks Cameron, Watsup looks compelling to me and its going to keep me busy for a while. Thanks for your help. -jb -- http://mail.python.org/mailman/listinfo/python-list

Re: Python riddle

2005-12-05 Thread Daniel Schüle
SPE - Stani's Python Editor wrote: > I know that this code is nonsense, but why does this print 'Why?' > > a = 1 > if a >2: > try: > 5/0 > except: > raise > else: > print 'why?' > because 1 is not greater than 2 I suppose :) -- http://mail.python.org/mailman/listinf

Dynamic Link Library

2005-12-05 Thread Ervin J. Obando
Hi everyone, Apologies if my question is a bit novice-ish. I was wondering if there was a way of creating a Dynamic Link Library with Python. Please provide any answers you may have. Warmest Regards, musicdev -- http://mail.python.org/mailman/listinfo/python-list

Re: hash()

2005-12-05 Thread jepler
> [John Marshall] > > For strings of > 1 character, what are the chances > > that hash(st) and hash(st[::-1]) would return the > > same value? > On Mon, Dec 05, 2005 at 09:11:14PM -0500, Tim Peters wrote: > First, if `st` is a string, `st[::-1]` is a list. Do you really mean > to compare string h

Re: XML and namespaces

2005-12-05 Thread uche . ogbuji
Wilfredo Sánchez Vega: """ I'm having some issues around namespace handling with XML: >>> document = xml.dom.minidom.Document() >>> element = document.createElementNS("DAV:", "href") >>> document.appendChild(element) >>> document.toxml() '\n'

Re: Ant (with Python extensions) good replacement for distutils?

2005-12-05 Thread Steve Christensen
On 2005-12-05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I know distutils well but don't know anything about Ant except that it > is a build tool from Apache project. > > Could it possible be better or as good as distutils? > (There are extensions for Python.) Ant is... ugh. If you're doing

Re: hash()

2005-12-05 Thread Tim Peters
[John Marshall] > For strings of > 1 character, what are the chances > that hash(st) and hash(st[::-1]) would return the > same value? First, if `st` is a string, `st[::-1]` is a list. Do you really mean to compare string hashes with list hashes here? I'm going to assume not. Second, what are y

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-05 Thread JohnBMudd
> Try this:: from __future__ import braces >>> from __future__ import braces File "", line 1 SyntaxError: not a chance >>> Thanks, that's funny. John -- http://mail.python.org/mailman/listinfo/python-list

Re: Python riddle

2005-12-05 Thread SPE - Stani's Python Editor
Forget it, it's not 1st of april yet. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python riddle

2005-12-05 Thread ech0
1 is not greater then 2 last time i checked :) -- http://mail.python.org/mailman/listinfo/python-list

Python riddle

2005-12-05 Thread SPE - Stani's Python Editor
I know that this code is nonsense, but why does this print 'Why?' a = 1 if a >2: try: 5/0 except: raise else: print 'why?' -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie Question

2005-12-05 Thread kyle.tk
solaris_1234 wrote: > I am trying to learn Python and I have a few questions. > > I have created a Class that is essentially a canvas with a red > background. After creation I want to change the background to green. > However I am having problems doing this. > > Here is my code: > > from Tkinter i

Re: Bitching about the documentation...

2005-12-05 Thread gene tani
[EMAIL PROTECTED] wrote: > [EMAIL PROTECTED] wrote: > > > Gee, I wonder if I typed "sort" into the search box on the wiki it might > > turn up something useful? Well, what do you know? > > > > 2 results of about 4571 pages. (0.19 seconds) > > > > 1. HowTo/Sorting > > 2. SortingListsOf

Re: Need help implementing an algorithm in python

2005-12-05 Thread ech0
Just to point out... I came up with the algorithm. Which is why I can explain it so well. But implementing it into code is one well of a task. -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help implementing an algorithm in python

2005-12-05 Thread ech0
I'm still in highschool. This is no homework. This is a personal project for me. I would normally do it myself but this one is just too complex, thats why I'm asking for help. -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help implementing an algorithm in python

2005-12-05 Thread gene tani
ech0 wrote: > I would appreciate any help I can get in finding a solution to the > following problem: > > == > > Below is a diagram: > http://www.muchographiks.com/algo.jpg > > THE PROBLEM > > Lets say we have 4 terms (purple represen

Need help implementing an algorithm in python

2005-12-05 Thread ech0
I would appreciate any help I can get in finding a solution to the following problem: == Below is a diagram: http://www.muchographiks.com/algo.jpg THE PROBLEM Lets say we have 4 terms (purple represents the terms). Some terms in th

Newbie Question

2005-12-05 Thread solaris_1234
I am trying to learn Python and I have a few questions. I have created a Class that is essentially a canvas with a red background. After creation I want to change the background to green. However I am having problems doing this. Here is my code: from Tkinter import * class MyApp: def __init

Iterating over test data in unit tests

2005-12-05 Thread Ben Finney
Howdy all, Summary: I'm looking for idioms in unit tests for factoring out repetitive iteration over test data. I explain my current practice, and why it's unsatisfactory. When following test-driven development, writing tests and then coding to satisfy them, I'll start with some of the simple te

Re: XML and namespaces

2005-12-05 Thread uche . ogbuji
Alan Kennedy """ Although I am sympathetic to your bewilderment: xml namespaces can be overly complex when it comes to the nitty, gritty details. """ You're the one who doesn't seem to clearly understand XML namespaces. It's your position that is bewildering, not XML namespaces (well, they are con

Re: Is there an equivalent to Java Webstart in Python?

2005-12-05 Thread Ravi Teja
Hi Kent, Too complicated example :-). Jythonc works just fine to create a regular jar file that you can reference in your jnlp file. Ravi Teja. -- http://mail.python.org/mailman/listinfo/python-list

Re: insert a dictionary into sql data base

2005-12-05 Thread David Bear
Fredrik Lundh wrote: > David Bear wrote > >> Fredrik Lundh wrote: >> >> > cursor.execute( >> > "INSERT INTO table (%s) VALUES (%%s);" % (",".join(fields)), >> > *values >> > ) >> >> Thanks for the hint. However, I don't understand the syntax. >> >> I will be inserting in to postgresql

RE: apply()?

2005-12-05 Thread Ron Griswold
Just the ticket. Thank you! Ron Griswold Character TD R!OT Pictures [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Fredrik Lundh Sent: Monday, December 05, 2005 3:58 PM To: python-list@python.org Subject: Re: apply()? Ron Griswold wro

Re: PythonMagick on Windows

2005-12-05 Thread Adam Endicott
I actually did some more fiddling around with it, and I think I can do what I need with ghostscript, bypassing ImageMagick altogether. It also appears to be *much* faster. -- http://mail.python.org/mailman/listinfo/python-list

Re: Bitching about the documentation...

2005-12-05 Thread Fredrik Lundh
Grant Edwards wrote: > The correlation isn't as high as it used to be, now that hiding > behind silly nicknames has apparently become socially acceptable > in other venues (web "forums" and "boards" and whatnot). on the other hand, hanging out on web forums and boards is in it- self a good predic

Re: XML and namespaces

2005-12-05 Thread Fredrik Lundh
Alan Kennedy wrote: > [Fredrik Lundh] > > and this hypothetical situation is different from the current situation in > > exactly what way? > > Hmm, not sure I understand what you're getting at. > > If changes are made to minidom that implement non-standard behaviour, > there are two groups of peop

Memoizing decorator

2005-12-05 Thread Daishi Harada
Hi, I'm trying to find/write a memoizing decorator that works both for functions and methods. I've been looking at the following two samples: http://wiki.python.org/moin/PythonDecoratorLibrary#head-11870a08b0fa59a8622201abfac735ea47ffade5 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/32

Re: XML and namespaces

2005-12-05 Thread Alan Kennedy
[Alan Kennedy] >>On the contrary, once you start second guessing the standards and making >>guesses about what users are really trying to do, and making decisions >>for them, then some people are going to get different behaviour from >>what they rightfully expect according to the standard. People w

Re: apply()?

2005-12-05 Thread jepler
First, get the method with getattr() and then use the *-notation or apply to call it with args. getattr(obj, func_name)(*args) or apply(getattr(obj, func_name), args) Jeff pgpm38MC4TzIU.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: apply()?

2005-12-05 Thread Fredrik Lundh
Ron Griswold wrote: > I'm almost positive I've seen a function somewhere that will call a > method of an object given the method's name. Something like: > > apply(obj, "func_name", args) > > is equivalent to: > > obj.func_name(args) > > For some reason I thought this was the apply function, but th

  1   2   3   4   >