Re: comments? storing a function in an object

2009-07-20 Thread Gabriel Genellina
En Mon, 20 Jul 2009 22:53:59 -0300, Esmail escribió: Gabriel Genellina wrote: > If you follow the above suggestions, you'll see that your Function class becomes almost useless: a normal function already IS an object, so you don't have to wrap it inside ANOTHER object unless you need very

Re: Why aren't OrderedDicts comparable with < etc?

2009-07-20 Thread Jack Diederich
On Mon, Jul 20, 2009 at 10:00 AM, Steven D'Aprano wrote: > On Mon, 20 Jul 2009 09:34:24 +, Sion Arrowsmith wrote: > >> Terry Reedy   wrote: >>>Sion Arrowsmith wrote: Jack Diederich   wrote: > It isn't an OrderedDict thing, it is a comparison thing.  Two regular > dicts also raise a

python function for retrieving key and encryption

2009-07-20 Thread jayshree
M2Crypto package not showing the 'recipient_public_key.pem' file at linux terminal .how do i get/connect with recipient public key. exactly i need to check how can i open this file through linux commands. import M2Crypto def encrypt(): recip = M2Crypto.RSA.load_pub_key(open ('recipient_public_key

Re: comments? storing a function in an object

2009-07-20 Thread I V
On Mon, 20 Jul 2009 21:53:59 -0400, Esmail wrote: > In general I would agree with you, but in my specific case I want so > store some additional meta-data with each function, such as the valid > range for input values, where the max or minimum are located, the > name/source for the function etc. I

Re: any suggestions to synchronize typed text and speech ?

2009-07-20 Thread Che M
On Jul 19, 4:15 pm, Stef Mientki wrote: > hello, > > I'm using Scintilla as a wxPython widget with great pleasure. > I now have an application where I want to make notes during a conversation, > but also want to record the speech during that conversation. > I'm using Scintilla as a wxPython widget

Re: ignore special characters in python regex

2009-07-20 Thread John Machin
On Jul 21, 3:02 pm, Astan Chee wrote: > Hi, > I'm reading text from a file (per line) and I want to do a regex using > these lines but I want the regex to ignore any special characters and > treat them like normal strings. > Is there a regex function that can do this? It would help if you were to

Re: clean way prepend an element to a numpy array

2009-07-20 Thread bdb112
On Jul 21, 2:13 pm, Ben Finney wrote: > bdb112 writes: > > If I want to add an element at the beginning of an array, it seems > > like I must make a list, insert in place, then make an array again. > > The NumPy ‘ndarray’ type (which is what you get by default from the > ‘array’ factory function)

Re: ignore special characters in python regex

2009-07-20 Thread Frank Buss
Astan Chee wrote: > I'm reading text from a file (per line) and I want to do a regex using > these lines but I want the regex to ignore any special characters and > treat them like normal strings. > Is there a regex function that can do this? Maybe re.escape helps? -- Frank Buss, f...@frank-b

C-API, tp_dictoffset vs tp_members

2009-07-20 Thread Ulrich Eckhardt
Hi! When would I use PyObject_SetAttrString/tp_dictoffset instead of tp_members? I have a predefined set of members, some of which are optional. The problem I had with an embedded dictionary was that I can't see its elements using "dir()". Now I just converted to using tp_members, and it still

Re: any suggestions to synchronize typed text and speech ?

2009-07-20 Thread Frank Buss
Stef Mientki wrote: > Here the problem part: > I need to synchronize the typed text with the sound during playback. > So if I click somewhere in the sound recording, > the line of text, typed that moment should be highlighted. > And vise versa, if the cursor in the text is moved and some special k

ignore special characters in python regex

2009-07-20 Thread Astan Chee
Hi, I'm reading text from a file (per line) and I want to do a regex using these lines but I want the regex to ignore any special characters and treat them like normal strings. Is there a regex function that can do this? Here is what I have so far: fp = open('file.txt','r') notes = fp.readlines

Re: If Scheme is so good why MIT drops it?

2009-07-20 Thread Frank Buss
Scott Burson wrote: > Have you looked at ECL? > > http://ecls.sourceforge.net/ > > I've used it only a little, so I can't vouch for its stability, but it > fits the threading and license requirements (well, some corporate > lawyers have trouble with the LGPL, but I think it's usable). I didn't

Re: Mechanize not recognized by py2exe

2009-07-20 Thread OrcaSoul
Gabriel Genellina-7 wrote: > > En Fri, 17 Jul 2009 15:51:11 -0300, Stephen M. Olds > escribió: > >> I have a Python script getData.py that uses Mechanize, and runs fine >> under the >> interpreter. It was installed using easy_install - and the install >> seemed to >> indicate it was comp

Re: clean way prepend an element to a numpy array

2009-07-20 Thread Ben Finney
bdb112 writes: > If I want to add an element at the beginning of an array, it seems > like I must make a list, insert in place, then make an array again. The NumPy ‘ndarray’ type (which is what you get by default from the ‘array’ factory function) is a far more complex type than (and is not deri

clean way prepend an element to a numpy array

2009-07-20 Thread bdb112
If I want to add an element at the beginning of an array, it seems like I must make a list, insert in place, then make an array again. Of course, lists can be efficient too, and the insert() funtion works nicely in that case, but sometimes arrays are the best choice e.g. x=array([1,2,3]) # to put

Re: comments? storing a function in an object

2009-07-20 Thread Carl Banks
On Jul 20, 9:22 am, Esmail wrote: > def funct1(x): >      ''' small test function ''' >      return x * x > > def funct2(x, y): >      ''' small test function ''' >      return x + y > > def funct3(x): >      ''' small test function ''' >      return 1000 + (x*x + x) * math.cos(x) > > def main():

Re: are user defined classes hashable?

2009-07-20 Thread Aahz
In article <373d6c69-6965-4a88-bdd2-8028ef850...@k6g2000yqn.googlegroups.com>, Hyuga wrote: > >Regardless, Nicolas's example can be applied to the class too: > class Foo(object): > pass > hash(Foo) >11443104 id(Foo) >11443104 > >class objects are just objects of type 'type'.

Re: missing 'xor' Boolean operator

2009-07-20 Thread Ethan Furman
[fixed for bottom-posting] Dr. Phillip M. Feldman wrote: MRAB-2 wrote: What values should 'xor' return? IMHO, if only one of the values is true then it should return that value, otherwise it should return False. 1 xor 0 => 1 0 xor 2 => 2 1 xor 2 => False 0 xor 0 => False T

Re: comments? storing a function in an object

2009-07-20 Thread Esmail
Hi Francesco, Those were great suggestions! Re 1: I used the __doc__ attribute to eliminate the parameter in the constructor as you suggested. Also, much easier to specify the character string with the actual function than later to match it up like I was. class Function(object

Re: tough-to-explain Python

2009-07-20 Thread Paul Rubin
Simon Forman writes: > But I'm glad it's there to study, these are wheels I don't have to > invent for myself. http://dwheeler.com/essays/high-assurance-floss.html might be an interesting place to start. -- http://mail.python.org/mailman/listinfo/python-list

Re: comments? storing a function in an object

2009-07-20 Thread Esmail
Gabriel Genellina wrote: > If you follow the above suggestions, you'll see that your Function class becomes almost useless: a normal function already IS an object, so you don't have to wrap it inside ANOTHER object unless you need very special features. Hello Gabriel, In general I would agre

Re: JavaScript toolkits (was Re: ANN: Porcupine Web Application Server 0.6 is released!)

2009-07-20 Thread D'Arcy J.M. Cain
On 20 Jul 2009 17:10:55 -0700 a...@pythoncraft.com (Aahz) wrote: > >I understand what you want but I can't see how a toolkit can do that. > >How do you program "graceful?" It seems pretty application specific. > > Presumably the JS toolkit generates both code and HTML. Actions that > normally ge

Re: tough-to-explain Python

2009-07-20 Thread Simon Forman
On Jul 20, 4:00 am, greg wrote: > Calroc wrote: > > It may be that flawless software is an unreachable asymptote, like the > > speed of light for matter, but I'm (recently!) convinced that it's a > > goal worthy of exploration and effort. > > Seems to me that once you get beyond the toy program >

Re: tough-to-explain Python

2009-07-20 Thread Simon Forman
On Jul 19, 2:51 pm, Paul Rubin wrote: > Calroc writes: > > I'm engaged presently in starting a school to teach programming from > > the ground up, based roughly on the curriculum outlined in the article > > I mentioned. ... > > I'm excited about formal methods becaus

Re: Design question.

2009-07-20 Thread Dave Angel
Lacrima wrote: On Jul 20, 4:05 pm, Jean-Michel Pichavant wrote: Lacrima wrote: Hello! I am newbie in python and I have really simple question, but I need your advice to know how to do best. I need to store a number of dictionaries in certain place. I've decided to store them in

Re: locale doesn' format

2009-07-20 Thread Дамјан Георгиевски
>> I want to format values to the german form eg. 1.034,56 but >> locale.format() doesn't work for me. > > seems to work here In 2.6 this is good too: >>> import decimal, locale >>> locale.setlocale(locale.LC_ALL, 'mk_MK.UTF-8') >>> '{0:n}'.format(1234.56) '1 234,56' -- дамјан ( http://soft

Re: locale doesn' format

2009-07-20 Thread Дамјан Георгиевски
> I want to format values to the german form eg. 1.034,56 but > locale.format() doesn't work for me. seems to work here >>> import decimal, locale >>> locale.setlocale(locale.LC_ALL, 'mk_MK.UTF-8') 'mk_MK.UTF-8' >>> locale.localeconv()['grouping'] [3, 3, 0] >>> locale.localeconv()['thousands_sep

Re: JavaScript toolkits (was Re: ANN: Porcupine Web Application Server 0.6 is released!)

2009-07-20 Thread Aahz
In article , D'Arcy J.M. Cain wrote: >On 20 Jul 2009 09:00:33 -0700 >a...@pythoncraft.com (Aahz) wrote: >> >> Out of curiosity, are there any JavaScript toolkits that generate code >> that degrades gracefully when JavaScript is disabled? > >I understand what you want but I can't see how a toolkit

Re: Help understanding the decisions *behind* python?

2009-07-20 Thread Piet van Oostrum
> Paul Moore (PM) wrote: >PM> 2009/7/20 Chris Rebert : >>> On Mon, Jul 20, 2009 at 2:23 PM, Piet van Oostrum wrote: > x = [2,1,3] > print sorted(x)[0] >DB> 3 What kind of Python produces that? >>> >>> Assuming you're referring to the latter example, it was added in

Re: Help understanding the decisions *behind* python?

2009-07-20 Thread Hrvoje Niksic
Chris Rebert writes: >>> x = [2,1,3] >>> print sorted(x)[0] >>>DB> 3 >> >> What kind of Python produces that? > > Assuming you're referring to the latter example, it was added in version 2.4 > If you meant the former example, I think that's purely pseudo-Python. sorted([2, 1, 3])[0] eval

Re: Help understanding the decisions *behind* python?

2009-07-20 Thread Hrvoje Niksic
Phillip B Oldham writes: > On Jul 20, 6:08 pm, Duncan Booth wrote: >> The main reason why you need both lists and tuples is that because a tuple >> of immutable objects is itself immutable you can use it as a dictionary >> key. > > Really? That sounds interesting, although I can't think of any r

Re: Help understanding the decisions *behind* python?

2009-07-20 Thread Christian Heimes
Niels L. Ellegaard wrote: > Phillip B Oldham writes: > >> We often find we need to do manipulations like the above without >> changing the order of the original list, and languages like JS allow >> this. We can't work out how to do this in python though, other than >> duplicating the list, sortin

Re: Compilation problem with Python < 2.6 and db >= 4.7

2009-07-20 Thread kiorky
Martin v. Löwis a écrit : >> Is there a way to make the bsddb module compile against db>=4.7 for python < >> 2.6 >> (2.4.6, 2.5.4)? > > I don't think so, no. > >> I didn't find something on it. > > If you don't want to use pybsddb either, for fear of incompatible API, > your only choice is to p

Re: If Scheme is so good why MIT drops it?

2009-07-20 Thread vippstar
On Jul 21, 1:22 am, Paul Rubin wrote: > vippstar writes: > > > I don't see how to implement such a thing in my code, > > Write a function: > > >   (if (< x y) > >       ValueError > >       (/ x y)) > > I meant changing the behavior of integer division in python. You

Re: Compilation problem with Python < 2.6 and db >= 4.7

2009-07-20 Thread Martin v. Löwis
> Is there a way to make the bsddb module compile against db>=4.7 for python < > 2.6 > (2.4.6, 2.5.4)? I don't think so, no. > I didn't find something on it. If you don't want to use pybsddb either, for fear of incompatible API, your only choice is to port _bsddb.c to the newer db versions. BSD

Re: Help understanding the decisions *behind* python?

2009-07-20 Thread Niels L. Ellegaard
Phillip B Oldham writes: > We often find we need to do manipulations like the above without > changing the order of the original list, and languages like JS allow > this. We can't work out how to do this in python though, other than > duplicating the list, sorting, reversing, then discarding. If

Re: If Scheme is so good why MIT drops it?

2009-07-20 Thread Paul Rubin
vippstar writes: > > I don't see how to implement such a thing in my code, > Write a function: > > (if (< x y) > ValueError > (/ x y)) I meant changing the behavior of integer division in python. > Wouldn't that mean 3/2 would also evaluate to ValueError? Yes, the idea was that o

Re: Python Essential Reference, 4th Edition - Now Available!

2009-07-20 Thread Jonathan Corbet
On Sun, 19 Jul 2009 11:03:05 -0500 David Beazley wrote: > I'm pleased to announce the release of the Python Essential Reference, > 4th edition, now available at a bookstore near you. More than a year > in development, this edition covers Python 2.6, Python 3, and a wide > variety of new library m

Re: If Scheme is so good why MIT drops it?

2009-07-20 Thread Scott Burson
On Jul 19, 11:31 am, Frank Buss wrote: > I don't know of a free modern and stable Lisp implementation with > mulithreading support for Windows, with a licence with which you can use it > in closed source commercial programs Have you looked at ECL? http://ecls.sourceforge.net/ I've used it only

Re: locale doesn' format

2009-07-20 Thread Jerry Hill
On Mon, Jul 20, 2009 at 5:07 PM, Egon Frerich wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > I want to format values to the german form eg. 1.034,56 but > locale.format() doesn't work for me. > > Here is a little test program: ... > k1 = locale.format_string('%12s',k,True) I don't th

Re: Auto-generate GUI from a database table structure

2009-07-20 Thread Gabriel Genellina
En Mon, 20 Jul 2009 12:09:47 -0300, Boyd, Craig1 escribió: I am trying to write a couple screens to update three or four database tables on Oracle 10g and I was wondering if there was a way to automatically generate some kind of GUI shell based on the tables that I could then fill in wi

Re: any suggestions to synchronize typed text and speech ?

2009-07-20 Thread Aahz
In article , Stef Mientki wrote: > >I was afraid of that too, so I dropped the question in several places, >and the writer of Scintilla himself came with the perfect answer. ...which was?... -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "The volume of a pizza

Re: How to import pydoc and then use it?

2009-07-20 Thread Albert Hopkins
On Mon, 2009-07-20 at 13:38 -0700, mrstevegross wrote: > I know how to use pydoc from the command line. However, because of > complicated environmental setup, it would be preferable to run it > within a python script as a native API call. That is, my python runner > looks a bit like this: > > im

Re: Help understanding the decisions *behind* python?

2009-07-20 Thread Paul Moore
2009/7/20 Chris Rebert : > On Mon, Jul 20, 2009 at 2:23 PM, Piet van Oostrum wrote: >>> x = [2,1,3] >>> print sorted(x)[0] >>>DB> 3 >> >> What kind of Python produces that? > > Assuming you're referring to the latter example, it was added in version 2.4 > If you meant the former example, I

Re: comments? storing a function in an object

2009-07-20 Thread Gabriel Genellina
En Mon, 20 Jul 2009 14:44:16 -0300, Francesco Bochicchio escribió: On Jul 20, 6:22 pm, Esmail wrote: Hello all, I am trying to store a function and some associated information in an object so that I can later have series of functions in a list that I can evaluate one at a time. Right now

Re: Help understanding the decisions *behind* python?

2009-07-20 Thread Chris Rebert
On Mon, Jul 20, 2009 at 2:23 PM, Piet van Oostrum wrote: >> Duncan Booth (DB) wrote: > >>DB> Phillip B Oldham wrote: This make a lot more sense to us, and follows the convention from other languages. It would also mean chaining methods to manipulate lists would be easier:

Re: Help understanding the decisions *behind* python?

2009-07-20 Thread Piet van Oostrum
> Duncan Booth (DB) wrote: >DB> Phillip B Oldham wrote: >>> This make a lot more sense to us, and follows the convention from >>> other languages. It would also mean chaining methods to manipulate >>> lists would be easier: >>> >> x = [2,1,3] >> print x.sort()[0] >>> 3 >> print

locale doesn' format

2009-07-20 Thread Egon Frerich
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I want to format values to the german form eg. 1.034,56 but locale.format() doesn't work for me. Here is a little test program: import decimal, locale print locale.getdefaultlocale() print locale.localeconv() locale.setlocale(locale.LC_ALL, ('de_DE

Re: ANN: Shed Skin 0.2, an experimental (restricted) Python-to-C++ compiler

2009-07-20 Thread James Matthews
I like this, I am going to run this as a test. I also want to see the source code on how they compile the dynamic variables. On Mon, Jul 20, 2009 at 10:20 PM, srepmub wrote: > > > Nice timings, can you please show me the Python, Java and C code > > versions? I may do more tests. > > also, which

How to import pydoc and then use it?

2009-07-20 Thread mrstevegross
I know how to use pydoc from the command line. However, because of complicated environmental setup, it would be preferable to run it within a python script as a native API call. That is, my python runner looks a bit like this: import pydoc pydoc.generate_html_docs_for(someFile) However, it's

Re: Help understanding the decisions *behind* python?

2009-07-20 Thread J. Cliff Dyer
On Mon, 2009-07-20 at 12:26 -0700, Phillip B Oldham wrote: > On Jul 20, 6:08 pm, Duncan Booth wrote: > > The main reason why you need both lists and tuples is that because a tuple > > of immutable objects is itself immutable you can use it as a dictionary > > key. > > Really? That sounds interest

Re: Help understanding the decisions *behind* python?

2009-07-20 Thread Marcus Wanner
On 7/20/2009 3:26 PM, Phillip B Oldham wrote: On Jul 20, 6:08 pm, Duncan Booth wrote: The main reason why you need both lists and tuples is that because a tuple of immutable objects is itself immutable you can use it as a dictionary key. Really? That sounds interesting, although I can't think

Re: Help understanding the decisions *behind* python?

2009-07-20 Thread Duncan Booth
Phillip B Oldham wrote: > On Jul 20, 6:08 pm, Duncan Booth wrote: >> The main reason why you need both lists and tuples is that because a >> tuple of immutable objects is itself immutable you can use it as a >> dictionary key. > > Really? That sounds interesting, although I can't think of any r

Re: Help understanding the decisions *behind* python?

2009-07-20 Thread Phillip B Oldham
On Jul 20, 6:08 pm, Duncan Booth wrote: > The main reason why you need both lists and tuples is that because a tuple > of immutable objects is itself immutable you can use it as a dictionary > key. Really? That sounds interesting, although I can't think of any real- world cases where you'd use so

Re: ANN: Shed Skin 0.2, an experimental (restricted) Python-to-C++ compiler

2009-07-20 Thread srepmub
> Nice timings, can you please show me the Python, Java and C code > versions? I may do more tests. also, which shedskin options did you use? did you use -bw, to disable bounds and wrap-around checking? this can make quite a difference for code that does a lot of indexing. if the code uses random

Re: ANN: Shed Skin 0.2, an experimental (restricted) Python-to-C++ compiler

2009-07-20 Thread Bearophile
Skip Montanaro: > I read just enough French to know that "avec" means "with", but I don't > understand the difference between "avec malloc *int" and "avec []".  Can you > explain please? Maybe it's the time difference between using a Python list from Cython and using a C "array" allocated with a m

Re: If Scheme is so good why MIT drops it?

2009-07-20 Thread vippstar
On Jul 20, 7:50 pm, Paul Rubin wrote: > vippstar writes: > > > I wonder whether 2/3 => ValueError is preferable. > > > Not all software wants this. It shouldn't be part of the language but > > rather part of your code if you need such a feature. (for instance, to > >

Re: ANN: Shed Skin 0.2, an experimental (restricted) Python-to-C++ compiler

2009-07-20 Thread skip
William> c 5s William> gcj 7s William> java 7s William> shedskin 8s William> python + psyco 18s William> cython avec malloc *int 18s William> cython 55s avec [] python William> python 303s (5m3s) I read just enough French to know that "avec" means "with", but I don

Compilation problem with Python < 2.6 and db >= 4.7

2009-07-20 Thread kiorky
Is there a way to make the bsddb module compile against db>=4.7 for python < 2.6 (2.4.6, 2.5.4)? A patch ? A tip ? For the moment, i have a known failure as: gcc -pthread -fno-strict-aliasing -DNDEBUG -I/usr/home/kiorky/minitage/dependencies/readline-5.2/parts/part/include -I/usr/home/kiorky/minit

Re: Help understanding the decisions *behind* python?

2009-07-20 Thread Anthony Tolle
On Jul 20, 12:27 pm, Phillip B Oldham wrote: > ... > Specifically the "differences" between lists and tuples have us > confused and have caused many "discussions" in the office. We > understand that lists are mutable and tuples are not, but we're a > little lost as to why the two were kept separat

Re: Problem when applying Patch from issue1424152 to get https over authenticating proxies working with urllib2 in Python 2.5

2009-07-20 Thread tvashtar
On Jul 20, 4:42 pm, Nike wrote: > hi! >  It's looks like a ssl error . Under the following step to help u : >   1. takes a simple code to confirm your pupose without ssl protocol. >   2. to confirm python version and extended libs work well >   3. to confirm ssl work well. > > goog luck! > > nikek

Re: On out-of-date Python Applications

2009-07-20 Thread David Robinow
On Mon, Jul 20, 2009 at 12:09 PM, Virgil Stokes wrote: > David Robinow wrote: > > On Mon, Jul 20, 2009 at 7:24 AM, John Machin wrote: > ... > > > The next step would be to try to compile ODE 0.7 or 0.8 with VS9 -- > however this would require "project files" for ODE for VS9, and there > aren't any

Re: comments? storing a function in an object

2009-07-20 Thread Francesco Bochicchio
On Jul 20, 6:22 pm, Esmail wrote: > Hello all, > > I am trying to store a function and some associated information in an > object so that I can later have series of functions in a list that I can > evaluate one at a time. > > Right now I am only storing the function itself, the number of > argumen

Re: Design question.

2009-07-20 Thread Marcus Wanner
On 7/20/2009 9:42 AM, Lacrima wrote: On Jul 20, 4:05 pm, Jean-Michel Pichavant wrote: Lacrima wrote: Hello! I am newbie in python and I have really simple question, but I need your advice to know how to do best. I need to store a number of dictionaries in certain place. I've decided to store t

Re: win32api install problem

2009-07-20 Thread MCIPERF
On Jul 20, 9:57 am, Tim Golden wrote: > Gerry wrote: > > I'm running Python 2.6 under XP. > > > I've installed Windows 32 extensions for Python 2.6 version 1.4 > > (pywin32-214.win32-py2.6.exe). > > > But If I try to import win32api, I get: > > >   File "C:\python_projects\euler\driveletters.py",

Re: Help understanding the decisions *behind* python?

2009-07-20 Thread Michiel Overtoom
Phillip wrote: Specifically the "differences" between lists and tuples have us confused and have caused many "discussions" in the office. We understand that lists are mutable and tuples are not, but we're a little lost as to why the two were kept separate from the start. They both perform a very

Re: any suggestions to synchronize typed text and speech ?

2009-07-20 Thread Marcus Wanner
On 7/20/2009 5:34 AM, Stef Mientki wrote: thanks Marcus, Marcus Wanner wrote: On 7/19/2009 4:15 PM, Stef Mientki wrote: hello, I'm using Scintilla as a wxPython widget with great pleasure. I now have an application where I want to make notes during a conversation, but also want to record th

Re: Help understanding the decisions *behind* python?

2009-07-20 Thread Duncan Booth
Phillip B Oldham wrote: > This make a lot more sense to us, and follows the convention from > other languages. It would also mean chaining methods to manipulate > lists would be easier: > x = [2,1,3] print x.sort()[0] > 3 print x > [2,1,3] You already have a way to do what you wa

Re: If Scheme is so good why MIT drops it?

2009-07-20 Thread Marcus Wanner
On 7/20/2009 2:13 AM, Paul Rubin wrote: Steven D'Aprano writes: Besides, one can legitimately disagree that 2/3 => 0 is the wrong thing to do. It's the right thing to do if you're doing integer maths. I wonder whether 2/3 => ValueError is preferable. Not for me :( -- http://mail.python.org/m

Re: JavaScript toolkits (was Re: ANN: Porcupine Web Application Server 0.6 is released!)

2009-07-20 Thread D'Arcy J.M. Cain
On 20 Jul 2009 09:00:33 -0700 a...@pythoncraft.com (Aahz) wrote: > Out of curiosity, are there any JavaScript toolkits that generate code > that degrades gracefully when JavaScript is disabled? I understand what you want but I can't see how a toolkit can do that. How do you program "graceful?" It

Re: If Scheme is so good why MIT drops it?

2009-07-20 Thread Paul Rubin
vippstar writes: > > I wonder whether 2/3 => ValueError is preferable. > > Not all software wants this. It shouldn't be part of the language but > rather part of your code if you need such a feature. (for instance, to > distinguish between 2/3 and divisions with 0 dividend). I don't see how to i

Re: Help understanding the decisions *behind* python?

2009-07-20 Thread Tycho Andersen
On Mon, Jul 20, 2009 at 11:27 AM, Phillip B Oldham wrote: > > We often find we need to do manipulations like the above without > changing the order of the original list, and languages like JS allow > this. We can't work out how to do this in python though, other than > duplicating the list, sortin

Re: ANN: Shed Skin 0.2, an experimental (restricted) Python-to-C++ compiler

2009-07-20 Thread Bearophile
William Dode': > I just tested it with a litle game, to find the places of horse on > a board 5x5. The result is : > > c 5s > gcj 7s > java 7s > shedskin 8s > python + psyco 18s > cython avec malloc *int 18s > cython 55s avec [] python > python 303s (5m3s) Nice timings, can you please show me the

Re: Running a Python Service under the LocalService or NetworkService Account

2009-07-20 Thread David Adamo Jr.
On Jul 20, 5:14 pm, Tim Golden wrote: > mistersexy wrote: > > On Jul 20, 3:03 pm, Tim Golden wrote: > >> mistersexy wrote: > >>> I am trying to create a Windows service in Python using pywin32. I do > >>> not want this service to run under a user account. I want this service > >>> to be able to r

Help understanding the decisions *behind* python?

2009-07-20 Thread Phillip B Oldham
My colleagues and I have been working with python for around 6 months now, and while we love a lot of what python has done for us and what it enables us to do some of the decisions behind such certain data-types and their related methods baffle us slightly (when compared to the decisions made in ot

comments? storing a function in an object

2009-07-20 Thread Esmail
Hello all, I am trying to store a function and some associated information in an object so that I can later have series of functions in a list that I can evaluate one at a time. Right now I am only storing the function itself, the number of arguments it expects and its string representation. I m

Re: Running a Python Service under the LocalService or NetworkService Account

2009-07-20 Thread Tim Golden
mistersexy wrote: On Jul 20, 3:03 pm, Tim Golden wrote: mistersexy wrote: I am trying to create a Windows service in Python using pywin32. I do not want this service to run under a user account. I want this service to be able to run as a LocalService, NetworkService and the like. How do I spec

Re: On out-of-date Python Applications

2009-07-20 Thread Virgil Stokes
David Robinow wrote: On Mon, Jul 20, 2009 at 7:24 AM, John Machin wrote: ... The next step would be to try to compile ODE 0.7 or 0.8 with VS9 -- however this would require "project files" for ODE for VS9, and there aren't any on the ODE website; it has only those for VS3 and VS5.

JavaScript toolkits (was Re: ANN: Porcupine Web Application Server 0.6 is released!)

2009-07-20 Thread Aahz
In article , tkouts wrote: > >I'm pleased to announce the new version of Porcupine Web Application >Server, a Python based framework that provides front-end and back-end >technologies for building modern data-centric Web 2.0 applications. > > [...] > >QuiX, the server's integrated JavaScript too

Re: Running a Python Service under the LocalService or NetworkService Account

2009-07-20 Thread mistersexy
On Jul 20, 3:03 pm, Tim Golden wrote: > mistersexy wrote: > > I am trying to create a Windows service in Python using pywin32. I do > > not want this service to run under a user account. I want this service > > to be able to run as a LocalService, NetworkService and the like. How > > do I specify

Re: are user defined classes hashable?

2009-07-20 Thread Hyuga
On Jul 19, 11:39 am, Nicolas Dandrimont wrote: > * Alan G Isaac [2009-07-19 14:46:12 +]: > > > Again, my question is about the class not its instances, > > but still, checking as you suggest gives the same answer. > > That's what I get for answering before my coffee! Regardless, Nicolas's ex

Re: Problem when applying Patch from issue1424152 to get https over authenticating proxies working with urllib2 in Python 2.5

2009-07-20 Thread Nike
On Jul 20, 11:11 pm, tvashtar wrote: > Hi, > I'm trying to get https requests working through an authenticating > proxy with urllib2 in Python 2.5, I'm aware that this isn't supported > "out of the box", so applied the > patchhttp://bugs.python.org/file9753/http-tunnel-urllib > linked fromhttp://

Problem when applying Patch from issue1424152 to get https over authenticating proxies working with urllib2 in Python 2.5

2009-07-20 Thread tvashtar
Hi, I'm trying to get https requests working through an authenticating proxy with urllib2 in Python 2.5, I'm aware that this isn't supported "out of the box", so applied the patch http://bugs.python.org/file9753/http-tunnel-urllib linked from http://bugs.python.org/issue1424152 , my baseline test

Re: proposal: add setresuid() system call to python

2009-07-20 Thread Hrvoje Niksic
"Diez B. Roggisch" writes: To emulate the os-module-type calls, it's better to raise exceptions than return negative values: > def setresuid(ruid, euid, suid): > return _setresuid(__uid_t(ruid), __uid_t(euid), __uid_t(suid)) def setresuid(ruid, euid, suid): res = _setresuid(__uid_t(ruid

Auto-generate GUI from a database table structure

2009-07-20 Thread Boyd, Craig1
Hello All, I am REALLY new to python and still trying to figure a lot of this stuff out. I am trying to write a couple screens to update three or four database tables on Oracle 10g and I was wondering if there was a way to automatically generate some kind of GUI shell based on the tables that I

Re: If Scheme is so good why MIT drops it?

2009-07-20 Thread Grant Edwards
On 2009-07-20, Tim Daneliuk wrote: >>> In fact, picking a computer language is the most important >>> discussion in Computer Science and eclipses even P=NP? in >>> significance. I sure hope we can keep this thread going for a >>> few months. >> >> Please feel free to extend this flame-war along

Re: Mutable Strings - Any libraries that offer this?

2009-07-20 Thread Steven D'Aprano
On Mon, 20 Jul 2009 21:08:22 +1000, Ben Finney wrote: > casebash writes: > >> I have searched this list and found out that Python doesn't have a >> mutable string class (it had an inefficient one, but this was removed >> in 3.0). Are there any libraries outside the core that offer this? > > A m

Re: Mutable Strings - Any libraries that offer this?

2009-07-20 Thread Neil Hodgson
casebash: > I have searched this list and found out that Python doesn't have a > mutable string class (it had an inefficient one, but this was removed > in 3.0). Are there any libraries outside the core that offer this? I wrote a gap buffer implementation for Python 2.5 allowing character, uni

Re: Why aren't OrderedDicts comparable with < etc?

2009-07-20 Thread Steven D'Aprano
On Mon, 20 Jul 2009 09:34:24 +, Sion Arrowsmith wrote: > Terry Reedy wrote: >>Sion Arrowsmith wrote: >>> Jack Diederich wrote: It isn't an OrderedDict thing, it is a comparison thing. Two regular dicts also raise an error if you try to LT them. >>> Python 2.5.2 >> d1 = dict(

Re: Running a Python Service under the LocalService or NetworkService Account

2009-07-20 Thread Tim Golden
mistersexy wrote: I am trying to create a Windows service in Python using pywin32. I do not want this service to run under a user account. I want this service to be able to run as a LocalService, NetworkService and the like. How do I specify this using the win32 library? Thanks, everyone. When

Running a Python Service under the LocalService or NetworkService Account

2009-07-20 Thread mistersexy
I am trying to create a Windows service in Python using pywin32. I do not want this service to run under a user account. I want this service to be able to run as a LocalService, NetworkService and the like. How do I specify this using the win32 library? Thanks, everyone. -- http://mail.python.org/

Re: win32api install problem

2009-07-20 Thread Tim Golden
Gerry wrote: I'm running Python 2.6 under XP. I've installed Windows 32 extensions for Python 2.6 version 1.4 (pywin32-214.win32-py2.6.exe). But If I try to import win32api, I get: File "C:\python_projects\euler\driveletters.py", line 1, in import win32api ImportError: DLL load failed:

win32api install problem

2009-07-20 Thread Gerry
I'm running Python 2.6 under XP. I've installed Windows 32 extensions for Python 2.6 version 1.4 (pywin32-214.win32-py2.6.exe). But If I try to import win32api, I get: File "C:\python_projects\euler\driveletters.py", line 1, in import win32api ImportError: DLL load failed: The specified m

Re: Design question.

2009-07-20 Thread Lacrima
On Jul 20, 4:05 pm, Jean-Michel Pichavant wrote: > Lacrima wrote: > > Hello! > > > I am newbie in python and I have really simple question, but I need > > your advice to know how to do best. > > I need to store a number of dictionaries in certain place. I've > > decided to store them in a separate

Re: ANN: Shed Skin 0.2, an experimental (restricted) Python-to-C++ compiler

2009-07-20 Thread Stefan Behnel
William Dode wrote: > On 19-07-2009, Mark Dufour wrote: >> I have just released version 0.2 of Shed Skin, an experimental >> (restricted) Python-to-C++ compiler (http://shedskin.googlecode.com). > > I just tested it with a litle game, to find the places of horse on > a board 5x5. The result is :

Re: proposal: add setresuid() system call to python

2009-07-20 Thread Diez B. Roggisch
Neal Becker wrote: again with his notorious gmane.comp.python.general group that doesn't work for any decent news-reader. > Mahmoud Abdelkader wrote: > >> Why don't you write a python extension module? This is a perfect >> opportunity for that. >> > I think having a module just for one sy

Re: Design question.

2009-07-20 Thread Jean-Michel Pichavant
Lacrima wrote: Hello! I am newbie in python and I have really simple question, but I need your advice to know how to do best. I need to store a number of dictionaries in certain place. I've decided to store them in a separate module. Like this: dicts.py --- dict1 = {} dic

Re: Design question.

2009-07-20 Thread Lacrima
On Jul 20, 3:31 pm, "Diez B. Roggisch" wrote: > Lacrima wrote: > > Hello! > > > I am newbie in python and I have really simple question, but I need > > your advice to know how to do best. > > I need to store a number of dictionaries in certain place. I've > > decided to store them in a separate mo

Re: Persistent variable in subprocess using multiprocessing?

2009-07-20 Thread mheavner
Piet, The situation is 1a of your listed options, however my issue was solved. I was stopping the subprocesses from consuming more data at each iteration which led to the data being lost since the subprocess worker function would then end - I now keep them alive across iterations. Thanks for your

Re: If Scheme is so good why MIT drops it?

2009-07-20 Thread vippstar
On Jul 20, 9:13 am, Paul Rubin wrote: > Steven D'Aprano writes: > > Besides, one can legitimately disagree that 2/3 => 0 is the wrong thing > > to do. It's the right thing to do if you're doing integer maths. > > I wonder whether 2/3 => ValueError is preferable. Not

  1   2   >