Re: list index()

2007-08-30 Thread Terry Reedy
"Marc 'BlackJack' Rintsch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | On Thu, 30 Aug 2007 17:09:36 +1000, Ben Finney wrote: | | > [EMAIL PROTECTED] writes: | > | >> What's with the index() function of lists throwing an exception on not | >> found? | > | > It's letting you know

Re: fcntl problems

2007-08-30 Thread Miles
Sorry, that last quote-only reply was accidental. :) On 8/30/07, mhearne808 wrote: > I've been doing some experiments, and here are some specific examples > to try. [snipped examples] > From these last two experiments I can only conclude that file locking > isn't doing a durned thing. > > What's

Re: fcntl problems

2007-08-30 Thread Miles
On 8/30/07, mhearne808 wrote: > I'm having a number of problems with the fcntl module. Read this first: http://linux.die.net/man/2/flock > First of all, if I try this: > file = open("counter.txt","w+") > fcntl.flock(file.fileno(), fcntl.LOCK_NB) > > I get this: > -

What's on at APL 2007, Montreal, October 21, (Tutorials) 22, 23 (Program)

2007-08-30 Thread Mike Kent
( Details and abstracts coming to the APL 2007 web page http://www.sigapl.org/apl2007.html shortly. In the meantime ... ) Tutorials and workshops Introduction to APL (Ray Polivka) OO for APLers, APL for OOers (Dan Baronet) ... others in the works Presentations

Coding Standards

2007-08-30 Thread [EMAIL PROTECTED]
'Good code' is code that works, is bug free, and is readable and maintainable. Standards need to be followed for coding. Read more... http://brsx.co.uk/SWtesting/FAQs/FAQs012.asp -- http://mail.python.org/mailman/listinfo/python-list

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Russ
> Python really isn't suitable for in-flight controls > for various > reasons, and mission critical concerns is a minor one (systems with Do you know anything about the FAA certification process for flight- critical systems? I am not an expert on it, but I know it is very expensive. If I am not m

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Russ
> I guess one difference from unit test philosophy is > that at least > sometime, you'd run the entire application with all > the dbc checks > enabled, and just live with the slowdown. Yes, that's right. You don't expect to run efficiently with the self- test checks activated, but you can test yo

Re: Symbolic Link

2007-08-30 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Ian Clark wrote: > My question would be why a symbolic link? Why not a hard link? Because of the potential for confusion. For instance, modifying the file without realizing that some other place expects to see the unmodified version. -- http://mail.python.org/mail

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Michele Simionato
On Aug 31, 3:18 am, Russ <[EMAIL PROTECTED]> wrote: > For the record, the guy I > criticized > made ridiculous assertions about DBC. And that would be me? Oh my! LOL! This is not nearly as fun as the guy who explained to Steve Holden how Python works, but still ... ;) > If you are upset about my

Re: Error handling in file generation (Pythonic way: with / decorators?)

2007-08-30 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, xavim wrote: > This should read:: > > try: > (...) > except: > os.remove(dictpath) > raise Perhaps: try : (...) except : try : os.remove(dictpath) except : pass #end t

Re: SAXParseException: not well-formed (invalid token)

2007-08-30 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Carsten Haese wrote: > If your input string contains the byte 0xe9 where your accented e is, > the file is actually latin-1 encoded. If it contains the byte sequence > 0xc3,0xa9 it is UTF-8 encoded. It is dismaying how often I come across Web pages that claim to be

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Russ
> I've always wondered... Are the compilers (or interpreters), which take > these programs to machine code, also formally proven correct? No, they are not formally proven correct (too complicated for that), but I believe they are certified to a higher level than your "typical" compiler. I think t

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Roy Smith
Carl Banks <[EMAIL PROTECTED]> wrote: > Python really isn't suitable for in-flight controls for various > reasons, and mission critical concerns is a minor one (systems with > less underlying complexity tend to have fewer failure modes). But > mostly it's raw throughput: Python is just too slow.

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Paul Rubin
Robert Brown <[EMAIL PROTECTED]> writes: > In any case, I'm still not sure whether it would be useful to integrate DbC > into Python. I guess I'm a little confused about what it would mean. Suppose you want to write a function that looks for a value using binary search in a sorted list, n = bse

Re: create Powerpoint via com

2007-08-30 Thread Alan Isaac
[EMAIL PROTECTED] wrote: > OK, creating bulleted lists, or tables, or adding pictures is all straightforward. How about chart creation (in Ppt 2003)? I do not see how to do this with Python. Thanks, Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: Code design problem

2007-08-30 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Marco Nawijn wrote: > The problem I face is that the implementation of the application class > is completely different for the local and remote case. The local case is a > straightforward implemenation using the subprocess module, the remote > case is a CORBA implem

Re: list index()

2007-08-30 Thread TheFlyingDutchman
On Aug 30, 9:06 pm, "Carsten Haese" <[EMAIL PROTECTED]> wrote: > On Thu, 30 Aug 2007 20:17:00 -0700, zzbbaadd wrote > > > Well IN was what I was looking for and would have saved this thread. > > However I don't believe IN showed up on the doc web page that has > > list methods, where I found index(

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Robert Brown
[EMAIL PROTECTED] (Alex Martelli) writes: > DbC and allegedly rigorous compile-time typechecking (regularly too weak > due to Eiffel's covariant vs countervariant approach, btw...), based on > those empirical results, appear to be way overhyped. My experience with writing Eiffel code was a bit di

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Carl Banks
On Aug 30, 9:41 pm, Paul Rubin wrote: > Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > > FWIW, the "Eiffel and SPARK Ada folks" also "brilliantly explained" > > why one can not hope to "write reliable programs" without strict > > static declarative type-checking. > > I

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Carl Banks
On Aug 30, 10:20 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > Russ <[EMAIL PROTECTED]> wrote: > >... > > > programs." Any idea how much Python is used for flight control systems > > in commercial > > transport aircraft or jet fighters? > > Are there differences in reliability requirements bet

Re: list index()

2007-08-30 Thread Carsten Haese
On Thu, 30 Aug 2007 20:06:38 -0700, zzbbaadd wrote > On Aug 30, 4:48 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > > It suddenly dawned on me that what would be best would be a contains() > > > (or IN syntax for those who can't afford to wait) for lists. > > > > > if mylist.contains("hello): >

Re: list index()

2007-08-30 Thread Carsten Haese
On Thu, 30 Aug 2007 20:17:00 -0700, zzbbaadd wrote > Well IN was what I was looking for and would have saved this thread. > However I don't believe IN showed up on the doc web page that has > list methods, where I found index(). They're not on the exact same page, but index() is in section 3.6.4

Re: list index()

2007-08-30 Thread [EMAIL PROTECTED]
On Aug 30, 9:26 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > <[EMAIL PROTECTED]> wrote: > >... > > > In my case of have done os.listdir() on two directories. I want to see > > what files are in directory A that are not in directory B. > > So why would you care about WHERE, in the listdir of B

Re: strings (dollar.cents) into floats

2007-08-30 Thread Ben Finney
Wildemar Wildenburger <[EMAIL PROTECTED]> writes: > But what use is there for floats, then? When is it OK to use them? When one is willing to sacrifice decimal precision for speed of calculation, and doesn't need the numbers to stay precise. E.g. when performing millions of calculations on real-w

Re: list index()

2007-08-30 Thread zzbbaadd
> Either I'm misunderstanding what you mean or you need to get a clue > about what Python can already do before you go around making suggestions > for what Python needs. Lists have supported "in" tests since at least > version 1.5.2: > Well IN was what I was looking for and would have saved this t

Re: Pivy problem and some other stuff

2007-08-30 Thread Scott David Daniels
Marc 'BlackJack' Rintsch wrote: A fine repy > In [57]: funcs = [a, b] > In [58]: funcs > Out[58]: [, ] > > In [59]: funcs[0]() > Out[59]: 1 > > In [60]: funcs[1]() > Out[60]: 2 and a "list comprehension" allows you to call these things no matter how long the list is. So after the above: >>

Re: list index()

2007-08-30 Thread zzbbaadd
On Aug 30, 4:48 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On 8/30/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > On Aug 30, 4:31 pm, Ben Finney <[EMAIL PROTECTED]> > > wrote: > > > [EMAIL PROTECTED] writes: > > > > In my case of have done os.listdir() on two directories. I want to

Re: list index()

2007-08-30 Thread Alex Martelli
Ricardo Aráoz <[EMAIL PROTECTED]> wrote: ... > Alex Martelli wrote: > > <[EMAIL PROTECTED]> wrote: > >... > >> In my case of have done os.listdir() on two directories. I want to see > >> what files are in directory A that are not in directory B. > > > > So why would you care about WHERE, in

Re: list index()

2007-08-30 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Ben Finney wrote: > [EMAIL PROTECTED] writes: > >> What's with the index() function of lists throwing an exception on not >> found? > > It's letting you know that the item isn't in the list. There's no > sensible return value from an "index" function in that condi

Re: list index()

2007-08-30 Thread Ricardo Aráoz
Alex Martelli wrote: > <[EMAIL PROTECTED]> wrote: >... >> In my case of have done os.listdir() on two directories. I want to see >> what files are in directory A that are not in directory B. > > So why would you care about WHERE, in the listdir of B, are to be found > the files that are in A b

Re: list index()

2007-08-30 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > In my case of have done os.listdir() on two directories. I want to see > what files are in directory A that are not in directory B. So why would you care about WHERE, in the listdir of B, are to be found the files that are in A but not B?! You should call .inde

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Ricardo Aráoz
Russ wrote: > Paul Rubin wrote: >> Bruno Desthuilliers <[EMAIL PROTECTED]> writes: >>> FWIW, the "Eiffel and SPARK Ada folks" also "brilliantly explained" >>> why one can not hope to "write reliable programs" without strict >>> static declarative type-checking. >> I don't know about Eiffel but at l

Re: beginner, idomatic python 2

2007-08-30 Thread Neil Cerutti
On 2007-08-31, bambam <[EMAIL PROTECTED]> wrote: > "Bruno Desthuilliers" > <[EMAIL PROTECTED]> wrote in > message news:[EMAIL PROTECTED] >> As a side note, in Python, inheritance ... ... should usually >> not be used for typing. > >:~( > I'm sorry, I don't even know what that means... The code I ha

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Alex Martelli
Russ <[EMAIL PROTECTED]> wrote: ... > programs." Any idea how much Python is used for flight control systems > in commercial > transport aircraft or jet fighters? Are there differences in reliability requirements between the parts of such control systems that run on aircraft themselves, and tho

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Russ
Paul Rubin wrote: > Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > > FWIW, the "Eiffel and SPARK Ada folks" also "brilliantly explained" > > why one can not hope to "write reliable programs" without strict > > static declarative type-checking. > > I don't know about Eiffel but at least an impor

Re: Important Research Project

2007-08-30 Thread Keith Thompson
"E.D.G." <[EMAIL PROTECTED]> writes: > "CBFalconer" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> "E.D.G." wrote: > >> Where is Perl described in the C standard? This seems rather OT. > > It has been my experience that a person who is an expert with one computer > language can u

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Paul Rubin
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > FWIW, the "Eiffel and SPARK Ada folks" also "brilliantly explained" > why one can not hope to "write reliable programs" without strict > static declarative type-checking. I don't know about Eiffel but at least an important subset of SPARK Ada's DBC

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Russ
> FWIW, the "Eiffel and SPARK Ada folks" also "brilliantly explained" why > one can not hope to "write reliable programs" without strict static > declarative type-checking. And they are probably right. I don't think you understand what they mean by "reliable programs." Any idea how much Python i

Re: reload(sys)

2007-08-30 Thread Steven Bethard
Sönmez Kartal wrote: > I've had an encoding issue and solved it by > "sys.setdefaultencoding('utf-8')"... > > My first try wasn't successful since setdefaultencoding is not named > when I imported sys module. After, I import sys module, I needed to > write "reload(sys)" also. > > I wonder why we

Re: Setting a read-only attribute

2007-08-30 Thread James Stroud
[EMAIL PROTECTED] wrote: > I have an object and wish to set an attribute on it which, > unfortunately for me, is read-only. > > How can I go about this? Can you simply subclass the object's class, intercept __setattr__ and __getattribute__, and spoof the read-only attribute? E.g.: class A(objec

Re: beginner, idomatic python 2

2007-08-30 Thread bambam
"Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > As a side note, in Python, inheritance ... > ... should usually not be used for typing. :~( I'm sorry, I don't even know what that means... The code I have inherited from someone only a little more knowledgeabl

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Russ
> Pre and post conditions applying to the class ? Now that's an > interesting concept. IIRC, Eiffels pre and post conditions only apply to > methods, and I fail to see how they could apply to a class. But since > you're an expert on the subject, I don't doubt you'll enlighten us ? I made a simple

Re: list index()

2007-08-30 Thread Carsten Haese
On Fri, 2007-08-31 at 12:57 +1200, Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Steve > Holden wrote: > > > But why would you want to ignore built-in support like "value in dict"? > > Because a function can be passed as a value in its own right, a built-in > construct cannot. ...

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Russ
Ryan Ginstrom wrote: > I tried using DBC for a time in C++ (using a library with a clever > assembly-language hack). I personally found it neater having such code in > unit tests, but obviously, it's a matter of preference. I agree that it ultimately boils down to preference, but as I tried to e

Re: Important Research Project

2007-08-30 Thread E.D.G.
"CBFalconer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "E.D.G." wrote: > Where is Perl described in the C standard? This seems rather OT. It has been my experience that a person who is an expert with one computer language can usually do reasonably well when working with othe

Re: beginner, idomatic python 2

2007-08-30 Thread bambam
Thank you. I'm glad to see that I don't need to choose between two opposing viewpoints :~) Steve. -- http://mail.python.org/mailman/listinfo/python-list

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Bruno Desthuilliers
Russ a écrit : >>>That looks like new syntax to me. >> >>It's the syntax for decorator functions, and it's not that new - it >>cames with Python 2.4, released November 30, 2004. > > > After looking more carefully at your example, I don't think it is as > clean and logical as the > PEP 316 syntax.

Re: list index()

2007-08-30 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steve Holden wrote: > But why would you want to ignore built-in support like "value in dict"? Because a function can be passed as a value in its own right, a built-in construct cannot. -- http://mail.python.org/mailman/listinfo/python-list

Re: Important Research Project

2007-08-30 Thread E.D.G.
"dave_w" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] My main Perl program is presently about 3500 lines of code long and 160 KB in size. So I am not too anxious to translate it into another language. The problem I am having is largely with the mechanics of linking modules to the P

Re: Python doesn't see the directories I create

2007-08-30 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Neil Cerutti wrote: > Keeping in mind which came first, isn't it at least as accurate > to attribute this problem to Python's choice of escape character? No, it's Microsoft's fault. The use of backslash as an escape character goes back to Unix systems in the early

Re: list index()

2007-08-30 Thread Carsten Haese
On Thu, 2007-08-30 at 16:42 -0700, [EMAIL PROTECTED] wrote: > It suddenly dawned on me that what would be best would be a contains() > (or IN syntax for those who can't afford to wait) for lists. Either I'm misunderstanding what you mean or you need to get a clue about what Python can already do b

Re: strings (dollar.cents) into floats

2007-08-30 Thread Robert Kern
Wildemar Wildenburger wrote: > Ben Finney wrote: >> You most likely do *not* want floating-point numbers for currency, >> since they rely on the operating system's binary floating point >> support which cannot accurately represent decimal fractions. > > I've heard (ok, read) that several times now

Re: Python doesn't see the directories I create

2007-08-30 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Marc 'BlackJack' Rintsch wrote: > Even on Unix it shouldn't be a problem on most file systems to create a > directory named 'C:' Except that some commands (e.g. scp, rsync) will interpret the colon as delimiting a host name. Also remember that, unless you write it

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Bruno Desthuilliers
Russ a écrit : > Bruno Desthuilliers wrote: > >>Russ a écrit : >> >>>On Aug 28, 10:58 pm, Michele Simionato <[EMAIL PROTECTED]> >>>wrote: >>> >>> >>> Why do you think that would ad a strong positive capability? To me at least it seems a big fat lot of over-engineering, not needed in 99

reload(sys)

2007-08-30 Thread Sönmez Kartal
Hello, I've had an encoding issue and solved it by "sys.setdefaultencoding('utf-8')"... My first try wasn't successful since setdefaultencoding is not named when I imported sys module. After, I import sys module, I needed to write "reload(sys)" also. I wonder why we need to call "reload(sys)" to

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Russ
> > That looks like new syntax to me. > > It's the syntax for decorator functions, and it's not that new - it > cames with Python 2.4, released November 30, 2004. After looking more carefully at your example, I don't think it is as clean and logical as the PEP 316 syntax. At first I thought that

RE: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Ryan Ginstrom
> On Behalf Of Russ > Once you have the conditions in place, all you need to do in > your unit tests is to send inputs to the unit and wait to see > if exceptions are thrown. That sounds a little ambitious to me... However, you may want to look at the typecheck module (you can get it via easy_i

Re: wx.DirDialog defaultPath

2007-08-30 Thread Steve Holden
Woo, Daniel wrote: > Is there some kind of parsing/checking that is done on the defaultPath? > The path I would like to set as default is something like this: > > “c:\Somedirectory\engineering\somedirectory”. When providing this as > the default, the control seems to think it is an invalid pat

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Bruno Desthuilliers
Russ a écrit : > Bruno Desthuilliers wrote: > >>Russ a écrit : >>(snip) >> >> >>>I don't see how you can avoid adding some new syntax, given that >>>Python does not >>>currently have syntax for specifying invariants and pre- and post- >>>conditions. >> >>class Parrot(object): >> @pre(lambda x :

Re: strings (dollar.cents) into floats

2007-08-30 Thread Wildemar Wildenburger
Ben Finney wrote: > You most likely do *not* want floating-point numbers for currency, > since they rely on the operating system's binary floating point > support which cannot accurately represent decimal fractions. > I've heard (ok, read) that several times now and I understand the argument. Bu

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Russ
Bruno Desthuilliers wrote: > Russ a écrit : > > On Aug 28, 10:58 pm, Michele Simionato <[EMAIL PROTECTED]> > > wrote: > > > > > >>Why do you think that would ad a strong positive capability? > >>To me at least it seems a big fat lot of over-engineering, not > >>needed in 99% of programs. In the re

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Chris Mellon
On 8/30/07, Russ <[EMAIL PROTECTED]> wrote: > > Bruno Desthuilliers wrote: > > Russ a écrit : > > (snip) > > > > > I don't see how you can avoid adding some new syntax, given that > > > Python does not > > > currently have syntax for specifying invariants and pre- and post- > > > conditions. > > >

Automation and scheduling of front page publishing using python

2007-08-30 Thread [EMAIL PROTECTED]
Good afternoon, We have numerous web sites which are currently being manually published via Front Page. Doing one or two sites on an ad-hoc basis was not too bad but we are now over 20 or thirty at set times during a business day. What I would love to do is find a way of automating this task, id

Re: list index()

2007-08-30 Thread Chris Mellon
On 8/30/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Aug 30, 4:31 pm, Ben Finney <[EMAIL PROTECTED]> > wrote: > > [EMAIL PROTECTED] writes: > > > In my case of have done os.listdir() on two directories. I want to see > > > what files are in directory A that are not in directory B. > > > >

Re: list index()

2007-08-30 Thread zzbbaadd
On Aug 30, 4:31 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] writes: > > In my case of have done os.listdir() on two directories. I want to see > > what files are in directory A that are not in directory B. > > You get that information unambiguously. It's an exceptional case, > sin

Re: strings (dollar.cents) into floats

2007-08-30 Thread Ben Finney
luca bertini <[EMAIL PROTECTED]> writes: > i have strings which look like money values (ie 34.45) > is there a way to convert them into float variables? You most likely do *not* want floating-point numbers for currency, since they rely on the operating system's binary floating point support which

Re: list index()

2007-08-30 Thread zzbbaadd
On Aug 30, 4:28 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] writes: > > On Aug 30, 12:09 am, Ben Finney <[EMAIL PROTECTED]> > > wrote: > > > It's letting you know that the item isn't in the list. There's no > > > sensible return value from an "index" function in that condition. >

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Russ
Bruno Desthuilliers wrote: > Russ a écrit : > (snip) > > > I don't see how you can avoid adding some new syntax, given that > > Python does not > > currently have syntax for specifying invariants and pre- and post- > > conditions. > > class Parrot(object): >@pre(lambda x : x != 42) >@post(

Re: list index()

2007-08-30 Thread Ben Finney
[EMAIL PROTECTED] writes: > In my case of have done os.listdir() on two directories. I want to see > what files are in directory A that are not in directory B. You get that information unambiguously. It's an exceptional case, since there's no index to return, so it throws an exception. > I have

Re: list index()

2007-08-30 Thread Ben Finney
[EMAIL PROTECTED] writes: > On Aug 30, 12:09 am, Ben Finney <[EMAIL PROTECTED]> > wrote: > > It's letting you know that the item isn't in the list. There's no > > sensible return value from an "index" function in that condition. > > for str: > find( sub[, start[, end]]) > [...] > Return -

Re: Registering a python function in C

2007-08-30 Thread Matimus
On Aug 30, 2:21 pm, fernando <[EMAIL PROTECTED]> wrote: > Could someone post an example on how to register a python function as > a callback in a C function? It expects a pointer to PyObject... how do > I expose that? Basically, the signature of the function is > foo(PyObject* obj), where obj is th

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Bruno Desthuilliers
Russ a écrit : > On Aug 28, 10:58 pm, Michele Simionato <[EMAIL PROTECTED]> > wrote: > > >>Why do you think that would ad a strong positive capability? >>To me at least it seems a big fat lot of over-engineering, not >>needed in 99% of programs. In the remaining 1%, it would still not >>be needed

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Bruno Desthuilliers
Russ a écrit : (snip) > I don't see how you can avoid adding some new syntax, given that > Python does not > currently have syntax for specifying invariants and pre- and post- > conditions. class Parrot(object): @pre(lambda x : x != 42) @post(lambda result: result != 42) @invariant(lamb

Re: fcntl problems

2007-08-30 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
On Aug 30, 4:19 pm, "mhearne808[insert-at-sign-here]gmail[insert-dot- here]com" <[EMAIL PROTECTED]> wrote: > I'm having a number of problems with the fcntl module. First off, my > system info: > > Mac OS X > Darwin igskcicglthearn.cr.usgs.gov 8.10.1 Darwin Kernel Version > 8.10.1: Wed May 23 16:33

Re: Python weather application

2007-08-30 Thread Zentrader
On Aug 30, 12:45 pm, seancron <[EMAIL PROTECTED]> wrote: > Does anybody have any suggestions for getting started on desigining a > desktop weather application in Python? > > I've been looking for access to weather data and while I have found > several including the weather.com service I've decided

Re: We need PIGs :)

2007-08-30 Thread Bruno Desthuilliers
Martin Marcher a écrit : > Hello, > > having worked quite a bit with python in the last months (some Java > before, and some C++ before that) I was very impressed by an idea the > Java people had. > > Explanation: the JSRs define how to implement certain services and or > features in Java so that

Re: pure python for sms

2007-08-30 Thread Neil Hodgson
Gerardo Herzig: > Hi dudes. Im looking for a python implementation for sending sms to a > cell phone. I was try using some free pages, but i want to use a python. > Do i need a cellphone conected to my machine? Or can i send sms to some > cell via some python library? This is likely to cos

Re: python + gcov

2007-08-30 Thread Gerhard Häring
[EMAIL PROTECTED] wrote: > [...] Do I need to make a static extension of my imported module to profile > it ? I always bit the bullet and finally just did that. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list

fcntl problems

2007-08-30 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
I'm having a number of problems with the fcntl module. First off, my system info: Mac OS X Darwin igskcicglthearn.cr.usgs.gov 8.10.1 Darwin Kernel Version 8.10.1: Wed May 23 16:33:00 PDT 2007; root:xnu-792.22.5~1/RELEASE_I386 i386 i386 Python 2.5.1 (built from source) OK, the weirdness: First o

Re: Simple elementtree question

2007-08-30 Thread IamIan
Thank you very much! That did it. In the source XML tags have rdf:about attributes with the link to the story, and it was here I planned on grabbing the link and matching it up with the child text. After seeing the output of elmenttree's getiterator() though, it now looks like each item, title,

Re: status of Programming by Contract (PEP 316)?

2007-08-30 Thread Russ
> Things get vetted *before* they get added to the core, not after. I realize that. I meant that it would get vetted in the process of putting it into the core. That would provide more confidence that it was done the best possible way -- or close to it. -- http://mail.python.org/mailman/listinf

Re: Python doesn't see the directories I create

2007-08-30 Thread Bruno Desthuilliers
Marc 'BlackJack' Rintsch a écrit : > On Thu, 30 Aug 2007 07:28:52 -0400, Steve Holden wrote: > > >>Bruno Desthuilliers wrote: >> >>>Steve Holden a écrit : >>>Indeed. But I doubt a path starting with 'C:' will work fine on a >>>unix-like environment anyway !-) >> >>Just to be contrarian: >> >>[EM

Re: Setting a read-only attribute

2007-08-30 Thread Gerardo Herzig
[EMAIL PROTECTED] wrote: >I have an object and wish to set an attribute on it which, >unfortunately for me, is read-only. > >How can I go about this? > >Cheers. >-T > > > I guess we all need an code example to show us the way 'read only' is implemented. If you cant access to the class wich you

wx.DirDialog defaultPath

2007-08-30 Thread Woo, Daniel
Is there some kind of parsing/checking that is done on the defaultPath? The path I would like to set as default is something like this: "c:\Somedirectory\engineering\somedirectory". When providing this as the default, the control seems to think it is an invalid path, although it IS a valid path

Re: Pivy problem and some other stuff

2007-08-30 Thread Bruno Desthuilliers
azrael a écrit : > Hy Guys > > Did anyone manage to install and use Pivy. I'm trying it and cant come > closer to the goal I get the message: > Please set the COIN3DDIR environment variable to your Coin root > directory! ** Aborting ** > > Familiar to anyone? > I don't even know what Pivy is, bu

Re: Setting a read-only attribute

2007-08-30 Thread Wildemar Wildenburger
Arnaud Delobelle wrote: > On Aug 30, 10:35 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: >> I have an object and wish to set an attribute on it which, >> unfortunately for me, is read-only. > > If it's read-only then you can't set it! > >> How can I go about this? > > Joke aside, I think

Re: Creating a multi-tier client/server application

2007-08-30 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : (snip) > We have found the object-relationship managers Actually, ORM stands for "object-relational mapper" > to be bloated > and unruly. Which ones ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Setting a read-only attribute

2007-08-30 Thread Arnaud Delobelle
On Aug 30, 10:35 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have an object and wish to set an attribute on it which, > unfortunately for me, is read-only. If it's read-only then you can't set it! > How can I go about this? Joke aside, I think you need to be more specific. -- Arnaud

Setting a read-only attribute

2007-08-30 Thread [EMAIL PROTECTED]
I have an object and wish to set an attribute on it which, unfortunately for me, is read-only. How can I go about this? Cheers. -T -- http://mail.python.org/mailman/listinfo/python-list

Re: create Powerpoint via com

2007-08-30 Thread Alan Isaac
[EMAIL PROTECTED] wrote: > Hope that helps! Yes indeed. Thanks! Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: Unzip: Memory Error

2007-08-30 Thread David Bolen
I wrote: > Here's a small example of a ZipFile subclass (tested a bit this time) > that implements two generator methods: Argh, not quite tested enough - one fix needed, change: if bytes[-1] not in ('\n', '\r'): partial = lines.pop() to: if bytes[-1] not

Re: Important Research Project

2007-08-30 Thread ArarghMail708NOSPAM
On Thu, 30 Aug 2007 09:45:50 -0400, CBFalconer <[EMAIL PROTECTED]> wrote: >"E.D.G." wrote: >> >> This report is being posted to a number of Internet Newsgroups to >> see if there are any experienced computer programmers who would >> like to provide some assistance with an effort to develop a Perl

Re: Please assist- Python Consultant needed for 3-6 month project

2007-08-30 Thread Alan Meyer
On Aug 30, 12:06 pm, "Kelley McNeillie" <[EMAIL PROTECTED]> wrote: > ... We are looking for a python developer with web-based > application experience. ... I am finding this skill pretty much > impossible to identify locally ... Kelley, I don't know if your client is willing to pay for a week o

Registering a python function in C

2007-08-30 Thread fernando
Could someone post an example on how to register a python function as a callback in a C function? It expects a pointer to PyObject... how do I expose that? Basically, the signature of the function is foo(PyObject* obj), where obj is the callback function... It's not exactly extending or embedding,

Re: How to use os.putenv() ?

2007-08-30 Thread T
Thank you everyone! -- http://mail.python.org/mailman/listinfo/python-list

Re: subclassing Python types

2007-08-30 Thread Steve Holden
Arnaud Delobelle wrote: > On Aug 30, 8:44 pm, Robert Kern <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote: >>> So it's: >>> class MyString(str): >>>def __init__(self,strInput): >>> self = strInput >> That doesn't quite work. Assigning to "self" only reassigns the name inside >> the

Re: Unzip: Memory Error

2007-08-30 Thread David Bolen
David Bolen <[EMAIL PROTECTED]> writes: > If you are going to read the file data incrementally from the zip file > (which is what my other post provided) you'll prevent the huge memory > allocations and risk of running out of resource, but would have to > implement your own line ending support if

Re: Biased random?

2007-08-30 Thread Mark Dickinson
> One possible fix: do > > x = randint(0, 10) - randint(0, 10) > x = abs(x) - (x<0) > > This collapses -1 and 0 to 0, -2 and 1 to 1, etc. Or a slightly simpler formula that ends up producing the same distribution: x = min(randint(0, 10), randint(0, 10)) Mark -- http://mail.python.org/mail

Re: Is LOAD_GLOBAL really that slow?

2007-08-30 Thread Chris Mellon
On 8/30/07, Rhamphoryncus <[EMAIL PROTECTED]> wrote: > On Aug 30, 12:04 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > On 8/30/07, Rhamphoryncus <[EMAIL PROTECTED]> wrote: > > > > > On Aug 29, 8:33 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > > > > On Wed, 2007-08-29 at 19:23 -0600, Adam Olsen

Re: Biased random?

2007-08-30 Thread Robert Kern
Ivan Voras wrote: > Jeffrey Barish wrote: > >> If you take the difference between two uniformly distributed random >> variables, the probability density function forms an isosceles triangle >> centered at 0. Take the absolute value of that variable and the pdf is a >> straight line with maximum v

  1   2   3   >