Re: Nested function scope problem

2006-07-25 Thread Steve Holden
Dennis Lee Bieber wrote: > On Mon, 24 Jul 2006 17:35:50 -0300, Gerhard Fiedler <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > >>It is surprising in the sense that binding seems not to be necessary for >>read access. >> It does, I would agree, seem a little counter-intuiti

Re: prob with struct and byte order

2006-07-25 Thread John Machin
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, nephish wrote: > > > tohex gave me > > '53 54 58 > >S T X > > > 00 00 00 34 > > Length!? Decimal 57. 3 * 16 + 4 -> 52 where I come from -- assuming hex means hexadecimal and not witchcraft :-) > > > 00 00 00 c8 > > Type!? Decimal 2

Re: About Embedding PyWin or wxPython

2006-07-25 Thread Steve Holden
Mr. Roboto wrote: > Folks: I want to embark on a project to add Python (actually, wxPython > or PythonWin) to a new Windows app I want to start writing soon. > Essentially, I want to take VB6 (or pos Delphi) and construct the app > framework/core functionality using one of those languages, then ex

Re: PySNMP Thread unsafe?

2006-07-25 Thread etingof
pysnmp has been designed to be MT-safe. Although, I've never used it in a MT app, so there may be a bug showing up when you do threading... At its simplest, I'd advise snooping on the wire to make sure you are querying different devices at the same time and also to see where the [I assume] bottlen

Re: Newbie Q: Class Privacy (or lack of)

2006-07-25 Thread Bruno Desthuilliers
Steve Jobless wrote: > Hi, > > I just started learning Python. I went through most of the tutorial at > python.org. But I noticed something weird. I'm not talking about the > __private hack. Actually this is __ultra_private. For normal privacy, _private is enough !-) > Let's say the class is def

Re: building an index for large text files for fast access

2006-07-25 Thread John Machin
Erik Max Francis wrote: > alex23 wrote: > > > The standard library module 'libcache' does exactly what you're > > considering implementing. > > I believe the module you're referring to is `linecache`. > and whatever its name is, it's not a goer: it reads the whole of each file into memory. It was

doctest with variable return value

2006-07-25 Thread 3KWA
Hi all, I am wondering what is the standard doctest (test) practice for functions who's returned value change all the time e.g. forex rate: import urllib def get_rate(symbol): """get_rate(symbol) connects to yahoo finance to return the rate of symbol. >>>get_rate('AUDEUR') """

Re: micro authoritative dns server

2006-07-25 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > I just want to know if anyone could help me in writing a code for > minimal authoritative dns server. You'll probably need to start by reading and understanding RFC1034 and RFC1035. -- http://mail.python.org/mailman/listinfo/python-list

Re: function v. method

2006-07-25 Thread Wesley Brooks
(Apollogies to fuzzylollipop for replying to them rather than the list!) Python does have ALREADY have an OFFICAL mechanism for private members, prefix your names with _ or __. Both are ommited from autogenerateddocuementation and both are OFFICALLY not supposed to be used.Could you elaborate on th

Any tips/comments on my code sample

2006-07-25 Thread apexi . 200sx
Just wondering if anyone could give me advice on handling potential error conditions in python, it seems that exceptions are used alot more for this stuff than in other languages. I have provided a code sample giving an example of a first attempt at using them (in python anyway) and also I have gi

Re: Grail not downloading

2006-07-25 Thread SuperHik
Dustan wrote: > Does anybody know anything about Grail? I've been unable to get at > it, and I've tried on both Windows and Macintosh machines. > > http://grail.sourceforge.net/ > http://prdownloads.sourceforge.net/grail/grail-0.6.tgz?download -- http://mail.python.org/mailman/listinfo/python

Re: doctest with variable return value

2006-07-25 Thread Rob Sinclar
On Tuesday 25 July 2006 09:53, 3KWA wrote: > Hi all, > > I am wondering what is the standard doctest (test) practice for > functions who's returned value change all the time e.g. forex rate: > > import urllib > > def get_rate(symbol): > """get_rate(symbol) connects to yahoo finance to return th

dicts vs classes

2006-07-25 Thread Guyon Morée
Hi all, I'm using simple classes as a container of named values and I'm instantiating a lot of them in a very short time. i was wondering if there is any benefit in using dicts instead from a performance/memory usage point of view? regards, Guyon Morée http://gumuz.looze.net -- http://mail.py

csv file or sqlite ?

2006-07-25 Thread frevol nicolas
hi, I am programming a filter for websites. to check if an url is in the blacklist, i have used a csv file. i have try to use sqlite but it looks as fast as csv files. Can you tell me if sqlite is faster than csv files ? or not ? thanks _

Re: dicts vs classes

2006-07-25 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Guyon Morée wrote: > I'm using simple classes as a container of named values and I'm > instantiating a lot of them in a very short time. > > i was wondering if there is any benefit in using dicts instead from a > performance/memory usage point of view? If you really have

Re: dicts vs classes

2006-07-25 Thread Marco Wahl
"Guyon Morée" <[EMAIL PROTECTED]> writes: > I'm using simple classes as a container of named values and I'm > instantiating a lot of them in a very short time. > > i was wondering if there is any benefit in using dicts instead from a > performance/memory usage point of view? I recommend you to m

Re: dicts vs classes

2006-07-25 Thread Pan Xingzhi
dict is already a classwhy another? Guyon Morée wrote: > Hi all, > > I'm using simple classes as a container of named values and I'm > instantiating a lot of them in a very short time. > > i was wondering if there is any benefit in using dicts instead from a > performance/memory usage point

When is Django going to...

2006-07-25 Thread Ray
support Oracle and MS SQL Server? I just realized that's gonna be a big blow for my case against RoR because we use both databases almost exclusively, we don't use any of Django supported database actually. I did a search and found that there was an Oracle support committed--but is it going to mak

Re: When is Django going to...

2006-07-25 Thread Bruno Desthuilliers
Ray wrote: > support Oracle and MS SQL Server? I just realized that's gonna be a big > blow for my case against RoR because we use both databases almost > exclusively, we don't use any of Django supported database actually. > > I did a search and found that there was an Oracle support > committed-

upload a file

2006-07-25 Thread ciccio
Dear all, could you give me an help ? I would to upload a file from web using Python. Is there a simple way to do this? I'm using the cgi module and python 2.3. The file to be uploaded is a text file. Thank you for all your suggestions, Ernesto ---

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

2006-07-25 Thread Georg Brandl
John Machin wrote: > 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

Re: csv file or sqlite ?

2006-07-25 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, frevol nicolas wrote: > I am programming a filter for websites. to check if an > url is in the blacklist, i have used a csv file. i > have try to use sqlite but it looks as fast as csv > files. > > Can you tell me if sqlite is faster than csv files ? > or not ? Depends on

Re: When is Django going to...

2006-07-25 Thread Ray
Bruno Desthuilliers wrote: > Ray wrote: > > support Oracle and MS SQL Server? I just realized that's gonna be a big > > blow for my case against RoR because we use both databases almost > > exclusively, we don't use any of Django supported database actually. > > > > I did a search and found that t

Re: dicts vs classes

2006-07-25 Thread Simon Hibbs
I'm wondering about whether to use objects in this way or dictionaries for a program I'm writing at the moment. It seems to me that unless you need some of the functionality supplied with dictionaries (len(a), has_key, etc) then simple objects are a syntacticaly cleaner and more natural way to expr

Re: Parsing Baseball Stats

2006-07-25 Thread Anthra Norell
Hi, Below your solution ready to run. Put get_statistics () in a loop that feeds it the names from your file, makes an ouput file name from it and passes both 'statistics' and the ouput file name to file_statistics (). Cheers, Frederic - Original Message - From: <[EMAIL PROTECT

Re: About Embedding PyWin or wxPython

2006-07-25 Thread Simon Hibbs
Have you considered IronPython? This is of course only an option if you're prepared to code in VB.NET or C# instead of VB6 or Delphi, but it would provide seamless integratioon between your Python code and the rest of your app and would not require an external graphics library - although you woul

Re: About Embedding PyWin or wxPython

2006-07-25 Thread Mr. Roboto
Steve: Thanx for reminding me. I have that book around here *someplace*. Never finished it, but will dig it out pronto. As you so aptly point out, I want to develop more than experiment and who better to learn from than the author of PyWin itself Steve Holden wrote: > You almost certainly

Re: Grail not downloading

2006-07-25 Thread Dustan
SuperHik wrote: > Dustan wrote: > > Does anybody know anything about Grail? I've been unable to get at > > it, and I've tried on both Windows and Macintosh machines. > > > > http://grail.sourceforge.net/ > > > > http://prdownloads.sourceforge.net/grail/grail-0.6.tgz?download Thanks. I'll try tha

Re: Grail not downloading

2006-07-25 Thread Dustan
Martin v. Löwis wrote: > Dustan wrote: > > Does anybody know anything about Grail? I've been unable to get at > > it, and I've tried on both Windows and Macintosh machines. > > > > http://grail.sourceforge.net/ > > The files just don't exist, physically, on the server (if you have > an SF account

Re: About Embedding PyWin or wxPython

2006-07-25 Thread Mr. Roboto
Simon: Good idea, but I'm not yet .NET-compatible and can't handle that learning curve in addition to everything else. IronPython is an option I hadn't considered, but yours is a good idea for the next project Simon Hibbs wrote: > Have you considered IronPython? > > This is of course only an

Stack trace in C

2006-07-25 Thread Andre Poenitz
Bear with me - I am new to Python. (And redirect me to a more suitable newsgroup in case this one is not appropriate.) I am trying to embed Python into a C++ application and want to get back a backtrace in case of errors in the python code. This works well with e.g. import sys def u3():

Re: Stack trace in C

2006-07-25 Thread Jean-Paul Calderone
On Tue, 25 Jul 2006 14:20:41 +0200, Andre Poenitz <[EMAIL PROTECTED]> wrote: > > >Bear with me - I am new to Python. (And redirect me to a more suitable >newsgroup in case this one is not appropriate.) > >I am trying to embed Python into a C++ application and want to get back >a backtrace in case o

Missing rotor module

2006-07-25 Thread rony steelandt
I'm in the midle of porting a python 1.5 application to 2.4 I just discovered that the rotor encryption module isn't part anymore of the 2.4 distribution. Is there a way to add this module to 2.4, or what would be the simplest way to replace this. The existing application makes use of the rotor m

Re: How to force a thread to stop

2006-07-25 Thread bryanjugglercryptographer
Carl J. Van Arsdall wrote: [...] > My problem with the fact that python doesn't have some type of "thread > killer" is that again, the only solution involves some type of polling > loop. A polliing loop is neither required nor helpful here. [...] > #Just pretend for the sake of arguement that 'o

Re: Missing rotor module

2006-07-25 Thread Paul Rubin
rony steelandt <[EMAIL PROTECTED]> writes: > Is there a way to add this module to 2.4, or what would be the simplest > way to replace this. > The existing application makes use of the rotor module everywhere, which > means in a lot of modules. > > Thanks for any ideas It's still in the 1.5 distro

How do I pass a list to a __init__ value/definition?

2006-07-25 Thread ryanshewcraft
Let me start with my disclaimer by saying I'm new to computer programming and have doing it for the past three weeks. I may not be completely correct with all the jargon, so please bear with me. Anyways, I'm writing a function which has a class called "MultipleRegression." I want one of the vari

Re: How to force a thread to stop

2006-07-25 Thread Paul Rubin
[EMAIL PROTECTED] writes: > Threadicide would not solve the problems you actually have, and it > tends to create other problems. What is the condition that makes > you want to kill the thread? Make the victim thread respond to that > condition itself. If the condition is a timeout, one way to noti

Re: How do I pass a list to a __init__ value/definition?

2006-07-25 Thread Andrew Koenig
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > class MultipleRegression: >def __init__(self, dbh, regressors, fund): >self.dbh = dbh >self.regressors = regressors > > and I want to be able to enter regressors as a list like > MultipleRegression(dbh, [1,2,3,4], 5

Re: How do I pass a list to a __init__ value/definition?

2006-07-25 Thread Simon Brunning
On 25 Jul 2006 05:46:55 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Let me start with my disclaimer by saying I'm new to computer > programming and have doing it for the past three weeks. I may not be > completely correct with all the jargon, so please bear with me. > > Anyways, I'm writ

Re: How do I pass a list to a __init__ value/definition?

2006-07-25 Thread Ben Sizer
[EMAIL PROTECTED] wrote: > I've got: > > class MultipleRegression: > def __init__(self, dbh, regressors, fund): > self.dbh = dbh > self.regressors = regressors > > and I want to be able to enter regressors as a list like > MultipleRegression(dbh, [1,2,3,4], 5). But when I do th

Re: Stack trace in C

2006-07-25 Thread Just
In article <[EMAIL PROTECTED]>, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Tue, 25 Jul 2006 14:20:41 +0200, Andre Poenitz <[EMAIL PROTECTED]> wrote: > > > > > >Bear with me - I am new to Python. (And redirect me to a more suitable > >newsgroup in case this one is not appropriate.) > > >

Re: How do I pass a list to a __init__ value/definition?

2006-07-25 Thread ryanshewcraft
You guys are right it is getting passed initially. I checked in by printing the self.regressors in the class and it gives the list. But I get the error: TypeError: iteration over non-sequence for def Regress(self): print self.regressors for reg in self.regressors: in

Re: How to force a thread to stop

2006-07-25 Thread Jean-Paul Calderone
On 25 Jul 2006 05:51:47 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: >[EMAIL PROTECTED] writes: >> Threadicide would not solve the problems you actually have, and it >> tends to create other problems. What is the condition that makes >> you want to kill the thread? Make the victim thr

Re: How do I pass a list to a __init__ value/definition?

2006-07-25 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > Let me start with my disclaimer by saying I'm new to computer > programming and have doing it for the past three weeks. I may not be > completely correct with all the jargon, so please bear with me. > > Anyways, I'm writing a function which has a class While legal (i

Re: How to force a thread to stop

2006-07-25 Thread bryanjugglercryptographer
Dennis Lee Bieber wrote: > On Mon, 24 Jul 2006 10:27:08 -0700, "Carl J. Van Arsdall" > > My problem with the fact that python doesn't have some type of "thread > > killer" is that again, the only solution involves some type of polling > > loop. I.e. "if your thread of execution can be written so

Re: How do I pass a list to a __init__ value/definition?

2006-07-25 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > You guys are right it is getting passed initially. I checked in by > printing the self.regressors in the class and it gives the list. But I > get the error: TypeError: iteration over non-sequence for > > def Regress(self): the usual Python coding style is to use eith

Re: How do I pass a list to a __init__ value/definition?

2006-07-25 Thread ryanshewcraft
Bruno may be right. At some point I've got del self.regressors[fundNumber] which eliminates one of the variables in the list. I guess I figured it would be alright because I thought the program would run in a linear fashion (aside from loops, etc). I use the list in the code above where I dele

Re: Nested function scope problem

2006-07-25 Thread Gerhard Fiedler
On 2006-07-25 04:06:24, Steve Holden wrote: > Dennis Lee Bieber wrote: >> On Mon, 24 Jul 2006 17:35:50 -0300, Gerhard Fiedler <[EMAIL PROTECTED]> >> declaimed the following in comp.lang.python: >> >>> It is surprising in the sense that binding seems not to be necessary >>> for read access. >> >

Re: function v. method

2006-07-25 Thread Gerhard Fiedler
On 2006-07-25 05:16:04, Wesley Brooks wrote: >> prefix your names with _ or __. Both are ommited from autogenerated >> docuementation and both are OFFICALLY not supposed to be used. >> > > Could you elaborate on that a little or point me in the right direction to > read up on it? I'm currently re

Re: How do I pass a list to a __init__ value/definition?

2006-07-25 Thread ryanshewcraft
> FWIW, always try to reduce code to the minimal runnable snippet > exhibiting the problem, so others have a chance to help you. As a > side-effect, one very often finds the problem while doing so !-) Sorry I can't post to much of the code. Some of what I'm using is grabbing infromation off of

local moduile acess from cgi-bin

2006-07-25 Thread noro
hello all. I do some coding in python but this is my first attampt to write somthing for hte web. I need to write a cgi-bin script for a web-server, and i've got the access for it from our "SYSTEM". the problem is that this script uses some modules (pg, pyLab) that i've installed localy in my hom

Paste text across multiple text boxes

2006-07-25 Thread dpryan
I've written a python program that analyzes some data. However, I would like to make it easier to input data from the user. Currently, I have nine text boxes arranged vertically, and the user types a number into each of the boxes. This can be a little tedious, so I've envisioned a way speed up the

Re: How do I pass a list to a __init__ value/definition?

2006-07-25 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > >>FWIW, always try to reduce code to the minimal runnable snippet >>exhibiting the problem, so others have a chance to help you. As a >>side-effect, one very often finds the problem while doing so !-) > > > Sorry I can't post to much of the code. Some of what I'm usin

Re: How do I pass a list to a __init__ value/definition?

2006-07-25 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > Bruno may be right. At some point I've got > > del self.regressors[fundNumber] oops... You're probably in for troubles with this: >>> l = [1, 2, 3, 4] >>> del l[1] >>> l [1, 3, 4] >>> del l[1] >>> l [1, 4] >>> del l[1] >>> l [1] >>> del l[1] Traceback (most recent call

Re: local moduile acess from cgi-bin

2006-07-25 Thread Bruno Desthuilliers
noro wrote: > hello all. > > I do some coding in python but this is my first attampt to write > somthing for hte web. > > I need to write a cgi-bin script for a web-server, and i've got the > access for it from our "SYSTEM". the problem is that this script uses > some modules (pg, pyLab) that i'v

Re: prob with struct and byte order

2006-07-25 Thread nephish
ok. here is how i got a message in the first place. The data server developers released this one windows app that simulates a real app. In that it logs into the server and sends and receives commands. instead of putting in the data servers ip though, i put in the ip address of the linux box i am bu

Re: json implementation

2006-07-25 Thread Harry George
"jon cashman" <[EMAIL PROTECTED]> writes: > 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 > > ___

Re: Exercises for dive into python

2006-07-25 Thread Ben Edwards (lists)
On Mon, 2006-07-24 at 23:16 +0200, Tal Einat wrote: > > snip... > > > > > > I recently gave a Python crash-course in my company, and ran > into the same > > problem. There are many good Python tutorials, manuals, > references etc., most >

M2Crypto and general HTTPS help needed

2006-07-25 Thread McCann, Brian
Hi all. I'm trying to connect to an HTTPS server and fetch a page, and I can get that working fine by doing the following: >>> from M2Crypto import Rand, SSL, m2urllib >>> url = m2urllib.FancyURLopener() >>> u = url.open('https://127.0.0.1') >>> data = u.read() >>> print data >>> u.close() Howev

question: Python or Lua for rejuvenation of old PCs?

2006-07-25 Thread Cowden, Chris A.
John,   Saw your post at http://mail.python.org/pipermail/python-list/2004-January/201290.html when I was googling to see if anyone might have ported Python to Tandem.     Wonder what the business case is for a project of porting Python to Tandem?  We really could use a good scripting langua

Re: Paste text across multiple text boxes

2006-07-25 Thread Simon Hibbs
This link seems to have some relevent code. http://lists.wxwidgets.org/archive/wxPython-users/msg07340.html Simon Hibbs -- http://mail.python.org/mailman/listinfo/python-list

Python and Boost.

2006-07-25 Thread KraftDiner
Hi, I'm trying to call a C++ class from python. I've looked around and the solution would appear to be boost. I'm not sure but maybe I've downloaded and installed the entire boost library, when there is probably a separate tar ball for python / C++ integration. Can someone please point me to a tar

Re: About Embedding PyWin or wxPython

2006-07-25 Thread Philippe Martin
Mr. Roboto wrote: > > Folks: I want to embark on a project to add Python (actually, wxPython > or PythonWin) to a new Windows app I want to start writing soon. > Essentially, I want to take VB6 (or pos Delphi) and construct the app > framework/core functionality using one of those languages, the

Re: Python Stripped CSS Background Image Calls

2006-07-25 Thread JenAsh
Thanks Marc, Yes, there is a web framework, basically the CSS is used as the layout wrapper of the Python script. It is a include call within the Python script. -- http://mail.python.org/mailman/listinfo/python-list

Don't use __slots__! (was Re: dicts vs classes)

2006-07-25 Thread Aahz
In article <[EMAIL PROTECTED]>, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >In <[EMAIL PROTECTED]>, Guyon Morée >wrote: >> >> I'm using simple classes as a container of named values and I'm >> instantiating a lot of them in a very short time. >> >> i was wondering if there is any benefi

Re: Python Stripped CSS Background Image Calls

2006-07-25 Thread Bruno Desthuilliers
JenAsh wrote: > Thanks Marc, > > Yes, there is a web framework, basically the CSS is used as the layout > wrapper of the Python script. It is a include call within the Python > script. > Then first post to this framework's mailing list, or to the author. FWIW, there are few chances you get any us

2 timers, doesnt work?

2006-07-25 Thread Kiran
I am creating 2 timers inside a GUI, but it seems that only the one declared last (the second timer), gets triggered, but the first one doesnt. Here is the code for the timers: # main timer, which governs when the register watcher get updated self.mainTimer = wx.Timer(self) self.Bind(wx.EVT_TIMER,

Re: dicts vs classes

2006-07-25 Thread bearophileHUGS
Simon Hibbs: > It seems to me that unless you > need some of the functionality supplied with dictionaries (len(a), > has_key, etc) then simple objects are a syntacticaly cleaner and more > natural way to express yourself. I'd say the opposite. Classes contain a dict of their attributes, etc. So if

smtplib timeout

2006-07-25 Thread Stuart D. Gathman
I am doing SMTP callbacks in a Python milter (http://pymilter.sourceforge.net) using the smtplib module. For some spammer MXes, it takes days (!) before smtplib.sendmail will return. Since the spammer connects to us every few seconds, this quickly leads to a problem :-) I need to set a timelimit

Re: Don't use __slots__! (was Re: dicts vs classes)

2006-07-25 Thread bearophileHUGS
Aahz, citing Guido: >__slots__ is a terrible hack with nasty, hard-to-fathom side >effects that should only be used by programmers at grandmaster and >wizard levels. Unfortunately it has gained an enormous undeserved I think I have used __slots__ just one time. Can you tell me some of of such bad

Python audio output switch

2006-07-25 Thread Pan Xingzhi
Guys: Hi there. Recently I'll have to write a quite interesting program in Python on a Linux box. What I need is a function which allows the user to 'switch' the audio output from //. I'm not quite familiar with Linux programming. I've checked some python media frameworks but still n

Re: About Embedding PyWin or wxPython

2006-07-25 Thread Mr. Roboto
Phillipe: Actually, it's not performance of the core app that concerns me. I'm thinking more about UI/form *design* productivity. I've done a lot of Access work over the years and while the stand-alone VB form designer isn't quite as thorough, it's still one of the slickest out there. Unfortuna

Re: Paste text across multiple text boxes

2006-07-25 Thread dpryan
Thanks! This will get me started. Simon Hibbs wrote: > This link seems to have some relevent code. > > http://lists.wxwidgets.org/archive/wxPython-users/msg07340.html > > Simon Hibbs -- http://mail.python.org/mailman/listinfo/python-list

Re: dicts vs classes

2006-07-25 Thread Simon Forman
Simon Hibbs wrote: > I'm wondering about whether to use objects in this way or dictionaries > for a program I'm writing at the moment. It seems to me that unless you > need some of the functionality supplied with dictionaries (len(a), > has_key, etc) then simple objects are a syntacticaly cleaner a

Re: micro authoritative dns server

2006-07-25 Thread xan2
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] wrote: > > > I just want to know if anyone could help me in writing a code for > > minimal authoritative dns server. > > You'll probably need to start by reading and understanding RFC1034 and > RFC1035. Yes. But these

Re: Don't use __slots__! (was Re: dicts vs classes)

2006-07-25 Thread Aahz
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: >Aahz, citing Guido: >> >>__slots__ is a terrible hack with nasty, hard-to-fathom side >>effects that should only be used by programmers at grandmaster and >>wizard levels. Unfortunately it has gained an enormous undeserved > >I think I ha

Re: Nested function scope problem

2006-07-25 Thread Bruno Desthuilliers
Gerhard Fiedler wrote: > On 2006-07-25 04:06:24, Steve Holden wrote: > > >>Dennis Lee Bieber wrote: >> >>>On Mon, 24 Jul 2006 17:35:50 -0300, Gerhard Fiedler <[EMAIL PROTECTED]> >>>declaimed the following in comp.lang.python: >>> >>> It is surprising in the sense that binding seems not to be

Re: smtplib timeout

2006-07-25 Thread Alan Kennedy
[Stuart D. Gathman] > I need to set a timelimit for the operation of > smtplib.sendmail. It has to be thread based, because pymilter uses > libmilter which is thread based. There are some cookbook recipies which > run a function in a new thread and call Thread.join(timeout). This > doesn't help,

Re: About Embedding PyWin or wxPython

2006-07-25 Thread Philippe Martin
Mr. Roboto wrote: > Phillipe: Actually, it's not performance of the core app that concerns > me. I'm thinking more about UI/form *design* productivity. I've done > a lot of Access work over the years and while the stand-alone VB form > designer isn't quite as thorough, it's still one of the sli

Re: How to force a thread to stop

2006-07-25 Thread Carl J. Van Arsdall
[EMAIL PROTECTED] wrote: > Carl J. Van Arsdall wrote: > [...] > >> My problem with the fact that python doesn't have some type of "thread >> killer" is that again, the only solution involves some type of polling >> loop. >> > > A polliing loop is neither required nor helpful here. > > [...]

Re: How to force a thread to stop

2006-07-25 Thread Gerhard Fiedler
On 2006-07-25 13:30:22, Carl J. Van Arsdall wrote: >> Running os.system() in multiple threads strikes me as kind of whacked. >> Won't they all compete to read and write stdin/stdout simultaneously? >> > Unfortunately this is due to the nature of the problem I am tasked with > solving. I have a

simple question

2006-07-25 Thread Maxine Weill
I need to install Python Imaging Library (PIL) - imaging-1.1.5.tar.gz (source ) onto Suse Linux 10.1 system in order for (latest) Scribus 1.3.3.2 to install and work. Plesae indicate how I perform PIL install (exact commands/procedures) in manner where files are "automatically" placed in prop

Re: How to force a thread to stop

2006-07-25 Thread Carl J. Van Arsdall
Gerhard Fiedler wrote: > On 2006-07-25 13:30:22, Carl J. Van Arsdall wrote: > > >>> Running os.system() in multiple threads strikes me as kind of whacked. >>> Won't they all compete to read and write stdin/stdout simultaneously? >>> >>> >> Unfortunately this is due to the nature of the p

Re: Nested function scope problem

2006-07-25 Thread Terry Reedy
"Dennis Lee Bieber" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The names in the parameter list of the "def" statement are bound to > the objects associated with the actual call. After that, they behave > very much as locals... Now -- with defaults it gets a touch trickier... A

Re: simple question

2006-07-25 Thread Steve Holden
Maxine Weill wrote: > I need to install Python Imaging Library (PIL) - imaging-1.1.5.tar.gz > (source ) onto Suse Linux 10.1 system in order for (latest) Scribus 1.3.3.2 > to install and work. > > Plesae indicate how I perform PIL install (exact commands/procedures) in > manner where files ar

Re: Help in string.digits functions

2006-07-25 Thread Simon Forman
John McMonagle wrote: > On Mon, 2006-07-24 at 22:19 -0700, Anoop wrote: > > Hi All > > > > I am getting two different outputs when i do an operation using > > string.digits and test.isdigit(). Is there any difference between the > > two. I have given the sample program and the output > > > > Thanks

Re: Don't use __slots__! (was Re: dicts vs classes)

2006-07-25 Thread Roy Smith
>Guido sez: > > __slots__ is a terrible hack with nasty, hard-to-fathom side > effects that should only be used by programmers at grandmaster and > wizard levels. Unfortunately it has gained an enormous undeserved > popularity amongst the novices and apprentices, who should know >

Re: print function question

2006-07-25 Thread Simon Forman
Bertrand-Xavier M. wrote: > On Tuesday 25 July 2006 05:52, Eric Bishop wrote: > > Why does this work: > > > > # start > > a = 5 > > > > print a, 'is the number' > > > > #end, prints out "5 is the number" > > > > But not this: > > > > # start > > > > a = 5 > > > > print a 'is the number' > > > > #en

Re: smtplib timeout

2006-07-25 Thread Stuart D. Gathman
On Tue, 25 Jul 2006 09:21:40 -0700, Alan Kennedy wrote: > [Stuart D. Gathman] >> I need to set a timelimit for the operation of >> smtplib.sendmail. It has to be thread based, because pymilter uses >> libmilter which is thread based. > > Have you tried setting a default socket timeout, which app

Re: an "urgent" answer to a simple question

2006-07-25 Thread Tim Chase
> I need to install Python Imaging Library (PIL) - > imaging-1.1.5.tar.gz (source ) onto Suse Linux 10.1 system in > order for (latest) Scribus 1.3.3.2 to install and work. Not being a Suse user, I'm flying by the seat of my pants. My recommendation: Install debian, and use "apt-get install pytho

Re: How to force a thread to stop

2006-07-25 Thread Paul Rubin
"Carl J. Van Arsdall" <[EMAIL PROTECTED]> writes: > I'd be all for using processes but setting up communication between > processes would be difficult wouldn't it? I mean, threads have > shared memory so making sure all threads know the current system > state is an easy thing. With processes woul

Re: simple question

2006-07-25 Thread Schüle Daniel
Steve Holden schrieb: > Maxine Weill wrote: >> I need to install Python Imaging Library (PIL) - imaging-1.1.5.tar.gz >> (source ) onto Suse Linux 10.1 system in order for (latest) Scribus >> 1.3.3.2 to install and work. >> >> Plesae indicate how I perform PIL install (exact commands/procedures)

Re: doctest with variable return value

2006-07-25 Thread Peter Otten
3KWA wrote: > I am wondering what is the standard doctest (test) practice for > functions who's returned value change all the time e.g. forex rate: > > import urllib > > def get_rate(symbol): > """get_rate(symbol) connects to yahoo finance to return the rate of > symbol. > > >>>get_rate

self question

2006-07-25 Thread Schüle Daniel
Hi all, given python description below import random class Node: def __init__(self): self.nachbarn = [] class Graph(object): # more code here def randomizeEdges(self, low=1, high=self.n): pass graph = Graph(20) graph.randomizeEdges(2

Re: Generating all possible combination of elements in a list

2006-07-25 Thread Martin v. Löwis
Mir Nazim wrote: > condition are there cannot be more than 3 consecutive 2's or 1's > >> If the task is to produce all distinct permutations of 6 occurrences >> of 1 and 6 occurrences of 2, I suggest the program below. It needs >> produces much fewer than 12! results (namely, 924). >> > > Yes tha

Re: self question

2006-07-25 Thread dan . gass
> cnt = 1 > def foo(): > global cnt > cnt += 1 > return cnt > > def bar(x=foo()): > print x > > bar() # 2 > bar() # 2 > bar() # 2 Looks to me like you want to use the following programming pattern to get dynamic default arguments: cnt = 1 def foo(): global cnt

Re: Grail not downloading

2006-07-25 Thread Martin v. Löwis
Dustan wrote: > I appreciate the info. I couldn't exactly attempt to download the files > manually, though. ;) Learn to use CVS, then go to http://sourceforge.net/cvs/?group_id=6416 Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing Baseball Stats

2006-07-25 Thread Paul McGuire
"Anthra Norell" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > Below your solution ready to run. Put get_statistics () in a loop that feeds it the names from your file, makes an ouput file > name from it and passes both 'statistics' and the ouput file name to file_stati

Python and C++

2006-07-25 Thread KraftDiner
What ways can I call my C++ classes from within Python. I've looked at boost but it would appear that there is little support or knowledge on boost in the python community. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and Boost.

2006-07-25 Thread Roman Yakovenko
On 25 Jul 2006 08:01:30 -0700, KraftDiner <[EMAIL PROTECTED]> wrote: > Hi, I'm trying to call a C++ class from python. > I've looked around and the solution would appear to be boost. Right! > I'm not sure but maybe I've downloaded and installed the entire boost > library, > when there is probably

  1   2   >