Re: How to generate geometric random numbers?

2006-07-24 Thread Paul Rubin
Robert Kern <[EMAIL PROTECTED]> writes: > > I usually owuld write that as int(ceil(log(U, 1.0 - p))). > Knock yourself out. I was cribbing from my C implementation in numpy. Oh cool, I thought you were pasting from a Python implementation. No prob. -- http://mail.python.org/mailman/listinfo/pyth

Re: Isn't there a better way?

2006-07-24 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steve Holden wrote: > Lawrence D'Oliveiro wrote: >> In message <[EMAIL PROTECTED]>, Bruno Desthuilliers >> wrote: >> >> >>>Lawrence D'Oliveiro a écrit : >>> >>> If you're calling a number of different routines in the Processor class, all accessing the same

Re: How to force a thread to stop

2006-07-24 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > Python has no threadicide method, and its absence is not an > oversight. Threads often have important business left to do, such > as releasing locks on shared data; killing them at arbitrary times > tends to leave the system in an inconsis

Re: Compiler for external modules for python

2006-07-24 Thread J�r�me Le Bougeant
VS2003 : http://vecchio56.free.fr/VCToolkitSetup.exe > Hello: > I have interesting external modules that I want to incorporate to > python 2.4.3 and python 2.5b2 also. Some of them requires C/C++ > compiler. I work with Win XP Sp2 and have installed VC2005 express (I > do not know if the compiler

Re: Dive Into Python -- Still Being Updated?

2006-07-24 Thread Alan Franzoni
Il 22 Jul 2006 15:48:36 -0700, [EMAIL PROTECTED] ha scritto: > http://diveintopython.org/getting_to_know_python/indenting_code.html > > The function called fib (presumably short for Fibonacci) appears to > produce factorials. Anyway, 'fib' should really be called 'hem'. :) I think this is just a

Re: using names before they're defined

2006-07-24 Thread Bruno Desthuilliers
Nick Vatamaniuc wrote: > Dave, > > Sometimes generating classes from .ini or XML files is not the best > way. You are just translating one language into another and are making > bigger headaches for your self. It is certainly cool and bragable to > say that "my classes get generated on the fly fro

Re: function v. method

2006-07-24 Thread Bruno Desthuilliers
Antoon Pardon wrote: > On 2006-07-21, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > >>Antoon Pardon wrote: >> >>>On 2006-07-21, fuzzylollipop <[EMAIL PROTECTED]> wrote: >>> >>> danielx wrote: >> >>(snip) >> if you prefix with a single underscore, that tells the user, DON'T MES

How can I optimise this? [intended in good humour]

2006-07-24 Thread Markus
You know you're guilty of early/over optimisation, when it's almost two in the morning and the file open in front of you reads as follows. The code you are about to read is real... Some of the variable names have been changed to protect the families of those involved. [-snip-] from timeit

Re: function v. method

2006-07-24 Thread Bruno Desthuilliers
Antoon Pardon wrote: > On 2006-07-21, fuzzylollipop <[EMAIL PROTECTED]> wrote: > >>Antoon Pardon wrote: >> >> >>>Suppose I am writing my own module, I use an underscore, to >>>mark variables which are an implementation detail for my >>>module. >>> >>>Now I need to import an other module in my modu

Re: Nested function scope problem

2006-07-24 Thread Bruno Desthuilliers
Bruno Desthuilliers wrote: (snip) > First point: the nested function only have access to names that exists > in the enclosing namespace at the time it's defined. Duh. Sometimes I'd better go to bed instead of answering posts here - I'd say less stupidities. re-reading this, I can't believe I actu

Re: Nested function scope problem

2006-07-24 Thread Bruno Desthuilliers
danielx wrote: > Bruno Desthuilliers wrote: > >>Josiah Manson a écrit : >> >>>I found that I was repeating the same couple of lines over and over in >>>a function and decided to split those lines into a nested function >>>after copying one too many minor changes all over. The only problem is >>>th

Re: Isn't there a better way?

2006-07-24 Thread Bruno Desthuilliers
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Bruno Desthuilliers > wrote: > > >>Lawrence D'Oliveiro a écrit : >> >> >>>If you're calling a number of different routines in >>>the Processor class, all accessing the same data, then it makes perfect >>>sense to only pass it once. >> >

Re: Isn't there a better way?

2006-07-24 Thread Bruno Desthuilliers
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Steve > Holden wrote: > > >>Lawrence D'Oliveiro wrote: >> >>>In message <[EMAIL PROTECTED]>, Bruno Desthuilliers >>>wrote: >>> >>> >>> Lawrence D'Oliveiro a écrit : >If you're calling a number of different routine

Re: How to force a thread to stop

2006-07-24 Thread Paul Rubin
Lawrence D'Oliveiro <[EMAIL PROTECTED]> writes: > > Python has no threadicide method, and its absence is not an > > oversight. Threads often have important business left to do, such > > as releasing locks on shared data; killing them at arbitrary times > > tends to leave the system in an inconsiste

PySNMP Thread unsafe?

2006-07-24 Thread rob . audenaerde
I'm trying to monitor about 250 devices with SNMP, using PySNMP version 4. I use the threading.Thread to create a threadpool of 10 threads, so devices not responding won't slow down the monitoring process too much. Here comes my problem. When using PySNMP single threaded, every this goes well; bu

Re: How can I optimise this? [intended in good humour]

2006-07-24 Thread John Machin
Markus wrote: > You know you're guilty of early/over optimisation, when it's almost two > in the morning and the file open in front of you reads as follows. > > The code you are about to read is real... > Some of the variable names have been changed > to protect the families of those involved

BeautifulSoup to get string inner 'p' and 'a' tags

2006-07-24 Thread GinTon
I'm trying to get the 'FOO' string but the problem is that inner 'P' tag there is another tag, 'a'. So: > from BeautifulSoup import BeautifulSoup > s = ' FOO name="f"> ' > tree = BeautifulSoup(s) > print tree.first('p') FOO So if I run 'print tree.first('p').string' to get the 'FOO' string it

Re: Generating all possible combination of elements in a list

2006-07-24 Thread Mir Nazim
Martin v. Löwis wrote: > Mir Nazim wrote: > > Example Problem: > > > > Generate all possible permutations for > > [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2] > > > > [1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 1, 2] (notice an extra 2 ) > > > > eliminate some combinations based on some conditions and combine the > >

Re: BeautifulSoup to get string inner 'p' and 'a' tags

2006-07-24 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, GinTon wrote: > I'm trying to get the 'FOO' string but the problem is that inner 'P' > tag there is another tag, 'a'. So: > >> from BeautifulSoup import BeautifulSoup >> s = ' FOO > name="f"> ' >> tree = BeautifulSoup(s) > >> print tree.first('p') > FOO > > So if I run

Re: Generating all possible combination of elements in a list

2006-07-24 Thread Paul Rubin
"Mir Nazim" <[EMAIL PROTECTED]> writes: > Now I ahave a lits with 1060 lists in it. Now comes the hard part. > How many possible distinct ways are there to arrange 1060 elements > taken 96 at a time > > 1060! / (1060 - 96)! More than you want to think about: import math def logf(n):

Re: Re-evaluating a string?

2006-07-24 Thread John Machin
Tim Chase wrote: [snip] > As > such, I'd rework the move() function I suggested to simply be > something like > > def move(rate,lo,hi,chan=1): > return "!SC%c%c%c%c\r" % (chan, rate, lo, hi) > > where you possibly even just pass in the "position" parameter, > and let the function do the spl

Re: BeautifulSoup to get string inner 'p' and 'a' tags

2006-07-24 Thread GinTon
Marc 'BlackJack' Rintsch wrote: > In [53]: print tree.first('p').contents[0] > FOO > Thanks! I was going to crazy with this. -- http://mail.python.org/mailman/listinfo/python-list

Need a compelling argument to use Django instead of Rails

2006-07-24 Thread Ray
I just moved to another company that's mainly a Java/.NET shop. I was happy to find out that there's a movement from the grassroot to try to convince the boss to use a dynamic language for our development! Two of the senior developers, however, are already rooting for Ruby on Rails--although they

Re: BeautifulSoup to get string inner 'p' and 'a' tags

2006-07-24 Thread Nick Vatamaniuc
Quick-n-dirty way: After you get your whole p string: FOO Remove any tags delimited by '<' and '>' with a regex. In your short example you _don't_ show that there might be something between the and tags so I assume there won't be anything or if there would be something then you also want it i

Re: Need a compelling argument to use Django instead of Rails

2006-07-24 Thread Steve Holden
Ray wrote: > I just moved to another company that's mainly a Java/.NET shop. I was > happy to find out that there's a movement from the grassroot to try to > convince the boss to use a dynamic language for our development! > > Two of the senior developers, however, are already rooting for Ruby on

class instance scope

2006-07-24 Thread Ritesh Raj Sarraf
Hi, I have a class defined in a file called foo.py In bar.py I've imported foo.py In bar.py's main function, I instantiate the class as follows: log = foo.log(x, y, z) Now in main I'm able to use log.view(), log.error() et cetera. But when I call the same method from some functions which are i

Re: Need a compelling argument to use Django instead of Rails

2006-07-24 Thread Ray
Steve Holden wrote: > I wouldn't waste your time. "A man convinced against his will is of the > same opinion still", and they already know they aren't interested in > Python. There are probably many other matters about which they are > uninformed and equally determined. Well the thing is that I ha

Re: Need a compelling argument to use Django instead of Rails

2006-07-24 Thread Ray
BTW the link below is good reading! Thanks Steve! Steve Holden wrote: >http://sethgodin.typepad.com/seths_blog/2005/08/i_changed_my_mi.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Need a compelling argument to use Django instead of Rails

2006-07-24 Thread Tim Heaney
"Ray" <[EMAIL PROTECTED]> writes: > > Can you help me with my argument? Well, there is this study suggesting Django outperforms Ruby on Rails http://wiki.rubyonrails.com/rails/pages/Framework+Performance > Meanwhile I think I'll give RoR a try as well. Good idea. I think Ruby on Rails is ter

Re: Need a compelling argument to use Django instead of Rails

2006-07-24 Thread Ray
Tim Heaney wrote: > "Ray" <[EMAIL PROTECTED]> writes: > > > > Can you help me with my argument? > > Well, there is this study suggesting Django outperforms Ruby on Rails > > http://wiki.rubyonrails.com/rails/pages/Framework+Performance > > > Meanwhile I think I'll give RoR a try as well. > > Goo

Re: Need a compelling argument to use Django instead of Rails

2006-07-24 Thread Steve Holden
Ray wrote: > Steve Holden wrote: > >>I wouldn't waste your time. "A man convinced against his will is of the >>same opinion still", and they already know they aren't interested in >>Python. There are probably many other matters about which they are >>uninformed and equally determined. > > > Well

Re: Python to log into web site

2006-07-24 Thread Christoph Haas
On Tuesday 18 July 2006 17:46, david brochu jr wrote: > I have been browsing around the net looking for a way (hopefully an > easily implemented module) to log into a web site using python. The site > I wish to log into is an internal site which requires email address and > password for authenticat

Re: class instance scope

2006-07-24 Thread Steve Holden
Ritesh Raj Sarraf wrote: > Hi, > > I have a class defined in a file called foo.py > > In bar.py I've imported foo.py > In bar.py's main function, I instantiate the class as follows: > > log = foo.log(x, y, z) > > Now in main I'm able to use log.view(), log.error() et cetera. > Correct. Because

Re: Need a compelling argument to use Django instead of Rails

2006-07-24 Thread Ray
Thanks Sybren for the reply! Regarding this point: > The form handling is also excellent. Is it excellent in a way that's "better" than RoR in certain ways? Regards, Ray Sybren Stuvel wrote: > Ray enlightened us with: > > Two of the senior developers, however, are already rooting for Ruby on >

Re: Python to log into web site

2006-07-24 Thread Steve Holden
david brochu jr wrote: > Hi, > > I have been browsing around the net looking for a way (hopefully an > easily implemented module) to log into a web site using python. The site > I wish to log into is an internal site which requires email address and > password for authentication. Does anyone h

Re: Need a compelling argument to use Django instead of Rails

2006-07-24 Thread Ray
Steve Holden wrote: > Well, my view is that both are frameworks, and so you will inevitably > "run out of steam" at some point if your implementation plans become too > ambitious. The impression I get is that Rails is relatively inflexible > on database schemas, and once you get "off the beaten tra

Re: class instance scope

2006-07-24 Thread Ritesh Raj Sarraf
Steve Holden wrote: > Ritesh Raj Sarraf wrote: > > But when I call the same method from some functions which are in > > bar.py, it fails giving me the following error: > > > > NameError: global name 'log' is not defined > > > Well, that's preumbaly because your > >log = foo.log(x, y, z) > > st

Re: Python to log into web site

2006-07-24 Thread Steve Holden
Steve Holden wrote: > david brochu jr wrote: > >>Hi, >> >>I have been browsing around the net looking for a way (hopefully an >>easily implemented module) to log into a web site using python. The site >>I wish to log into is an internal site which requires email address and >>password for auth

Pydev 1.2.2 released

2006-07-24 Thread Fabio Zadrozny
Hi All, Pydev and Pydev Extensions 1.2.2 have been released Details on Pydev Extensions: http://www.fabioz.com/pydev Details on Pydev: http://pydev.sf.net Details on its development: http://pydev.blogspot.com Release Highlights in Pydev Extensions: ---

Re: Need a compelling argument to use Django instead of Rails

2006-07-24 Thread David Cook
On 2006-07-24, Sybren Stuvel <[EMAIL PROTECTED]> wrote: > Jython isn't up to par with current Python versions either. But the last release is up to the level of C-Python 2.2 or so. I don't really feel like I'm missing that much with it. Dave Cook -- http://mail.python.org/mailman/listinfo/pyth

Re: class instance scope

2006-07-24 Thread Ritesh Raj Sarraf
> > log = foo.log(x, y, z) > > Resulting line is: log = foo.log(x, y, z) global log Making the instance "log" global makes it accessible to all the functions. Now I have only one question, Is this a correct way to do it ? Or are there better way ? Ritesh -- http://mail.python.org/mailman/list

Re: [Newbie] List from a generator function

2006-07-24 Thread Sion Arrowsmith
Paul Rubin wrote: > print list(islice(starmap(random.choice, repeat((possible_notes,))), length)) Why the use of starmap() rather than imap(random.choice, repeat(possible_notes)) ? -- \S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/ ___ | "Frankly I have

Re: Need a compelling argument to use Django instead of Rails

2006-07-24 Thread Ray
David Cook wrote: > On 2006-07-24, Sybren Stuvel <[EMAIL PROTECTED]> wrote: > > > Jython isn't up to par with current Python versions either. > > But the last release is up to the level of C-Python 2.2 or so. I don't > really feel like I'm missing that much with it. You mean the alpha? They're r

MySQLdb and dictcursor

2006-07-24 Thread borris
doesn anyone know a good reference, tute or examples of MySQLdb's dictCursor I want to pass dictionaries into the sql exec statements. I could only succeed with text as values this is how I got the cursor object to call cursor.execute("query") connection = MySQLdb.connect( host = "localhost", u

Re: class instance scope

2006-07-24 Thread Jeethu Rao
You could possibly make the log class a singleton or a borg. Jeethu Rao Ritesh Raj Sarraf wrote: >>> log = foo.log(x, y, z) >>> >>> > > Resulting line is: > log = foo.log(x, y, z) > global log > > Making the instance "log" global makes it accessible to all the > functions. > > Now I have o

Re: MySQLdb and dictcursor

2006-07-24 Thread Christoph Haas
On Monday 24 July 2006 14:06, borris wrote: > doesn anyone know a good reference, tute or examples of > MySQLdb's dictCursor > I want to pass dictionaries into the sql exec statements. > I could only succeed with text as values A german linux magazin has an article about passing a *list* of items

Re: Python linker

2006-07-24 Thread Ben Sizer
Alex Martelli wrote: > What framework (if any) is your Visual C++ code using? If it's using > wxWidgets (the framework underlying wxPython) I very much doubt that it > can be a few kilobytes -- unless the wxWidgets DLL is already installed > on the target machines so that it doesn't need to be pac

Re: easy questions from python newbie

2006-07-24 Thread walterbyrd
Thanks to all who replied. As I mentioned, I am new to python. I will have to look some of this stuff, but that is fine. I am trying to learn. I am sorry I forgot to mention, the platform is windows-xp. I am doing this for a client who has a small warehouse operation. Personally, I usually use de

Re: random shuffles

2006-07-24 Thread Ben Sizer
Ross Ridge wrote: > David G. Wonnacott wrote: > > Couldn't we easily get an n*log(n) shuffle... > > Why are you trying to get an O(n*log(n)) shuffle when an O(n) shuffle > algorithim is well known and implemented in Python as random.shuffle()? I think David is referring to this: "don't you still n

threading+ftp+import => block

2006-07-24 Thread Panard
Hi, I'm experiencing a strange problem while trying to manage a ftp connection into a separate thread. I'm on linux, python 2.4.3 Here is a test : -- ftp_thread.py -- import ftplib import threading import datetime class test( threading.Thread ) : ftp_conn = ftplib.FTP("localhost"

Exercises for dive into python

2006-07-24 Thread Ben Edwards (lists)
Have been working through Dive Into Python which is excellent. My only problem is that there are not exercises. I find exercises are a great way of helping stuff sink in and verifying my learning. Has anyone done such a thing? Ben -- http://mail.python.org/mailman/listinfo/python-list

_mssql on Python 2.5 Beta 2

2006-07-24 Thread mattjohnthomson
I'm trying to use the _mssql module from http://pymssql.sourceforge.net/. It works fine on Python 2.4. I've just installed Python 2.5 Beta 2 on my Linux box and, whenever I try and run the mssql.close() function, or close the program, I get the following message: *** glibc detected *** python2.5

Re: find_longest_match in SequenceMatcher

2006-07-24 Thread koara
John Machin wrote: > --test results snip--- > Looks to me like the problem has nothing at all to do with the length > of the searched strings, but a bug appeared in 2.3. What version(s) > were you using? Can you reproduce your results (500 & 499 giving > different answers) with the same version?

Re: [Newbie] List from a generator function

2006-07-24 Thread Paul Rubin
Sion Arrowsmith <[EMAIL PROTECTED]> writes: > Why the use of starmap() rather than > imap(random.choice, repeat(possible_notes)) > ? Hmm, not sure what I was thinking. I remember "imap... no that won't work... ok, starmap". It was late. It's late now. -- http://mail.python.org/mailman/listinfo

Re: _mssql on Python 2.5 Beta 2

2006-07-24 Thread Steve Holden
[EMAIL PROTECTED] wrote: > I'm trying to use the _mssql module from > http://pymssql.sourceforge.net/. It works fine on Python 2.4. I've > just installed Python 2.5 Beta 2 on my Linux box and, whenever I try > and run the mssql.close() function, or close the program, I get the > following message

Re: _mssql on Python 2.5 Beta 2

2006-07-24 Thread mattjohnthomson
Steve Holden wrote: > You aren't using the same library you used with 2.4, by any chance? > Compiled extensions are specific to a particular major version of > Python, so (for example) 2.3 extension modules won't run under 2.4. > Though normally, IIRC, that would give you problems on import, so thi

Re: MySQLdb and dictcursor

2006-07-24 Thread Francesco Panico
On 7/24/06, Christoph Haas <[EMAIL PROTECTED]> wrote: On Monday 24 July 2006 14:06, borris wrote:> doesn anyone know a good reference, tute or examples of> MySQLdb's dictCursor> I want to pass dictionaries into the sql exec statements.> I could only succeed with text as values A german linux magazi

json implementation

2006-07-24 Thread jon cashman
Hi everyone, Is there a doc comparing different json implementation (example: python-json, simplejson)? Does anyone have a strong recommendation to make? Any problem/issue for a particular implementation? Thanks. - jon _ Is your P

Re: _mssql on Python 2.5 Beta 2

2006-07-24 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Steve Holden wrote: > >>You aren't using the same library you used with 2.4, by any chance? >>Compiled extensions are specific to a particular major version of >>Python, so (for example) 2.3 extension modules won't run under 2.4. >>Though normally, IIRC, that would give

Re: Python newbie needs constructive suggestions

2006-07-24 Thread Chris Lambacher
On Sat, Jul 22, 2006 at 09:31:26PM +0200, Bruno Desthuilliers wrote: > Lawrence D'Oliveiro a ?crit : > > In message <[EMAIL PROTECTED]>, > > [EMAIL PROTECTED] wrote: > > > > > >> b) give up on using an anonymous function and create a named "successor" > >> function with "def", > > > > > > Thi

Connecting to internet under proxy

2006-07-24 Thread Chema
Hi all. I have a little script to connect to the internet and download some files. I developed it in my house (direct connection) and it wordked properly. But the problem is that in the office (under a proxy) it doesn't run. My script is like: import urllib f=urllib.urlopen(SOME_WEB) print f.r

Re: Python-list Digest, Vol 34, Issue 373

2006-07-24 Thread David G. Wonnacott
O.K., I'll publicly retract this for the whole list -- EVERYBODY PLEASE DISREGARD my thought about implementing an n*log(n) shuffle. I had hinted in my message that this was probably something that I should review from a data structures course, and of course there was a simple oversight in my mess

P.S. Re: Python newbie needs constructive suggestions

2006-07-24 Thread David G. Wonnacott
In response to my question, ``What is the idiomatically appropriate Python way to pass, as a "function-type parameter", code that is most clearly written with a local variable?'', a number of you made very helpful suggestions, including the use of a default argument; if one wanted to give a name to

mingw extension modules hang

2006-07-24 Thread Peter Bienstman
Hi, I'm having some problems with scripts using Python extension modules compiled using mingw. * Some of them work fine if I run them from a command prompt. However, if I double click on them, or run them from within IDLE, they seem to hang. * Other scripts always seem to hang, even if I start

Re: PySNMP Thread unsafe?

2006-07-24 Thread Chris Lambacher
On Mon, Jul 24, 2006 at 02:21:10AM -0700, [EMAIL PROTECTED] wrote: > I'm trying to monitor about 250 devices with SNMP, using PySNMP version > 4. I use the threading.Thread to create a threadpool of 10 threads, so > devices not responding won't slow down the monitoring process too much. > > > Her

Re: P.S. Re: Python newbie needs constructive suggestions

2006-07-24 Thread Duncan Booth
David G. Wonnacott wrote: > In response to my question, ``What is the idiomatically appropriate > Python way to pass, as a "function-type parameter", code that is most > clearly written with a local variable?'', a number of you made very > helpful suggestions, including the use of a default argume

list of indices

2006-07-24 Thread Julien Ricard
hi,is there any method to get only some elements of a list from a list of indices. Something like:indices=[0,3,6]new_list=list[indices]which would create a new list containing 0th, 3rd and 6th elements from the original list? I do this with a loop but I'd like to know if there is a simpler way.than

Re: list of indices

2006-07-24 Thread Chris Lambacher
On Mon, Jul 24, 2006 at 08:14:35AM -0700, Julien Ricard wrote: >hi, > >is there any method to get only some elements of a list from a list of >indices. Something like: > >indices=[0,3,6] >new_list=list[indices] new_list = [list[x] for x in indicies] > >which would cre

Re: Regular expression issue

2006-07-24 Thread Sibylle Koczian
[EMAIL PROTECTED] schrieb: > I'm trying to parse a line of html as follows: > > 101.120:( KPA (-) > Snow on Ground)0 > > however, sometimes it looks like this: > > N/A > Snow on Ground)0 > > > I want to get either the numerical value 101.120 (which could be a > different number depending on

Re: list of indices

2006-07-24 Thread Tim Chase
>>indices=[0,3,6] >>new_list=list[indices] > new_list = [list[x] for x in indicies] and just as a caveat, it's generally considered bad form to shadow the built-in list as such... -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: using names before they're defined

2006-07-24 Thread davehowey
> > First case is a little shorter but then you have to use a parser for it > > There's one builtin. do you mean 'configparser'? I'm just trying to figure out how this works. Does it generate objects from the config file automatically? Dave -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I optimise this? [intended in good humour]

2006-07-24 Thread Paul McGuire
"John Machin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Markus wrote: > > You know you're guilty of early/over optimisation, when it's almost two > > in the morning and the file open in front of you reads as follows. > > > > > > from timeit import Timer > > > > if __name__=='__

Parsing Baseball Stats

2006-07-24 Thread ankitdesai
I would like to parse a couple of tables within an individual player's SHTML page. For example, I would like to get the "Actual Pitching Statistics" and the "Translated Pitching Statistics" portions of Babe Ruth page (http://www.baseballprospectus.com/dt/ruthba01.shtml) and store that info in a CSV

Re: Connecting to internet under proxy

2006-07-24 Thread Steve Holden
Chema wrote: > Hi all. > >I have a little script to connect to the internet and download some > files. I developed it in my house (direct connection) and it wordked > properly. But the problem is that in the office (under a proxy) it > doesn't run. My script is like: > > import urllib > f=url

python xmlrpc: cannot handle connection errors

2006-07-24 Thread xristoph
Hello everyone! I am trying to set up a broker-worker system (one broker, multiple and heterogeneous workers) in python for a local network (though possibly also over inet). I am using SimpleXMLRPCServer and xmlrpclib.ServerProxy for connections. Whatever I do, after about 100,000 to 150,000 XMLR

Re: Parsing Baseball Stats

2006-07-24 Thread Paul McGuire
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I would like to parse a couple of tables within an individual player's > SHTML page. For example, I would like to get the "Actual Pitching > Statistics" and the "Translated Pitching Statistics" portions of Babe > Ruth page (http://www.ba

Re: Need a compelling argument to use Django instead of Rails

2006-07-24 Thread Paddy
Ray wrote: > I just moved to another company that's mainly a Java/.NET shop. I was > happy to find out that there's a movement from the grassroot to try to > convince the boss to use a dynamic language for our development! > > Two of the senior developers, however, are already rooting for Ruby on

Re: function v. method

2006-07-24 Thread fuzzylollipop
Gerhard Fiedler wrote: > On 2006-07-22 16:32:38, danielx wrote: > > ...and source code... > >>> > >>> *shudders* What happened to all the goodness of abstraction? > >> > >> Abstraction as you seem to use it requires complete docs of the interface. > >> Which is what you said you don't have...

Re: function v. method

2006-07-24 Thread fuzzylollipop
Antoon Pardon wrote: > On 2006-07-21, fuzzylollipop <[EMAIL PROTECTED]> wrote: > > > > Antoon Pardon wrote: > > > >> Suppose I am writing my own module, I use an underscore, to > >> mark variables which are an implementation detail for my > >> module. > >> > >> Now I need to import an other module

prob with struct and byte order

2006-07-24 Thread nephish
hello there, all. i have a difficult app that connects to a server to get information for our database here. this server is our access point to some equipment in the field that we monitor. the messages come in over a socket connection. And according to their (very limited) documentation, are set

Re: Which Pyton Book For Newbies?

2006-07-24 Thread John Salerno
danielx wrote: > I'm sure you will hear this many times, but that's a great choice ;). I > really think you'll like Learning Python from O'Reilly Press. The > authors claim you can read the book even with no prior programming > experience, which seems plausible having read it. Of course, you > alr

Re: Exercises for dive into python

2006-07-24 Thread Tal Einat
Ben Edwards (lists videonetwork.org> writes: > > Have been working through Dive Into Python which is excellent. My only > problem is that there are not exercises. I find exercises are a great > way of helping stuff sink in and verifying my learning. Has anyone done > such a thing? > > Ben >

Functions, Operators, and Overloading?

2006-07-24 Thread Michael Yanowitz
Hello: Maybe I am missing something, but from what I've seen, it is not possible to overload functions in Python. That is I can't have a def func1 (int1, string1): and a def func1 (int1, int3, string1, string2): without the second func1 overwriting the first. However, operators

Re: Type signature

2006-07-24 Thread paul kölle
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, Yacao Wang > wrote: > >> However, type signatures are not only a kind of information provided for >> the compiler, but also for the programmer, or more important, for the >> programmer. Without it, we have to "infer" the return type or requ

pyserial to read from DS1615 temperature recorder chip

2006-07-24 Thread alexandre_irrthum
Hi there, I am trying to use pyserial to read data from a temperature logger device (T-logger). T-logger is based on the DS1615 temperature recorder chip (Dallas Semiconductor). According to the DS1615 docs, writing to the chip is performed one byte at a time. To read from the chip, one must issu

Re: prob with struct and byte order

2006-07-24 Thread Steve Holden
[EMAIL PROTECTED] wrote: > hello there, all. > > i have a difficult app that connects to a server to get information for > our database here. > this server is our access point to some equipment in the field that we > monitor. > > the messages come in over a socket connection. And according to the

Re: Which Pyton Book For Newbies?

2006-07-24 Thread Gerhard Fiedler
On 2006-07-24 13:39:20, John Salerno wrote: > But I think the usual caveat for GUI programming is, is it necessary? > Would it work just as well to make a website interface to do your work, > rather than spend the time learning a GUI toolkit and creating a GUI > app? While I don't doubt that ther

Re: Detecting socket connection failure

2006-07-24 Thread Dieter Maurer
[EMAIL PROTECTED] writes on 19 Jul 2006 08:34:00 -0700: > ... > Were you also using mac osx? No, I have observed the problem under Linux. > Dieter Maurer wrote: > > > I have seen something similar recently: > > > > I can write ("send" to be precise) to a socket closed by > > the foreign

Re: Type signature

2006-07-24 Thread Hugo Ferreira
Which is expecially true when using IDEs with auto-completion.Using VisualStudio/MonoDevelop and C# I rarely need to look at the documentation because I can quickly see what a method accept and returns. And when I need to pass flags or options, enums are much more neat and encapsulated. With Python

Re: How to force a thread to stop

2006-07-24 Thread Carl J. Van Arsdall
Dennis Lee Bieber wrote: > On Sat, 22 Jul 2006 14:47:30 +0200, "Hans" <[EMAIL PROTECTED]> declaimed > the following in comp.lang.python: > > >> Hi all, >> >> Is there a way that the program that created and started a thread also stops >> it. >> (My usage is a time-out). >> >> > Hasn'

Re: Need a compelling argument to use Django instead of Rails

2006-07-24 Thread aaronwmail-usenet
Steve Holden wrote: ... > I wouldn't waste your time. "A man convinced against his will is of the > same opinion still", and they already know they aren't interested in > Python. There are probably many other matters about which they are > uninformed and equally determined This is too true. F

Re: Functions, Operators, and Overloading?

2006-07-24 Thread Brian Beck
Michael Yanowitz wrote: >Maybe I am missing something, but from what I've seen, > it is not possible to overload functions in Python. That > is I can't have a > def func1 (int1, string1): >and a > def func1 (int1, int3, string1, string2): > without the second func1 overwriting the f

Re: Exercises for dive into python

2006-07-24 Thread Ben Edwards (lists)
On Mon, 2006-07-24 at 16:39 +, Tal Einat wrote: > Ben Edwards (lists videonetwork.org> writes: > > > > > Have been working through Dive Into Python which is excellent. My only > > problem is that there are not exercises. I find exercises are a great > > way of helping stuff sink in and ver

Re: prob with struct and byte order

2006-07-24 Thread Grant Edwards
On 2006-07-24, Steve Holden <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: >> hello there, all. >> >> i have a difficult app that connects to a server to get information for >> our database here. >> this server is our access point to some equipment in the field that we >> monitor. >> >> th

Re: function v. method

2006-07-24 Thread Gerhard Fiedler
On 2006-07-24 13:25:14, fuzzylollipop wrote: >> So... the final authority /is/ the code. I don't see an alternative. For >> me, good abstraction doesn't mean I don't have to read the sources; good >> abstraction means (among other things) that I can read the sources easily. > having auto generate

Re: function v. method

2006-07-24 Thread Gerhard Fiedler
On 2006-07-24 14:41:02, Gerhard Fiedler wrote: > (I actually think that possibly the current way of embedding javadoc-like > documentation into sources is only a stepping stone into the direction > generally pointed to by what Wirth called "literate programming". That was Knuth, not Wirth. But t

Re: Generating all possible combination of elements in a list

2006-07-24 Thread Mir Nazim
Paul Rubin wrote: > > 1060! / (1060 - 96)! > > More than you want to think about: > > import math > > def logf(n): > """return base-10 logarithm of (n factorial)""" > f = 0.0 > for x in xrange(1,n+1): > f += math.log(x, 10) > return f > > pr

Re: Functions, Operators, and Overloading?

2006-07-24 Thread Gerhard Fiedler
On 2006-07-24 14:30:31, Brian Beck wrote: > Michael Yanowitz wrote: >>Maybe I am missing something, but from what I've seen, >> it is not possible to overload functions in Python. That >> is I can't have a >> def func1 (int1, string1): >>and a >> def func1 (int1, int3, string1, string2

Re: Functions, Operators, and Overloading?

2006-07-24 Thread Terry Reedy
"Michael Yanowitz" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello: > > Maybe I am missing something, but from what I've seen, > it is not possible to overload functions in Python. That > is I can't have a > def func1 (int1, string1): > and a > def func1 (int1, int3, str

Re: pyserial to read from DS1615 temperature recorder chip

2006-07-24 Thread Gerhard Fiedler
On 2006-07-24 14:03:30, [EMAIL PROTECTED] wrote: > To read from the chip, one must issue the "read page" command (33h), > followed by the two-byte address of the requested page (pages are 32 > bytes long). After receiving this, the DS1615 will send the data in a > burst of (up to) 32 bytes. I'm

  1   2   >