Re: Python in debug version?

2004-12-07 Thread mep
Hi,
There is a columen named "Debug" for python.exe and python23.dll."Yes"
is there.
And if you open python.exe or python23.dll, you'll see:

C:\sf\python\dist23\src\PCbuild\python.pdb

at the tail of file.That means a debug version?

-- 
Best Regards,
Wang Kebo

http://www.huihoo.org/~mep


"Martin v. Löwis" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> mep wrote:
> > I view my python 2.3.4 from python.org by VC6's dependency walker
tool.
> > What suprise me is that python.exe and python32.dll are built into
*DEBUG*
> > version.
>
> What precisely did the tool report? To my knowledge, the DLLs are not in
> the debug version.
>
> Regards,
> Martin



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Trying to understand a little python

2004-12-07 Thread Nick Coghlan
McCarty, Greg wrote:
Ok, I'm new to python, and I'm trying to come to grips with a few things.
Got
lots of years of experience with Java and asp/aspx, etc.  Trying to relate
Python's behavior to what I already know.
You may find the following a useful overview of how class & instance attributes 
work:
http://mail.python.org/pipermail/python-list/2004-November/251782.html

(Keep in mind that I'm only considering 'normal' attributes in that message - it 
covers the behaviour in most cases, but not quite all. When things stop behaving 
as you expect based on this description, the relevant word is almost certainly 
"descriptors")

Cheers,
Nick.
--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list


Re: Trying to understand a little python

2004-12-07 Thread John Thingstad
On Tue, 07 Dec 2004 19:07:42 +1000, Nick Coghlan <[EMAIL PROTECTED]>  
wrote:

McCarty, Greg wrote:
Ok, I'm new to python, and I'm trying to come to grips with a few  
things.
Got
lots of years of experience with Java and asp/aspx, etc.  Trying to  
relate
Python's behavior to what I already know.
You may find the following a useful overview of how class & instance  
attributes work:
http://mail.python.org/pipermail/python-list/2004-November/251782.html

(Keep in mind that I'm only considering 'normal' attributes in that  
message - it covers the behaviour in most cases, but not quite all. When  
things stop behaving as you expect based on this description, the  
relevant word is almost certainly "descriptors")

Cheers,
Nick.
www.norvig.com has some insightfull comparisons of Java, Lisp and Python
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--
http://mail.python.org/mailman/listinfo/python-list


Re: cut strings and parse for images

2004-12-07 Thread Andreas Volz
Am Tue, 07 Dec 2004 00:40:02 GMT schrieb Paul McGuire:

> Is this in the ballpark of where you are trying to go?

Yes, thanks. You helped me a lot.

Andreas
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [pywin32] windows shares, was os.listdir("\\\\delta\\public")

2004-12-07 Thread Dermot Doran
Hi Tim,

Something like this is what I think you are looking for:

from win32com.client import Dispatch
theNetwork = Dispatch("WScript.Network")
mappedNetDrives = theNetwork.EnumNetworkDrives
for netDrive in mappedNetDrives():
print netDrive


Should give you some ideas anyway.

Cheers!!

On 6 Dec 2004, at 11:04, Tim Golden wrote:

[Egor Bolonev]
| how to get list of shares using pywin32? 

You want to be looking at the NetShareEnum function
in the win32net module.

TJG


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk

-- 
http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: long number multiplication

2004-12-07 Thread Nick Coghlan
Christopher A. Craig wrote:
i needed to implement this myself and was thinking of storing the digits 
of an integer in a list.

That's sort of what Python does except the "digits" are 15 bits,
not base 10.  Doing it in base 10 would be a huge pain because of the
problems with base 10->base 2 conversion.
Indeed. Python's Decimal data type stores the digits in a list for ease of 
power
of 10 multiplication & rounding (the precision rules means a *lot* of that goes
on). However, it converts that list of digits to a long integer in order to do
addition, multiplication or division.
Cheers,
Nick.
--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list


Re: RPC with Python - Comparison?

2004-12-07 Thread Wolfgang Keller
Am 6 Dec 2004 16:00:35 -0800 schrieb has:

> Wolfgang Keller wrote:
> 
>>> MacPython also supports Apple events
>>
>> I know, but I was thinking of OS-independent RPC protocols. :-)
> Pity, you're missing some good stuff... :/

_I_ _am_ using a Mac at home.

But not _everyone_ _else_ and especially not _every_ _company_ is using
_exclusively_ Macs.

Best regards,

Wolfgang Keller
-- 
http://mail.python.org/mailman/listinfo/python-list


How to Refresh a Page Template using python in zope server

2004-12-07 Thread ganesh9001892

hai,
  I have a problem while refreshing the stored contents from zope 
database(zodb).java script command location.reload() doesnot work 
out.Is there any other way to refresh the page 

waiting for a Reply

From,
S.GANESH
 



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Deadlock detection

2004-12-07 Thread Duncan Grisby
In article <[EMAIL PROTECTED]>,
Josiah Carlson  <[EMAIL PROTECTED]> wrote:
>
>Duncan Grisby <[EMAIL PROTECTED]> wrote:

>> Does anyone know of a deadlock detector for Python?  I don't think it
>> would be too hard to hook into the threading module and instrument
>> mutexes so they can be tested for deadlocks. I've googled around but I
>> haven't found anything.
>
>I'm not aware of a deadlock dector for any language.  I propose that a
>completely working deadlock detector is NP-Complete, as it would, I
>believe, necessitate solving the halting problem.

As Paul Du Bois has pointed out, NP complete is much easier than the
halting problem (i.e. the halting problem simply can't be done in
general, no matter how much time you have).

Aside from that, you're right that statically analysing code for
deadlocks is equivalent to the halting problem, and therefore
impossible. What I'm looking for, though, is a dynamic detector that
detects deadlocks at run-time when they happen. Doing that is well
understood, and there are plenty of systems that do it. I just haven't
been able to find one for Python.

Cheers,

Duncan.

-- 
 -- Duncan Grisby --
  -- [EMAIL PROTECTED] --
   -- http://www.grisby.org --
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help with super()

2004-12-07 Thread Florian Lindner
Steven Bethard schrieb:
Christopher J. Bottaro wrote:
Why don't this code work?
import PRI
class Poscdnld_PYIO(PRI.BasicBatch):
  def __init__(self, *argv):
  super(Poscdnld_PYIO, self).__init__(*argv)
x = Poscdnld_PYIO()
I get this exception:
File "poscdnld_pyio.py", line 52, in __init__
super(Poscdnld_PYIO, self).__init__(*argv)
TypeError: super() argument 1 must be type, not classobj
What am I doing wrong?  Thanks.
I don't know what PRI is, but I suspect that PRI.BasicBatch is a classic 
class, not a new-style class.  The super function only works for 
new-style classes:
Never heard of new-stype and classiv-class... What are the differences?
Thx,
Florian
--
http://mail.python.org/mailman/listinfo/python-list


Re: Win32 Libs for 2.4

2004-12-07 Thread Robin Becker
Martin v. Löwis wrote:
Robin Becker wrote:
I thought that static .libs didn't make reference to the dll's they 
need; isn't that done at load time?

Unfortunately, thanks to Microsoft's infinite wisdom, static libs
*do* reference DLLs. The C lib headers contain things like
#pragma lib("msvcrt.lib") // or some such
according to my docs
there's something called a comment pragma used thusly
#pragma comment( lib, "xxx.lib" )
which places a search record into the obj file. I don't think this forces the 
linker to load stuff from this module although I can see that it might be 
dangerous depending on which obj files are seen first.


The compiler translates this into a reference to the DLL in the
object file, which the linker will then translate into a reference
to the DLL when linking, even if the DLL was not giving on the linker
command line.
I believe this is a weak reference from the documentation.
However, I am uncertain how this works with multiple VC versions -
whether the DLL reference is CRT version independent or not.
You should view the resulting extension module in depends.exe,
and check whether it refers to multiplce CRT dlls (which would be
bad).
well in my 2.4 _imaging.pyd I see direct references to only msvcr71.dll,
but there is a direct reference to USER32.dll which references ADVAPI32.dll
which references WINTRUST.dll which then references msvcrt.dll. Fortunately I 
don't think this is a problem as Python24.dll also references USER32.dll directly.

Perhaps a genius level cretifiable (whoops Freudian mispelling of certified) 
knows whether this is OK.


Regards,
Martin

--
Robin Becker
--
http://mail.python.org/mailman/listinfo/python-list


win32 extensions for Python 2.4

2004-12-07 Thread Ishwor
Hello all,
  I was looking through Mark Hammond's website for win32 extensions
for Python 2.4 but couldn't find it. If i am not wrong has anyone any
idea when it will be available or is it being worked on? The
activestate's version of Python has win32 extension but i won't be
bothered to download it. :)

-- 
cheers,
Ishwor Gurung
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: win32 extensions for Python 2.4

2004-12-07 Thread Simon Brunning
On Tue, 7 Dec 2004 21:25:03 +1030, Ishwor <[EMAIL PROTECTED]> wrote:
> Hello all,
>   I was looking through Mark Hammond's website for win32 extensions
> for Python 2.4 but couldn't find it. If i am not wrong has anyone any
> idea when it will be available or is it being worked on? The
> activestate's version of Python has win32 extension but i won't be
> bothered to download it. :)

They are at Sourceforge these days -
.

-- 
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: win32 extensions for Python 2.4

2004-12-07 Thread Nick Coghlan
Ishwor wrote:
Hello all,
  I was looking through Mark Hammond's website for win32 extensions
for Python 2.4 but couldn't find it. If i am not wrong has anyone any
idea when it will be available or is it being worked on? The
activestate's version of Python has win32 extension but i won't be
bothered to download it. :)
It's on the sourceforge download page. So long as you don't want to use 
Pythonwin, version 203 should work fine.

Cheers,
Nick.
--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list


Re: win32 extensions for Python 2.4

2004-12-07 Thread Ishwor
On Tue, 07 Dec 2004 21:00:22 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote:
> Ishwor wrote:
> 
> 
> > Hello all,
> >   I was looking through Mark Hammond's website for win32 extensions
> > for Python 2.4 but couldn't find it. If i am not wrong has anyone any
> > idea when it will be available or is it being worked on? The
> > activestate's version of Python has win32 extension but i won't be
> > bothered to download it. :)
> > 
> It's on the sourceforge download page. So long as you don't want to use
> Pythonwin, version 203 should work fine.
> 

arggh... got the wrong version.. ;-)
Thanks heaps.

> Cheers,
> Nick.
[snip]

-- 
cheers,
Ishwor Gurung
-- 
http://mail.python.org/mailman/listinfo/python-list


Upgrading Python Article

2004-12-07 Thread Michael Foord
http://www.voidspace.org.uk/python/articles/upgrading_python.html

I've been looking at whether to upgrade immediately from Python 2.3 to
Python 2.4 or postpone it. This is my first `major version change`, so
I've come up against the usual windoze (tm) problem - upgrading python
breaks all my extension modules.

I've been looking into the issues, what modules do I use, can I
compile them myself ? etc... and the result is a brief article on the
issues round upgrading.

I thought I would share (awww aint that nice).

Flames welcomed.

Regards,


Fuzzy

http://www.voidspace.org.uk/atlantibots/pythonutils.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pre-PEP generic objects

2004-12-07 Thread Jacek Generowicz
Carlos Ribeiro <[EMAIL PROTECTED]> writes:

> On 06 Dec 2004 10:09:25 +0100, Jacek Generowicz
> <[EMAIL PROTECTED]> wrote:
> [great explanation about function descriptors]
> 
> Thanks. Now I know more about function descriptors than I ever wanted
> to :-) With a little polish,

Yeah, replace the two relevant instances of "it's" with "its" for a
start. It makes me cringe reading through it!

> this post would make a great addition to the descriptors
> documentation, don't you think?

I'm not sure what an appropriate place for it would be, and I don't
really have time to find out; if you do, feel free to use the material.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python in debug version?

2004-12-07 Thread Wolfgang Langner
Hello,
Hi,
There is a columen named "Debug" for python.exe and python23.dll."Yes"
is there.
And if you open python.exe or python23.dll, you'll see:
C:\sf\python\dist23\src\PCbuild\python.pdb
at the tail of file.That means a debug version?
No, that means to this file are debug symbols available in python.pdb.
It's possible to compile a release version with debug symbols to get more
infos if something crash's.
Debug version of python needs python23_d.dll.
bye by Wolfgang
--
http://mail.python.org/mailman/listinfo/python-list


Re: regex syntax

2004-12-07 Thread James Stroud
Ich kann nicht spricht Deutch, aber:

import re

regex = re.compile(r'(.*)(\.jpg)$')

m = regex.match("bild.jpg")

g = m.groups()

print g[0]
print g[1]


Auf wiedersehen!
James

On Monday 06 December 2004 04:03 pm, Andreas Volz wrote:
> Hi,
>
> ich kann nicht gut regex, aber für das nötigste reicht es eigentlich.
> Irgendwie komm ich aber mit der Syntax der re.* Befehle in Python nicht
> klar Vielleicht kann mir das an diesem Beispiel jemand zeigen:
>
> string = "bild.jpg"
>
> ich möchte jetzt einfach wissen ob in dem string ein ".jpg" vorkommt
> oder nicht und dann eine Entscheidung treffen. Ich hab mir schon
> überlegt einfach die letzten viel Stellen des strings "per Hand" auf die
> Zeichenfolge zu vergleichen und so regex zu umgehen. Aber ich muss es
> irgendwann ja doch mal nutzen ;-)
>
> Gruß
> Andreas

-- 
James Stroud, Ph.D.
UCLA-DOE Institute for Genomics and Proteomics
611 Charles E. Young Dr. S.
MBI 205, UCLA 951570
Los Angeles CA 90095-1570
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list


Re: regex syntax

2004-12-07 Thread jstroud
Ich kann nicht spricht Deutch, aber:

import re

regex = re.compile(r'(.*)(\.jpg)$')

m = regex.match("bild.jpg")

g = m.groups()

print g[0]
print g[1]


Auf wiedersehen!
James

On Monday 06 December 2004 04:03 pm, Andreas Volz wrote:
> Hi,
>
> ich kann nicht gut regex, aber für das nötigste reicht es eigentlich.
> Irgendwie komm ich aber mit der Syntax der re.* Befehle in Python nicht
> klar Vielleicht kann mir das an diesem Beispiel jemand zeigen:
>
> string = "bild.jpg"
>
> ich möchte jetzt einfach wissen ob in dem string ein ".jpg" vorkommt
> oder nicht und dann eine Entscheidung treffen. Ich hab mir schon
> überlegt einfach die letzten viel Stellen des strings "per Hand" auf die
> Zeichenfolge zu vergleichen und so regex zu umgehen. Aber ich muss es
> irgendwann ja doch mal nutzen ;-)
>
> Gruß
> Andreas

-- 
James Stroud, Ph.D.
UCLA-DOE Institute for Genomics and Proteomics
611 Charles E. Young Dr. S.
MBI 205, UCLA 951570
Los Angeles CA 90095-1570
http://www.jamesstroud.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: RPC with Python - Comparison?

2004-12-07 Thread has
Wolfgang Keller wrote:
> Am 6 Dec 2004 16:00:35 -0800 schrieb has:
>
> > Wolfgang Keller wrote:
> >
> >>> MacPython also supports Apple events
> >>
> >> I know, but I was thinking of OS-independent RPC protocols. :-)
> > Pity, you're missing some good stuff... :/
>
> _I_ _am_ using a Mac at home.
>
> But not _everyone_ _else_ and especially not _every_ _company_ is
using
> _exclusively_ Macs.

Of course. Would it be tactless to mention you're also missing out on
DCOM and WSH? ;)

has 

(p.s. Seriously, why not just cover everything? Platform(s) support is
just another feature.)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: RPC with Python - Comparison?

2004-12-07 Thread has
Wolfgang Keller wrote:
> Am 6 Dec 2004 16:00:35 -0800 schrieb has:
>
> > Wolfgang Keller wrote:
> >
> >>> MacPython also supports Apple events
> >>
> >> I know, but I was thinking of OS-independent RPC protocols. :-)
> > Pity, you're missing some good stuff... :/
>
> _I_ _am_ using a Mac at home.
>
> But not _everyone_ _else_ and especially not _every_ _company_ is
using
> _exclusively_ Macs.

Of course. Would it be tactless to mention you're also missing out on
DCOM and WSH?



has

(p.s. Seriously, why not just cover everything? Platform(s) support is
just another feature.)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: regex syntax

2004-12-07 Thread Daniel Dittmar
Andreas Volz wrote:
string = "bild.jpg"
ich möchte jetzt einfach wissen ob in dem string ein ".jpg" vorkommt
oder nicht und dann eine Entscheidung treffen. Ich hab mir schon
überlegt einfach die letzten viel Stellen des strings "per Hand" auf die
Zeichenfolge zu vergleichen und so regex zu umgehen. Aber ich muss es
irgendwann ja doch mal nutzen ;-)
1.) If someone else should read your code:
import os
def hasExt (filename, expectedExtension):
actualExtension = os.path.splitext (filename) [1]
return actualExtension == expectedExtension
if hasExt ("build.jpg", ".jpg"):
...
2.) Debugging regular expression:
Just remove meaningful chunks from the end of the expression until you 
have an expected match. Then add them again one by one, most problems 
will become quite obvious. And how do I wish there was a debug mode that 
would make that somewhat automatic.

Daniel
--
http://mail.python.org/mailman/listinfo/python-list


Problems getting TwistedMatrix

2004-12-07 Thread Lucas Raab
Has anybody who has recently downloaded Twisted seem to have any 
problems with downloading it?? I'm a dial-up user (which might be why) 
and whenever I click the link to download it it takes 30+ for a 1.8 MB 
file, which should take only about 7-10.
--
http://mail.python.org/mailman/listinfo/python-list


Unknown locale nb_NO ?

2004-12-07 Thread Stas Z
Hello,

Just noticed that the locale 'nb_NO' is not supported in Python?!

[EMAIL PROTECTED]:~$ locale
LANG=nb_NO
[...]

[EMAIL PROTECTED]:~$ python
Python 2.3.4 (#2, Sep 24 2004, 08:39:09) 
[GCC 3.3.4 (Debian 1:3.3.4-12)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.getdefaultlocale()
Traceback (most recent call last):
  File "", line 1, in ?
  File "/usr/lib/python2.3/locale.py", line 346, in getdefaultlocale
return _parse_localename(localename)
  File "/usr/lib/python2.3/locale.py", line 280, in _parse_localename
raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: nb_NO
>>> 

Any help would appreciated.

Thanks,
Stas


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help with super()

2004-12-07 Thread Andy Gross
Florian,
See: http://www.python.org/doc/newstyle.html
/arg
On Dec 7, 2004, at 5:38 AM, Florian Lindner wrote:
Steven Bethard schrieb:
Christopher J. Bottaro wrote:
Why don't this code work?
import PRI
class Poscdnld_PYIO(PRI.BasicBatch):
  def __init__(self, *argv):
  super(Poscdnld_PYIO, self).__init__(*argv)
x = Poscdnld_PYIO()
I get this exception:
File "poscdnld_pyio.py", line 52, in __init__
super(Poscdnld_PYIO, self).__init__(*argv)
TypeError: super() argument 1 must be type, not classobj
What am I doing wrong?  Thanks.
I don't know what PRI is, but I suspect that PRI.BasicBatch is a 
classic class, not a new-style class.  The super function only works 
for new-style classes:
Never heard of new-stype and classiv-class... What are the differences?
Thx,
Florian
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list


Re: Unknown locale nb_NO ?

2004-12-07 Thread Ola Natvig
Stas Z wrote:
Hello,
Just noticed that the locale 'nb_NO' is not supported in Python?!
[EMAIL PROTECTED]:~$ locale
LANG=nb_NO
[...]
[EMAIL PROTECTED]:~$ python
Python 2.3.4 (#2, Sep 24 2004, 08:39:09) 
[GCC 3.3.4 (Debian 1:3.3.4-12)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import locale
locale.getdefaultlocale()
Traceback (most recent call last):
  File "", line 1, in ?
  File "/usr/lib/python2.3/locale.py", line 346, in getdefaultlocale
return _parse_localename(localename)
  File "/usr/lib/python2.3/locale.py", line 280, in _parse_localename
raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: nb_NO
Any help would appreciated.
Thanks,
Stas

I believe the standard locale for "Norsk bokmål" is 'no_NO'. You could 
try that.

Ola
--
--
 Ola Natvig <[EMAIL PROTECTED]>
 infoSense AS / development
--
http://mail.python.org/mailman/listinfo/python-list


Re: Problems getting TwistedMatrix

2004-12-07 Thread donnal
I just downloaded it yesterday, and it was very fast.
Donnal Walter
Arkansas Children's Hospital

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: Wing IDE 2.0.1 released

2004-12-07 Thread Laura Creighton
Congratulations!

Laura
-- 
http://mail.python.org/mailman/listinfo/python-list


cookie lib policy how-tp?

2004-12-07 Thread Riko Wichmann
dear all,
i try to retrieve information from a secure web site. I use cookielib 
and urllib2 for this exercise which works to a certain level. I can 
authenticate myself and read the top-level page.

However, from here I need to load a page which is dynamically build from 
information available from the page source on the top level. The desired 
info is inside a  tag which seems to be used by a javascript 
routine. But when I look at the page source retrieved with urllib2, the 
information I need to build the next URL is mssing.

When I use opera to access this page by hand and look at the sources, I 
see the full sources when letting opera identify itself as MSIE 6.0. 
When using Mozilla 5.0 I get the same in-complete source file as with 
python.
The desired info is included in a  tag.

Also, when accessing the web page using opera with those two identities, 
I'm asked to accept 2 cookies in case of MSIE6.0 and only one for 
mozilla. So, I suspect, the problem is somehow related to the cookies 
(maybe!?).

I saw, that I can chance the cookie policy in cookielib. Maybe that will 
do the job. However, I don't quite understand what I have to do for that.

Any hints or other thoughts are greatly appreciated.
Thanks and cheers,
Riko
--
http://mail.python.org/mailman/listinfo/python-list


Re: Problems getting TwistedMatrix

2004-12-07 Thread Donnal Walter
Lucas Raab wrote:
Has anybody who has recently downloaded Twisted seem to have any 
problems with downloading it?? I'm a dial-up user (which might be why) 
and whenever I click the link to download it it takes 30+ for a 1.8 MB 
file, which should take only about 7-10.
I just downloaded Twisted yesterday and had no problem. I don't recall 
the exact amount of time, but it seemed very fast.

Donnal Walter
--
http://mail.python.org/mailman/listinfo/python-list


Re: using cmd.exe as a telnet client

2004-12-07 Thread Jp Calderone
On Mon, 06 Dec 2004 12:52:31 -0600, Donnal Walter <[EMAIL PROTECTED]> wrote:
>I wrote:
> > I've been wanting to get acquainted with Twisted for awhile
> > now, ... BTW, do you know if Twisted's option negotiation
> > uses a callback function? I might download it to take a look, ...
> 
> Sorry I did not do this earlier, before I posted. It is obvious (now 
> that I have downloaded it) that Twisted's Telnet implementation is based 
> on its own Protocol base class (nice design). The only documentation I 
> have been able to find, however, is in the protocols/telnet module 
> itself. It is still not immediately obvious (to me) how to use the iac* 
> methods to negotiate these options. Any help is much appreciated.
> 
> (I've not given up on writing my own funtion for Python's telnetlib, but 
> I'm trying to keep all my options open. Besides, I will probably have 
> other uses for Twisted later.)

  The iac_FOO method will be called whenever the telnet command FOO is received 
with the command's "argument" (the byte following it) as its only argument.  
When a subnegotiation is received, iacSBchunk is called.

  That's the 1.3 API, anyway.  It will still exist in 2.0, but it is lookingly 
increasingly likely that the new version will be ready in time for 2.0.  With 
the new API, the enableLocal() method is invoked when an option negotiation 
initiated by this side of the connection is allowed by the remote side, and 
enableRemote() is invoked when the remote side has requested an option be 
enabled (it can return true or false to allow or deny the enabling).  Similar 
disableLocal() and disableRemote() methods exist.  Callbacks can be registered 
for subnegotiation, based on the command for which the subnegotiation is 
negotiating options.  There are also do() and dont() methods that return 
Deferreds.  There's a whole bunch of other new cool features too, but I've 
probably gone on long enough, especially for a module that hasn't even been 
released :)

  Jp
-- 
http://mail.python.org/mailman/listinfo/python-list


Loading a file only once into an object and being able to access it from other modules

2004-12-07 Thread Philippe C. Martin
This is a basic question I'm sure but I do not know wether to use __builtin__, 
global, or a static method: 

I have a very large XML file that I load into dictionnaries defined in a class 
located in a module that is imported in many places.

Since the loading process is very slow, I would like the file not to be loaded 
on import or class instantiation, but only once (on first import or class 
instantiation).

Currently I have the loading code in the class __init__.


Is there a clean way to do this (I'd like to avoid global)?


Regards,

Philippe


-- 
*
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
*
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Loading a file only once into an object and being able to access it from other modules

2004-12-07 Thread Remy Blank
Philippe C. Martin wrote:
> I have a very large XML file that I load into dictionnaries defined in a 
> class 
> located in a module that is imported in many places.
> 
> Since the loading process is very slow, I would like the file not to be 
> loaded 
> on import or class instantiation, but only once (on first import or class 
> instantiation).

What about:

class MyClass:
hugeDict = loadHugeDic("filename.xml")

def __init__(self):
"""hugeDict can be accessed by self.hugeDict"""
...

The function loadHugeDict() will only be called once, when importing the
module for the first time. If you wanted to load it on the first
*instantiation*, you could do:

class MyClass:
hugeDict = None

def __init__(self):
if MyClass.hugeDict is None:
MyClass.hugeDict = loadHugeDic("filename.xml")
...

HTH.
-- Remy


Remove underscore and suffix in reply address for a timely response.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Loading a file only once into an object and being able to access it from other modules

2004-12-07 Thread Thomas Guettler
Am Tue, 07 Dec 2004 09:25:57 -0600 schrieb Philippe C. Martin:

> This is a basic question I'm sure but I do not know wether to use 
> __builtin__, 
> global, or a static method: 
> 
> I have a very large XML file that I load into dictionnaries defined in a 
> class 
> located in a module that is imported in many places.
> 
> Since the loading process is very slow, I would like the file not to be 
> loaded 
> on import or class instantiation, but only once (on first import or class 
> instantiation).
> 
> Currently I have the loading code in the class __init__.

Hi,

You have this module (mymod.py)

print "First import"
xmlfile=

If you import mymod the second time, you
won't see "First import" again. The code
without indentation gets executed only once.

You can access your file with mymod.xmlfile.

HTH,
 Thomas


-- 
Thomas Güttler, http://www.thomas-guettler.de/


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Loading a file only once into an object and being able to access it from other modules

2004-12-07 Thread Andrew James
You're looking for the Singleton pattern to ensure that only one 
instance of your class is instantiated at a time. There's a particularly 
useful discussion about this at:

http://c2.com/cgi/wiki?PythonSingleton
I suggest you try the different methods out and pick the one best suited 
to your situation.

HTH,
Andrew
Philippe C. Martin wrote:
This is a basic question I'm sure but I do not know wether to use __builtin__, 
global, or a static method: 

I have a very large XML file that I load into dictionnaries defined in a class 
located in a module that is imported in many places.

Since the loading process is very slow, I would like the file not to be loaded 
on import or class instantiation, but only once (on first import or class 
instantiation).

Currently I have the loading code in the class __init__.
Is there a clean way to do this (I'd like to avoid global)?
Regards,
Philippe

--
http://mail.python.org/mailman/listinfo/python-list


Re: Unknown locale nb_NO ?

2004-12-07 Thread Stas Z
On Tue, 07 Dec 2004 15:22:00 +0100, Ola Natvig wrote:

> Stas Z wrote:
>> Hello,
>> 
>> Just noticed that the locale 'nb_NO' is not supported in Python?!
>> 
[...]
> I believe the standard locale for "Norsk bokmål" is 'no_NO'. You could 
> try that.
When I 'googled' for it, I saw that no_NO has become nn_NO/nb_NO.
However it strikes me as odd, that Python2.3.4 raises an exception when
querying for a valid locale. I tend to call it a bug :-(

Stas
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: cookie lib policy how-tp?

2004-12-07 Thread Jonathan Ellis
Riko Wichmann wrote:
>
> When I use opera to access this page by hand and look at the sources,
I
> see the full sources when letting opera identify itself as MSIE 6.0.
> When using Mozilla 5.0 I get the same in-complete source file as with

> python.

Sounds like your first step should be to identify yourself as IE.

opener = urllib2.build_opener(...)
opener.addheaders = [("User-Agent", "whatever IE calls itself these
days")]

-Jonathan

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: regex syntax

2004-12-07 Thread Andreas Volz
Am Mon, 6 Dec 2004 17:24:35 -0800 (PST) schrieb [EMAIL PROTECTED]:

> Ich kann nicht spricht Deutch, aber:

Ahh! Sorry for this! It was a mistake :-(

regards
Andreas
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: regex syntax

2004-12-07 Thread Andreas Volz
Am 6 Dec 2004 17:43:21 -0800 schrieb [EMAIL PROTECTED]:

> viel besser als das vergleichbare Regexp:
> 
> >>> re.match('.*\.jpg$', filename)

Ok,now  I've choosen this regex:

> '.*\.(?i)jpe?g'

to get .jpg .JPG .jpeg .JPEG

seems to work. Is this correct?

regards
Andreas
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: cookie lib policy how-tp?

2004-12-07 Thread Riko Wichmann
Jonathan Ellis wrote:
Riko Wichmann wrote:
When I use opera to access this page by hand and look at the sources,
I
see the full sources when letting opera identify itself as MSIE 6.0.
When using Mozilla 5.0 I get the same in-complete source file as with

python.

Sounds like your first step should be to identify yourself as IE.
opener = urllib2.build_opener(...)
opener.addheaders = [("User-Agent", "whatever IE calls itself these
days")]
-Jonathan
Tried that already. At least, I hope I guessed at least one of the 
possible identifiers correct: MSIE6.0, MSIE 6.0, MSIE/6.0
Unfortunately no different. I also tried to define my cookiejar as a 
MSIE cookiejar. However, since I'm working under Linux, I'm not sure 
that even works, even though there was no complain:

#
import ClientCookie, urllib
cj = ClientCookie.MSIECookieJar()
self.opener = 
ClientCookie.build_opener(ClientCookie.HTTPCookieProcessor(cj))
self.opener.addheaders = [('User-Agent', 'MSIE6.0')]
# set login parametes ...
parameters = urllib.urlencode({"~login" : "XX", "~password" : 
"XX"})

f = self.opener.open('https:myhost', parameters)
#
--
http://mail.python.org/mailman/listinfo/python-list


Re: Loading a file only once into an object and being able to access it from other modules

2004-12-07 Thread Philippe C. Martin
Thank you all for your answers, I guess I would not have made Python 101:-)

As far as I was concerned, importing a module twice would have resulted in 
loading the file twice.

Regards,

Philippe



-- 
*
Philippe C. Martin
SnakeCard LLC
www.snakecard.com
*
-- 
http://mail.python.org/mailman/listinfo/python-list


TwistedMatrix everywhere!!

2004-12-07 Thread Ishwor
Hello all,
  Since i see alot of talks abt TwistedMatrix these days, i just
checked its website to see what it is all about ( I am still learning
Python). Anyway my point here is that for running the examples
( in http://twistedmatrix.com/documents/current/examples/ ), I'll have
to get the various different Twisted modules ( from Twisted import
Transport etc...) . I was wondering if that could be done like Java's
WebStart like loading all the modules on the fly?? Is there any such
implementation which exists in Python- any module which can load any
Python Source and compile any other dependent modules on the fly at
client side?? Any ideas are greatly welcomed ~:-)


-- 
cheers,
Ishwor Gurung
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: embedded python and interpreter threads

2004-12-07 Thread Charlie DeTar
Woohoo, fixed my problem.  It had to do with the way I was handling the 
methods which overwrote stderr and stdout.  Yeehaw!

=Charlie
Charlie DeTar wrote:
Quick correction, sorry - the command should read like this (I had 
omitted the "log" before 'CaptureStdout' and 'CaptureStderr').  Same 
problems exist.

 PyRun_SimpleString(
 "import log\n"
 "import sys\n"
 "class StdoutCatcher:\n"
 "\tdef write(self, str):\n"
 "\t\tlog.CaptureStdout(str)\n"
 "class StderrCatcher:\n"
 "\tdef write(self, str):\n"
 "\t\tlog.CaptureStderr(str)\n"
 "sys.stdout = StdoutCatcher()\n"
 "sys.stderr = StderrCatcher()\n");
=Charlie
Charlie DeTar wrote:
So, I have an amazing, functioning foobar class that embeds python. 
Only trouble is, I want to be able to have multiple foobar objects at 
once, each with their own interpreters, stdouts, and stderrs.

My initialization of the python interpreter in the class "x" is as 
follows:
[snip]
if (!Py_IsInitialized()) {
PyEval_InitThreads();
Py_Initialize();
}   // Start and switch to a new interpreter thread.
x->thread = Py_NewInterpreter();

// initialize the module 'logMethods', defined elsewhere,
// which contains my stdout and stderr definitions
Py_InitModule("log", logMethods);
// overwrite Python's stdout and stderr
PyRun_SimpleString(
"import log\n"
"import sys\n"
"class StdoutCatcher:\n"
"\tdef write(self, str):\n"
"\t\t.CaptureStdout(str)\n"
"class StderrCatcher:\n"
"\tdef write(self, str):\n"
"\t\t.CaptureStderr(str)\n"
"sys.stdout = StdoutCatcher()\n"
"sys.stderr = StderrCatcher()\n");
--
http://mail.python.org/mailman/listinfo/python-list


Re: How is Python designed?

2004-12-07 Thread Diez B. Roggisch
Hi,

> it is executed. In this technique, indeed, checking
> patterns is a little complicated. In Yuan this part is
> not optimally implemented, somethings have to be
> improved or changed.

why did you choose that technique and not a common parser generator? The
kind of parsing you use is somewhat oldfashioned - back in the times where
parsing theory wasn't evolved enough. The disadvantage is that without a
proper theory and a grammar explaining what statements are legal and
meaningful and which not is uneccessary complicated.

Look into the python language reference how use is made of a grammar to
explain language constructs.

> I supposed you would have done like:
> class node{
> ...
> char oper;
> node *left,*right;
> void compute();
> };
> void node::compute()
> {
>if(left) left->compute();
>if(right) right->compute();
>if(oper=='+'){
>   
>}else if(...){
>   
>}
> }
> This is a kind of recursive evaluation of arithmetic
> tree. Now I believe that's not what you have used.
> Ah, yes. That's exactly what I mean.

That is what I meant. But thats not recursive - the compute-calls account
for the tree-traversal. Nothing recursive there. 

> That's avoidable, using depth first seach.

No. Traversal is traversal. A tree of size n needs O(n) to be traversed -
otherwise you missed some nodes. 

You can of course cache the results of a tree traversal in a list, and call
the compute method then in a loop:

for node in nodelist:
??? = node.compute()

But then you need to explicitely deal with where to store the resulting
values of that computation, so you can access them lateron. That will most
probably eat up the time saved by using that cache.

> 
> It seemed to me that it made much difference in
> efficiency so that I reimplemented it by depth-first
> search. Maybe because I didn't implement the recursive
> evaluation properly :), I will check.

As I said before: AST traversal is post-order with a stack/lifo as node
container, deepth-first is using a queue/fifo instead - but there is _no_
gain in terms of speed here - both have to visit all nodes.

There is no reason to change you running system - but your hopes for more
performance that way aren't fulfilled either.

-- 
Regards,

Diez B. Roggisch
-- 
http://mail.python.org/mailman/listinfo/python-list


PythonWin32 issue with McMillan Installer (6a2) and WMI

2004-12-07 Thread bschollnick
Folks,

I have run into a strange problem, that I have not been able to solve.

I have previously "bundled" this application with Installer
successfully.
Just recently though, I tried, and ran into a issue.

Yes, I have made changes, but nothing I would expect this level of
issue with...
Mainly upgrading to Python 2.3.4, and the latest PythonWin32all.

 Example 
import wmi

print "done"
--

The WMI package is  Tim Golden's WMI package...
(http://tgolden.sc.sabren.com/python/wmi.html).

The error is:

C:\develope\versions\distdata_collector_v2>data_collector_v2.exe
Traceback (most recent call last):
File "", line 73, in ?
File
"C:\develope\versions\builddata_collector_v2\out1.pyz/win32com.client.gen
cache", line 520, in EnsureModule
File
"C:\develope\versions\builddata_collector_v2\out1.pyz/win32com.client.gen
cache", line 287, in MakeModuleForTypelib
File
"C:\develope\versions\builddata_collector_v2\out1.pyz/win32com.client.mak
epy", line 273, in GenerateFromTypeLibSpec
File
"C:\develope\versions\builddata_collector_v2\out1.pyz/win32com.client.gen
cache", line 550, in AddModuleToCache
File
"C:\develope\versions\builddata_collector_v2\out1.pyz/win32com.client.gen
cache", line 629, in _GetModule
File "C:\develope\Installer\iu.py", line 318, in importHook
raise ImportError, "No module named %s" % fqname
ImportError: No module named
win32com.gen_py.565783C6-CB41-11D1-8B02-00600806D9B
6x0x1x2


It appears that Installer maybe trying to access material from a
temporary archive...?

Anyone else seen these issues?

I have not yet heard back from Gordon

Now this does work through Py2exe without any problems.
But I prefer the ease of use of Installer over Py2exe
- Benjamin

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: httpconnection class handle 302 redirect?

2004-12-07 Thread Laszlo Zsolt Nagy
Hello Joe,

Tuesday, December 7, 2004, 3:50:53 AM, you wrote:

> Hi , it looks like that HTTPConnection class is not  capable to
> handle 302 redirect response. Is there any sample implementation
> that  tackle this problem? I am using python 2.3.3 on Windows
> platform.

I'm using this method (inside a class). It works fine for me:

def getconnection(self,url,handle_redirects=True,headers={}):
"""Get a httplib connection for the given url.

@param url: Should be a relative path for the HTTP request.
@type url: string
@param handle_redirects: Set this to True if you want to follow 
redirects (301 and 302). (default)
@return: The httplib connection for the specified (or redirected) 
url."""
if url.upper()[:6] == 'HTTPS:':
conn = httplib.HTTPSConnection(self.host)
else:
conn = httplib.HTTPConnection(self.host)
conn.connect()
if not headers.has_key("User-Agent"):
headers["User-Agent"] = self.agent
if handle_redirects:
# Now we handle 301 and 302 too!
conn.request("HEAD", url,headers=headers)
responseOb = conn.getresponse()  ## Grab HTTPResponse Object
if responseOb.status in (301,302,):
url = urlparse.urljoin(url, responseOb.getheader('location', 
''))
conn = self.getconnection(url,True)
return conn


I hope this helps.


-- 
Best regards,
 Laszlo
 mailto:[EMAIL PROTECTED]
 web: http://designasign.biz
 

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Quixote+Nevow+LivePage

2004-12-07 Thread mirnazim
I am really sorry if i sounded a bit bad, i did not mean that.
what i meant was that , i got my answer to Q2 that livepage is for
twisted only. but Q1 and Q2 still stand.

I m sorry again.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Time for : comp.lang.python.newbies ??

2004-12-07 Thread James Stroud

> Maybe a time for a new discussion group along that suggested
> by the Subject line ?


I would hesitate to change too much about this list. I spend about 1 hr. per 
day (probably too much) perusing the technical explanations, musings, and 
rants--and hoping to learn enough to reply with an answer sometimes.

As far as lists go, this is my favorite, and I've subscribed to lists in a 
variety of fields. I'm afraid that scaring off newbies would remove some of 
the charm of this list.


-- 
James Stroud, Ph.D.
UCLA-DOE Institute for Genomics and Proteomics
611 Charles E. Young Dr. S.
MBI 205, UCLA 951570
Los Angeles CA 90095-1570
http://www.jamesstroud.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Time for : comp.lang.python.newbies ??

2004-12-07 Thread Steven Bethard
James Stroud wrote:
As far as lists go, this is my favorite, and I've subscribed to lists in a 
variety of fields. I'm afraid that scaring off newbies would remove some of 
the charm of this list.
Amen. =) And anyway, with a good newsreader, you can just ignore any 
threads that are too "newbie" for you.  I tend to do this a fair bit 
with the threads started by folks who haven't read the "smart questions" 
 essay yet.

Steve
--
http://mail.python.org/mailman/listinfo/python-list


Re: using cmd.exe as a telnet client

2004-12-07 Thread Donnal Walter
Jp Calderone wrote:
The iac_FOO method will be called whenever the telnet command FOO is received with the 
command's "argument" (the byte following it) as its only argument.  When a 
subnegotiation is received, iacSBchunk is called.
That's the 1.3 API, anyway.  It will still exist in 2.0, but it is lookingly increasingly likely that the new version will be ready in time for 2.0.  With the new API, the enableLocal() method is invoked when an option negotiation initiated by this side of the connection is allowed by the remote side, and enableRemote() is invoked when the remote side has requested an option be enabled (it can return true or false to allow or deny the enabling).  Similar disableLocal() and disableRemote() methods exist.  Callbacks can be registered for subnegotiation, based on the command for which the subnegotiation is negotiating options.  There are also do() and dont() methods that return Deferreds.  There's a whole bunch of other new cool features too, but I've probably gone on long enough, especially for a module that hasn't even been released :)
Thanks. When 2.0 comes out, I will take definitely a look. In the 
meantime I was determined to figure out how to make telnetlib work. 
(After all, Grant said is would be easy. :-) ) After much trial and 
error, I found that the following function works for me.

import telnetlib as tnl
HOST = 'nnn.nnn.nnn.nnn'
PORT = 23
def negotiate(sock, cmd, opt):
if cmd == tnl.DO and opt == tnl.SNDLOC:
sock.sendall(tnl.IAC + tnl.WONT + opt)
elif cmd == tnl.DO and opt == tnl.BINARY:
sock.sendall(tnl.IAC + tnl.WILL + opt)
elif cmd == tnl.DO and opt == tnl.ECHO:
sock.sendall(tnl.IAC + tnl.WILL + opt)
elif cmd == tnl.DO and opt == tnl.SGA:
sock.sendall(tnl.IAC + tnl.WILL + opt)
elif cmd == tnl.WILL and opt == tnl.BINARY:
sock.sendall(tnl.IAC + tnl.DO + opt)
elif cmd == tnl.WILL and opt == tnl.ECHO:
sock.sendall(tnl.IAC + tnl.DO + opt)
elif cmd == tnl.WILL and opt == tnl.SGA:
sock.sendall(tnl.IAC + tnl.DO + opt)
elif cmd in (tnl.DO, tnl.DONT):
sock.sendall(tnl.IAC + tnl.WONT + opt)
elif cmd in (tnl.WILL, tnl.WONT):
sock.sendall(tnl.IAC + tnl.DONT + opt)
return
mytn = tnl.Telnet(HOST, PORT)
mytn.set_debuglevel(2)
mytn.set_option_negotiation_callback(negotiate)
mytn.read_until("Enter device name?")
This function is currently a bit redundant, and I have not yet commented 
out each option to see what I can get away with and what not, but at 
least I can now connect without "Connection reset by peer". Thanks to 
all who replied for your advice and encouragement.

Donnal Walter
Arkansas Children's Hospital
--
http://mail.python.org/mailman/listinfo/python-list


Re: Deadlock detection

2004-12-07 Thread Stephen Kellett
In message <[EMAIL PROTECTED]>, Duncan 
Grisby <[EMAIL PROTECTED]> writes
understood, and there are plenty of systems that do it. I just haven't
been able to find one for Python.
There is one at http://www.softwareverify.com as I mentioned in a 
previous posting.

Stephen
--
Stephen Kellett
Object Media Limitedhttp://www.objmedia.demon.co.uk
RSI Information:http://www.objmedia.demon.co.uk/rsi.html
--
http://mail.python.org/mailman/listinfo/python-list


Webapp servers & security

2004-12-07 Thread Anakim Border
App servers such as quixote, webware and skunkweb  (just to name a
few) offer a clean environment to develop Python webapps. I have some
problems, however, understanding their security model.
My objective is to host webapps from different people on a single
Linux server; because of that, I want to be sure that one webapp
cannot interfere with another.
My first attempt at privilege separation went through users & groups.
Unfortunately application servers execute all python code under the
same uid; that way webapp 'a' from Alice can easily overwrite files
from webapp 'b' owned by Bob.
chroot() jails are not an option since I'd need one new process for
each request and that would be the same of using plain old CGIs, all
performance penalties included.
rexec and Bastion are deprecated, so I can't enforce security using
the Python VM itself. That leaves me without anything to work on.

Did I miss anything?

Regards,
Anakim Border
-- 
http://mail.python.org/mailman/listinfo/python-list


ming for python

2004-12-07 Thread titouille
Hello everybody !!
anyone has try to build ming0.3beta1 for python 2.3.3 under windows ??
Since three days, I try to build it with mingw32, and finally, I am 
stopped with C declarations error in src/actioncompiler/swf4compiler.y

If anyone has build with success ming (mingc.pyd) for python 2.3.3, can 
he please send me this file, or explain what I do to build it 
successfully ??

I have downloaded all software who are needed (bison, flex, mingw 
developer Studio to have make, dlltool, etc...) But finally, I'm not 
sure that I can compile theses sources with mingw...

I have followed instructions on
- http://www.u-blog.net/corailnumerique/2003/12/17 (in french, it's my 
mother tongue...) and
- 
https://sourceforge.net/tracker/index.php?func=detail&aid=921431&group_id=18365&atid=118365 

but no results...
If anyone has a solution, please help me :)
Thierry
--
http://mail.python.org/mailman/listinfo/python-list


Re: Time for : comp.lang.python.newbies ??

2004-12-07 Thread Ron Phillips



Speaking for the newbies (or that segment of them who aren't asking you to 
do their homework/job/googling for them):
 
The trouble is, we don't know whether we can't find information(X) 
because:
"X" is not the term "knowbies" use for the concept,
or because: 
information(X) is rare due to the concept being so awful 
that a knowbie would avoid it altogether,
or because: 
information(X) is rare due to being too obvious to document,
or because: 
information(X) is non-existent because "X" comprises some 
legitmate terms, used in a way that makes no sense, with a question mark at the 
end
or because:
X is a genuinely new question and information(X) would advance the 
body of knowledge for all of us.
 

In other words, we don't know what we don't know. If we did, we'd 
know whether our question should be sent to the newbies list or the knowbies 
list. 
 
Maybe just ask us to post *everything* to the .tutor list and let 
the question bubble up to this list if it doesn't get answered there? Or 
ask us to post to the .tutor list until we've responded to someone else's 
post a few times (proven ourselves competent to judge our own 
competence)?
 
Ron
 
>>> James Stroud <[EMAIL PROTECTED]> 12/7/2004 
12:52:08 PM  Maybe a time for a new discussion group 
along that suggested> by the Subject line ?I would hesitate 
to change too much about this list. I spend about 1 hr. per day (probably 
too much) perusing the technical explanations, musings, and rants--and 
hoping to learn enough to reply with an answer sometimes.As far as lists 
go, this is my favorite, and I've subscribed to lists in a variety of 
fields. I'm afraid that scaring off newbies would remove some of the charm 
of this list.-- James Stroud, Ph.D.UCLA-DOE Institute for 
Genomics and Proteomics611 Charles E. Young Dr. S.MBI 205, UCLA 
951570Los Angeles CA 90095-1570http://www.jamesstroud.com/ 

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Webapp servers & security

2004-12-07 Thread Alan Kennedy
[Anakim Border]
> App servers such as quixote, webware and skunkweb  (just to name a
> few) offer a clean environment to develop Python webapps. I have some
> problems, however, understanding their security model.
Since they each have different security models, that's not surprising. 
This is a difficult problem for people approaching python. Hopefully it 
is the sort of problem that will be brought more under control when 
WSGI* is in widespread use and authentication is controlled using WSGI 
middleware.

*: http://www.python.org/peps/pep-0333.html
> My objective is to host webapps from different people on a single
> Linux server; because of that, I want to be sure that one webapp
> cannot interfere with another.
> My first attempt at privilege separation went through users & groups.
Using unix users and groups is the best way to attain total separation 
between environments. Either that or put them on different 
user-mode-linux* hosts.

*: http://usermodelinux.org/
> Unfortunately application servers execute all python code under the
> same uid; that way webapp 'a' from Alice can easily overwrite files
> from webapp 'b' owned by Bob.
Perhaps you could run multiple application servers? One per isolated 
environment? Each of the above packages (quixote, etc) contains its own 
standalone server, as well as the capability to integrate into other 
server environments.

Use some form of proxy webserver in the front, which simply routes 
requests to the relevant application server, based on URL, HTTP_HOST, 
etc, etc.

Apache has a mod_proxy[1] designed specifically for this purpose. In 
combination with mod_rewrite[2], that should give you fairly powerful 
control over who gets to see which requests. You could probably roll 
your solution fairly easily using one or more of the mod_python 
Python*Handlers[3] and something like mod_scgi[4] or FastCGI[5].

1: http://httpd.apache.org/docs-2.0/mod/mod_proxy.html
2: http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html
3: http://www.modpython.org/live/current/doc-html/dir-handlers.html
4: http://www.mems-exchange.org/software/scgi/
5: http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html
> Did I miss anything?
I am sure there are other approaches as well.
HTH,
--
alan kennedy
--
email alan:  http://xhaus.com/contact/alan
--
http://mail.python.org/mailman/listinfo/python-list


Re: Loading a file only once into an object and being able to access it from other modules

2004-12-07 Thread Peter Hansen
Philippe C. Martin wrote:
Thank you all for your answers, I guess I would not have made Python 101:-)
As far as I was concerned, importing a module twice would have resulted in 
loading the file twice.
Background on that:  importing the module the first time causes the
code in it to be executed (i.e. all those def statements and such)
and the resulting module gets a reference stored in sys.modules
(which is a dictionary you might want to examine at the prompt
to see how it looks).  Any subsequent "import" of the same module
will just retrieve a reference to it from sys.modules, so the
second and later imports are effectively instantaneous...
-Peter
--
http://mail.python.org/mailman/listinfo/python-list


Find index of item in list

2004-12-07 Thread Sean Berry
Given

myList = ['cat', 'dog', 'mouse' ... 'bear']

what is the easiest way to find out what index 'dog' is at?



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Find index of item in list

2004-12-07 Thread wes weston
Sean Berry wrote:
Given
myList = ['cat', 'dog', 'mouse' ... 'bear']
what is the easiest way to find out what index 'dog' is at?

Sean,
>>> myList = ['cat', 'dog', 'mouse','bear']
>>> myList.index('dog')
1
>>>
wes
--
http://mail.python.org/mailman/listinfo/python-list


Re: Unknown locale nb_NO ?

2004-12-07 Thread Richard Brodie

"Stas Z" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]

> However it strikes me as odd, that Python2.3.4 raises an exception when
> querying for a valid locale. I tend to call it a bug :-(

File one in the bug tracker, then, and it might get fixed.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Win32 Libs for 2.4

2004-12-07 Thread "Martin v. Löwis"
Robin Becker wrote:
I don't think this 
forces the linker to load stuff from this module although I can see that 
it might be dangerous depending on which obj files are seen first.
I think you are wrong. In the object, there will be simply a linker
command line option encoded; do "dumpbin /all foo.obj" to see the
linker options.
I believe this is a weak reference from the documentation.
What makes you think so?: the linker option in the object file will
be added to the linker line, unconditionally.
Fortunately I don't think this is a problem as Python24.dll also 
references USER32.dll directly.
Yes, that user32.dll indirectly uses msvcrt.dll should be no problem.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list


Re: finding byte order

2004-12-07 Thread biner . sebastien
Scott David Daniels wrote:
> biner wrote:
>  >   I am using a program that has to read binary data from files
coming
>  > from different machines. The file are always written with big
endian.
>
> Diez B. Roggisch wrote:
>   [Scott David Daniels wrote]
> >>How about sys.byteorder?
> > This doesn't help, as he wants to read files from varying endianess
- what
> > the _current_ endianess is doesn't matter here.
>
> But, in fact, he says the files are always big endian.  So, code like
> the following should address his problem.  Note I use type 'h' as an
> example so I can easily read samples.
>
>  import sys, array
>  f =open('huge.dat')
>  v = array.array('h')   # Or whatever data type
>  v.fromfile(f, 4096)
>  f.close()
>  if sys.byteorder == 'little':
>  v.byteswap()
>
> --Scott David Daniels
> [EMAIL PROTECTED]

This seems to do the what I want. I did not know about array.byteswap
and sys.byteorder.
Thanks for taking the time to answer my silly question.

Ciao!

-- 
http://mail.python.org/mailman/listinfo/python-list


I need to create the table and I want to edit its content from www level.

2004-12-07 Thread Rootshell
Hi.

Yes, the 'Tabla' concept seems to be very helpful.
I need few days to instal and try it.

Thank you very much.

Greetings.

Rootshell
-- 
http://mail.python.org/mailman/listinfo/python-list


New experiences with PythonForDelphi

2004-12-07 Thread Caleb Hattingh
Hi all
I hadn't checked PythonForDelphi in a while, and decided to again today.   
All I can say is *wow*.  Those guys are doing a terrific job.  For those  
of you with a pascal background (and a Delphi/Kylix licence), you may want  
to check it out.  In particular, the creation of binary addons/modules  
(e.g. pyd) is very nearly effortless (I have never used something like  
SWIG/Pyrex, so I can't compare), and this is where my interest lies.   
There is also support for Kylix, and I'm gonna try that out as soon as I  
can get the personal edition down my 56K line :)

It is (good) news to me that C is not the only game in town for creating  
binary python extensions.

Just a heads-up is all
Caleb
--
http://mail.python.org/mailman/listinfo/python-list


Re: Find index of item in list

2004-12-07 Thread Steven Bethard
wes weston wrote:
Sean Berry wrote:
myList = ['cat', 'dog', 'mouse' ... 'bear']
what is the easiest way to find out what index 'dog' is at?
 >>> myList = ['cat', 'dog', 'mouse','bear']
 >>> myList.index('dog')
1
 >>>
Yup, list.index is almost certainly what you want, though it's worth 
mentioning that list.index returns the *first* occurrence of the item in 
the list.  You can get later items by supplying an appropriate starting 
index:

>>> my_list = ['cat', 'dog', 'mouse', 'bear', 'dog']
>>> my_list.index('dog')
1
>>> my_list.index('dog', 2)
4
>>> my_list.index('dog', 5)
Traceback (most recent call last):
  File "", line 1, in ?
ValueError: list.index(x): x not in list
Steve
--
http://mail.python.org/mailman/listinfo/python-list


Re: How is Python designed?

2004-12-07 Thread Limin Fu
Hi,

> why did you choose that technique and not a common
> parser generator? The

Because I didn't know the standard parse technique
when I started to implement Yuan :)

> kind of parsing you use is somewhat oldfashioned -
> back in the times where
> parsing theory wasn't evolved enough. The
> disadvantage is that without a
> proper theory and a grammar explaining what
> statements are legal and
> meaningful and which not is uneccessary complicated.
> 
> Look into the python language reference how use is
> made of a grammar to
> explain language constructs.

I will try to read something about the standard
technique, then dicide what to do with parsing.
Approximately how many lines of C/C++ code, do you
think, are required to implement the standard parser?

> 
> > I supposed you would have done like:
> > class node{
> > ...
> > char oper;
> > node *left,*right;
> > void compute();
> > };
> > void node::compute()
> > {
> >if(left) left->compute();
> >if(right) right->compute();
> >if(oper=='+'){
> >   
> >}else if(...){
> >   
> >}
> > }
> > This is a kind of recursive evaluation of
> arithmetic
> > tree. Now I believe that's not what you have used.
> > Ah, yes. That's exactly what I mean.
> 
> That is what I meant. But thats not recursive - the
> compute-calls account
> for the tree-traversal. Nothing recursive there. 

Not true. It is not a tranvesal, it is recursive.
Because after compiling, The code I have given becomes
something like:
void compute(node *p)
{
   if(p->left) compute(p->left);
   if(p->right) compute(p->right);
   if(p->oper=='+'){
   ...
   }else if(...){
   }
}
You see it is a recursion indeed(if you don't believe,
you can check with other people). And it's unefficient
due to pushing functions into function stack.

> 
> > That's avoidable, using depth first seach.
> 
> No. Traversal is traversal. A tree of size n needs
> O(n) to be traversed -
> otherwise you missed some nodes. 
> 
> You can of course cache the results of a tree
> traversal in a list, and call
> the compute method then in a loop:
> 
> for node in nodelist:
> ??? = node.compute()
> 
> But then you need to explicitely deal with where to
> store the resulting
> values of that computation, so you can access them
> lateron. That will most
> probably eat up the time saved by using that cache.

Temporary results can be saved in class "node" as
member data instead of cache, so there is no extra
cost of time.

Best,

Limin


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-- 
http://mail.python.org/mailman/listinfo/python-list


error on crude test of embedding python in c++ HELP PLEASE

2004-12-07 Thread Donnie Leen
I wrote a program to test calling c function from python code embedding in c
as following, it cause error after running a while(about 398 circle).  I
test it in msvc6, python2.3, windows 2k, could anyone tell me why this
happened since i just work according to the document? Thanks first.

Donnie Leen


source code:


#include 

static PyObject* pymyfun( PyObject* self, PyObject* args )
{
 return Py_None;// do nothing
}
static PyMethodDef emb_methods[] = {
{ "fun", pymyfun, METH_VARARGS, "doc." },
{NULL, NULL, 0, NULL}
};

void main(  )
{
Py_Initialize(  );

 PyObject* r = Py_InitModule( "mymodule", emb_methods );
 PyRun_SimpleString( "import mymodule" );
 while ( 1 )
 {
  // error occur after 398 loops here
  PyRun_SimpleString( "mymodule.fun( 'testest' )" );
 }

 Py_Finalize();
}



-- 
http://mail.python.org/mailman/listinfo/python-list


PIL for Windows for Python 2.4

2004-12-07 Thread Scott F
As there is no build for Python 2.4, I attempted to put it together 
from source.  Running

setup.py build

gives this error:

Traceback (most recent call last):
  File "C:\tmp\PIL\Imaging-1.1.4\setup.py", line 60, in ?
for line in open(os.path.join("libImaging", 
"ImConfig.h")).readlines():
IOError: [Errno 2] No such file or directory: 'libImaging\\ImConfig.h'


Appears to be putting in two backslashes.  

Can anyone give me a clue to fix this?

Scott
-- 
http://mail.python.org/mailman/listinfo/python-list


Import a module without executing it?

2004-12-07 Thread Jay O'Connor
Is there a good way to import python files without executing their content?
I'm trying some relfection based stuff and I want to be able to import a 
module dynamically to check it's contents (class ad functions defined) 
but without having any of the content executed.

For example:
--
def test(var):
print var
#main
test(3)
--
I want to be able to import this module so I can see "ah ha, this module 
defines a function called 'test'", but I don't want  the code at the 
bottom executed during the import.

Thanks
Take care,
Jay
--
http://mail.python.org/mailman/listinfo/python-list


Re: Unknown locale nb_NO ?

2004-12-07 Thread StasZ
On Tue, 07 Dec 2004 19:19:42 +, Richard Brodie wrote:

> 
> "Stas Z" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> 
>> However it strikes me as odd, that Python2.3.4 raises an exception when
>> querying for a valid locale. I tend to call it a bug :-(
> 
> File one in the bug tracker, then, and it might get fixed.
Indeed, done it.

Stas

-- 
http://mail.python.org/mailman/listinfo/python-list


Sorting in huge files

2004-12-07 Thread Paul
Hi all

I have a sorting problem, but my experience with Python is rather
limited (3 days), so I am running this by the list first.

I have a large database of 15GB, consisting of 10^8 entries of
approximately 100 bytes each. I devised a relatively simple key map on
my database, and I would like to order the database with respect to the
key.

I expect a few repeats for most of the keys, and that s actually part
of what I want to figure out in the end. (Said loosely, I want to group
all the data entries having "similar" keys. For this I need to sort the
keys first (data entries having _same_ key), and then figure out which
keys are "similar").

A few thoughts on this:
- Space is not going to be an issue. I have a Tb available.
- The Python sort() on list should be good enough, if I can load the
whole database into a list/dict
- each data entry is relatively small, so I shouldn't use pointers
- Keys could be strings, integers with the usual order, whatever is
handy, it doesn't matter to me. The choice will probably have to do
with what sort() prefers.
- Also I will be happy with any key space size. So I guess 100*size of
the database will do.

Any comments?
How long should I hope this sort will take? It will sound weird, but I
actually have 12 different key maps and I want to sort this with
respect to each map, so I will have to sort 12 times.

Paul

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ming for python

2004-12-07 Thread Michel Claveau - abstraction méta-galactique non triviale en fuite perpétuelle.
Ha !  Ha !   Tu tentes la coup de l'émigration ?
J'espère que ça marchera...
-- 
Michel Claveau



-- 
http://mail.python.org/mailman/listinfo/python-list


writing to mailboxes

2004-12-07 Thread Eric S. Johansson
I've been searching around for the equivalent to the mailbox module 
except with the capability of writing messages as well as reading.  If 
it makes it easier, I only need to write to maildir mailboxes.

I found a reference to http://pythonms.sf.net/ Python mail system) but 
it seems to have vanished.

Any suggestions?
---eric
--
http://mail.python.org/mailman/listinfo/python-list


Re: Webapp servers & security

2004-12-07 Thread Istvan Albert
Anakim Border wrote:
few) offer a clean environment to develop Python webapps. I have some
problems, however, understanding their security model.

Did I miss anything?
They don't have a security model. AFAIK only Zope has.
Istvan.
--
http://mail.python.org/mailman/listinfo/python-list


How do I do this? (eval() on the left hand side)

2004-12-07 Thread It's me
I am new to the Python language.

How do I do something like this:

I know that

a = 3
y = "a"
print eval(y)

would give me a print out of 3 - but how do I do something to the effect of:

eval(y) = 4# hopefully the value of a gets changed to 4

??

Thanks,

--
It's me


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: error on crude test of embedding python in c++ HELP PLEASE

2004-12-07 Thread Thomas Heller
"Donnie Leen" <[EMAIL PROTECTED]> writes:

> I wrote a program to test calling c function from python code embedding in c
> as following, it cause error after running a while(about 398 circle).  I
> test it in msvc6, python2.3, windows 2k, could anyone tell me why this
> happened since i just work according to the document? Thanks first.
>
> Donnie Leen
>
>
> source code:
>
>
> #include 
>
> static PyObject* pymyfun( PyObject* self, PyObject* args )
> {
>  return Py_None;// do nothing

You forgot an Py_INCREF here:
  Py_INCREF(Py_None);
  return Py_None;// do nothing

> }
> static PyMethodDef emb_methods[] = {
> { "fun", pymyfun, METH_VARARGS, "doc." },
> {NULL, NULL, 0, NULL}
> };
>
> void main(  )
> {
> Py_Initialize(  );
>
>  PyObject* r = Py_InitModule( "mymodule", emb_methods );
>  PyRun_SimpleString( "import mymodule" );
>  while ( 1 )
>  {
>   // error occur after 398 loops here
>   PyRun_SimpleString( "mymodule.fun( 'testest' )" );
>  }
>
>  Py_Finalize();
> }
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Import a module without executing it?

2004-12-07 Thread Caleb Hattingh
Hi
You could just parse the model file.  Off the top of my head
***
f = open('ModuleYouWantToExamine.py','r')
for i in f:
if i.find('def ') > -1:
print 'Found a function!: '+i.replace('def ','')
f.close()
***
You would have to build this up for a more complete examination.  Of  
course, one of the guru's around here should be able to give you guidance  
regarding actually parsing the file with the interpreter (not executing)  
and building a dict or something with all the different types of  
constructs.  That's not me :)

I want to be able to import this module so I can see "ah ha, this module  
defines a function called 'test'", but I don't want  the code at the  
bottom executed during the import.

Thanks
Take care,
Jay
--
http://mail.python.org/mailman/listinfo/python-list


Re: [BUG] IMO, but no opinions? Uncle Tim? was: int(float(sys.maxint)) buglet ?

2004-12-07 Thread Bengt Richter
On Mon, 6 Dec 2004 10:30:06 -0500, Tim Peters <[EMAIL PROTECTED]> wrote:

>[Bengt Richter]
>> Peculiar boundary cases:
>> 
>> >>> 2.0**31-1.0
>> 2147483647.0
>> >>> int(2147483647.0)
>> 2147483647L
>> >>> int(2147483647L )
>> 2147483647
>> >>>
>> >>> -2.0**31
>> -2147483648.0
>> >>> int(-2147483648.0)
>> -2147483648L
>> >>> int(-2147483648L )
>> -2147483648
>> 
>> some kind of one-off error?
>
>It would help if you were explicit about what you think "the error"
>is.  I see a correct result in all cases there.
>
>Is it just that sometimes
>
>int(a_float)
>
>returns a Python long when
>
>int(a_long_with_the_same_value_as_that_float)
>
>returns a Python int?  If so, that's not a bug -- there's no promise
>anywhere, e.g., that Python will return an int whenever it's
>physically possible to do so.
Ok, I understand the expediency of that policy, but what is now the meaning
of int, in that case? Is it now just a vestigial artifact on the way to
transparent unification of int and long to a single integer type?

Promises or not, ISTM that if int->float succeeds in preserving all significant 
bits, then
then a following float->int should also succeed without converting to long.

>
>Python used to return a (short) int in all cases above, but that lead
>to problems on some oddball systems.  See the comments for float_int()
>in floatobject.c for more detail.  Slowing float_int() to avoid those
>problems while returning a short int whenever physically possible is a
>tradeoff I would oppose.

The 2.3.2 source snippet in floatobject.c :
--
static PyObject *
float_int(PyObject *v)
{
double x = PyFloat_AsDouble(v);
double wholepart;   /* integral portion of x, rounded toward 0 */

(void)modf(x, &wholepart);
/* Try to get out cheap if this fits in a Python int.  The attempt
 * to cast to long must be protected, as C doesn't define what
 * happens if the double is too big to fit in a long.  Some rare
 * systems raise an exception then (RISCOS was mentioned as one,
 * and someone using a non-default option on Sun also bumped into
 * that).  Note that checking for >= and <= LONG_{MIN,MAX} would
 * still be vulnerable:  if a long has more bits of precision than
 * a double, casting MIN/MAX to double may yield an approximation,
 * and if that's rounded up, then, e.g., wholepart=LONG_MAX+1 would
 * yield true from the C expression wholepart<=LONG_MAX, despite
 * that wholepart is actually greater than LONG_MAX.
 */
if (LONG_MIN < wholepart && wholepart < LONG_MAX) {
const long aslong = (long)wholepart;
return PyInt_FromLong(aslong);
}
return PyLong_FromDouble(wholepart);
}
--

But this is apparently accessed through a table of pointers, so would you oppose
an auto-configuration that one time tested whether
int(float(sys.maxint))==sys.maxint and int(float(-sys.maxint-1))==-sys.maxint-1
(assuming that's sufficient, of which I'm not 100% sure ;-) and if so switched
the pointer to a version that tested if(LONG_MIN <= wholepart && 
wholepart<=LONG_MAX)
instead of the safe-for-some-obscure-system version?

Of course, if int isn't all that meaningful any more, I guess the problem can 
be moved to the
ctypes module, if that gets included amongst the batteries ;-)

Regards,
Bengt Richter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Import a module without executing it?

2004-12-07 Thread Andy Gross
You'll want to use the "compiler" package.  compiler.parseFile will 
return an AST that you can inspect (which is not really 'reflection', 
btw).

/arg
On Dec 7, 2004, at 10:56 PM, Caleb Hattingh wrote:
Hi
You could just parse the model file.  Off the top of my head
***
f = open('ModuleYouWantToExamine.py','r')
for i in f:
if i.find('def ') > -1:
print 'Found a function!: '+i.replace('def ','')
f.close()
***
You would have to build this up for a more complete examination.  Of 
course, one of the guru's around here should be able to give you 
guidance regarding actually parsing the file with the interpreter (not 
executing) and building a dict or something with all the different 
types of constructs.  That's not me :)

I want to be able to import this module so I can see "ah ha, this 
module defines a function called 'test'", but I don't want  the code 
at the bottom executed during the import.

Thanks
Take care,
Jay
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list


Re: How do I do this? (eval() on the left hand side)

2004-12-07 Thread Caleb Hattingh
Hi It's me
a = 3
y = "a"
print eval(y)
To get 'a' to be 4 here, you would say
a = 4
I am not sure why you would want to do otherwise?  Perhaps you could  
sketch out a little more about what you are trying to do?  That would help  
a lot.  Are you aiming for something like pointer emulation with simple  
datatypes?

Thanks
Caleb
--
http://mail.python.org/mailman/listinfo/python-list


Re: Import a module without executing it?

2004-12-07 Thread Caleb Hattingh
Andy
thx for that.  I had a file called 'tktest.py' lying around, and I did:
'>>> a = compiler.parseFile('tktest.py')
And "a" looks something like this:
***
Stmt([Import([('Tkinter', None)]), Function(None, 'add_rows', ['w',  
'titles', 'rows'], [], 0, None, Stmt([Discard(CallFunc(Getattr(Name('w'),  
'configure'), [Keyword('state', Const('normal'))], None, None)),  
For(AssName('r', 'OP_ASSIGN'), Name('rows'),  
Stmt([For(AssTuple([AssName('t', 'OP_ASSIGN'), AssName('v',  
'OP_ASSIGN')]), CallFunc(Name('zip'), [Name('titles'), Name('r')], None,  
None), Stmt([Discard(CallFunc(Getattr(Name('w'), 'insert'), [Const('end'),  
Mod((Const('%s:\t%s\n'), Tuple([Name('t'), Name('v')])))], None, None))]),  
None), Discard(CallFunc(Getattr(Name('w'), 'insert'), [Const('end'),  
Const('\n')], None, None))]), None), Discard(CallFunc(Getattr(Name('w'),  
'configure'), [Keyword('state', Const('disabled'))], None, None))])),  
Assign([AssName('app', 'OP_ASSIGN')], CallFunc(Getattr(Name('Tkinter'),  
'Tk'), [], None, None)), Assign([AssName('t', 'OP_ASSIGN')],  
CallFunc(Getattr(Name('Tkinter'), 'Text'), [Name('app'), Keyword('state',  
Const('disabled'))], None, None)), Discard(CallFunc(Getattr(Name('t'),  
'pack'), [], None, None)), Assign([AssName('info', 'OP_ASSIGN')],  
List([List([Const('Ali'), Const(18)]), List([Const('Zainab'), Const(16)]),  
List([Const('Khalid'), Const(18)])])), Discard(CallFunc(Name('add_rows'),  
[Name('t'), List([Const('Name'), Const('Age')]), Name('info')], None,  
None)), Discard(CallFunc(Getattr(Name('app'), 'mainloop'), [], None,  
None))])
***

Pretty impressive :)
Do you know of more batteries that can process this stuff further, for  
interest sake (and maybe the OP)?

thx again
Caleb
On Tue, 7 Dec 2004 15:57:16 -0500, Andy Gross <[EMAIL PROTECTED]> wrote:
You'll want to use the "compiler" package.  compiler.parseFile will  
return an AST that you can inspect (which is not really 'reflection',  
btw).

/arg
--
http://mail.python.org/mailman/listinfo/python-list


Re: How do I do this? (eval() on the left hand side)

2004-12-07 Thread It's me

"Caleb Hattingh" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi It's me
>
> >
> > a = 3
> > y = "a"
> > print eval(y)
> >
>
> To get 'a' to be 4 here, you would say
>
> a = 4
>

Obviously but that's not what I wish to do.

> I am not sure why you would want to do otherwise?  Perhaps you could
> sketch out a little more about what you are trying to do?  That would help
> a lot.  Are you aiming for something like pointer emulation with simple
> datatypes?
>

In REXX, for instance, one can do a:

interpret y' = 4'

Since y contains a, then the above statement amongs to:

a = 4

There are many situations where this is useful.   For instance, you might be
getting an input which is a string representing the name of a variable and
you wish to evaluate the expression (like a calculator application, for
instance).


> Thanks
> Caleb


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: error on crude test of embedding python in c++ HELP PLEASE

2004-12-07 Thread Donnie Leen
Got it, thanks :)

-- 
http://mail.python.org/mailman/listinfo/python-list


sys.stdin.read question

2004-12-07 Thread It's me
Why do I get an "AttributeError: read" message when I do:

import sys
r=sys.stdin.read()

??

I've tried:

r=sys.stdin.read(80)
r=sys.stdin.read(1)

same error message.

I couldn't find any reference to this function in my Python book (they have
the stdout but not in).

Some sample code I saw uses this function in the same manner I am and so I
am assuming this is the correct syntax?

Or is this a bug in Python 2.4?

--
It's me


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Import a module without executing it?

2004-12-07 Thread Andy Gross
Here's a quick example that will pull out all functions defined in the 
top-level of a module:

---
#/usr/bin/env python
from compiler import parse, walk
from compiler.visitor import ASTVisitor
testdata = r'''
def aFunction(anArg):
return anArg + 1
'''
class SimpleVisitor(ASTVisitor):
def visitFunction(self, parsedFunc):
print "Function %(name)s at %(lineno)s takes %(argnames)s " \
  " with code %(code)s" % parsedFunc.__dict__
if __name__ == "__main__":
ast = parse(testdata)
walk(ast, SimpleVisitor(), verbose=True)
---
[EMAIL PROTECTED]:~$ ./test.py
Function aFunction at 2 takes ['anArg']  with code 
Stmt([Return(Add((Name('anArg'), Const(1])

HTH,
/arg
On Dec 7, 2004, at 11:14 PM, Caleb Hattingh wrote:
Andy
thx for that.  I had a file called 'tktest.py' lying around, and I did:
'>>> a = compiler.parseFile('tktest.py')
And "a" looks something like this:
***
Stmt([Import([('Tkinter', None)]), Function(None, 'add_rows', ['w', 
'titles', 'rows'], [], 0, None, 
Stmt([Discard(CallFunc(Getattr(Name('w'), 'configure'), 
[Keyword('state', Const('normal'))], None, None)), For(AssName('r', 
'OP_ASSIGN'), Name('rows'), Stmt([For(AssTuple([AssName('t', 
'OP_ASSIGN'), AssName('v', 'OP_ASSIGN')]), CallFunc(Name('zip'), 
[Name('titles'), Name('r')], None, None), 
Stmt([Discard(CallFunc(Getattr(Name('w'), 'insert'), [Const('end'), 
Mod((Const('%s:\t%s\n'), Tuple([Name('t'), Name('v')])))], None, 
None))]), None), Discard(CallFunc(Getattr(Name('w'), 'insert'), 
[Const('end'), Const('\n')], None, None))]), None), 
Discard(CallFunc(Getattr(Name('w'), 'configure'), [Keyword('state', 
Const('disabled'))], None, None))])), Assign([AssName('app', 
'OP_ASSIGN')], CallFunc(Getattr(Name('Tkinter'), 'Tk'), [], None, 
None)), Assign([AssName('t', 'OP_ASSIGN')], 
CallFunc(Getattr(Name('Tkinter'), 'Text'), [Name('app'), 
Keyword('state', Const('disabled'))], None, None)), 
Discard(CallFunc(Getattr(Name('t'), 'pack'), [], None, None)), 
Assign([AssName('info', 'OP_ASSIGN')], List([List([Const('Ali'), 
Const(18)]), List([Const('Zainab'), Const(16)]), 
List([Const('Khalid'), Const(18)])])), 
Discard(CallFunc(Name('add_rows'), [Name('t'), List([Const('Name'), 
Const('Age')]), Name('info')], None, None)), 
Discard(CallFunc(Getattr(Name('app'), 'mainloop'), [], None, None))])
***

Pretty impressive :)
Do you know of more batteries that can process this stuff further, for 
interest sake (and maybe the OP)?

thx again
Caleb
On Tue, 7 Dec 2004 15:57:16 -0500, Andy Gross <[EMAIL PROTECTED]> 
wrote:

You'll want to use the "compiler" package.  compiler.parseFile will 
return an AST that you can inspect (which is not really 'reflection', 
btw).

/arg
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list


Re: Import a module without executing it?

2004-12-07 Thread Steven Bethard
Jay O'Connor wrote:
--
def test(var):
print var
#main
test(3)
--
I want to be able to import this module so I can see "ah ha, this module 
defines a function called 'test'", but I don't want  the code at the 
bottom executed during the import.
If you have source control over this file, you could write it with the 
more standard idiom:

def test(var):
print var
if __name__ == "__main__":
test(3)
Then when the module is imported, only the def statement gets executed, 
not the 'test(3)'.  Of course, if you don't have source control over the 
file, you can't do this...

Also note that code that is not protected by an
if __name__ == "__main__":
test may be part of the module definition, so examining a module without 
executing this code may be misleading, e.g.:

def test(var):
print var
globals()['test'] = type('C', (object,), dict(
f=lambda self, var, test=test: test(var)))
if __name__ == "__main__":
test().f(3)
The module above turns 'test' from a function into a class, so if all 
you do is look at the def statements, you may misinterpret the module.

Steve
--
http://mail.python.org/mailman/listinfo/python-list


Re: How do I do this? (eval() on the left hand side)

2004-12-07 Thread Caleb Hattingh
Sure, ok, I think I am with you now.
You get a (e.g.) variable name as a string, and you KNOW how to evaluate  
it with "eval", but you also want to be able to assign back to (through)  
the string representation?

One way (if I understand you correctly) is with the globals or locals  
dicts.  Try this in IDLE:

'>>> a = 3
'>>> y = 'a'
'>>> eval(y)
3
'>>> d = locals() # Get a dictionary of local variables
'>>> d['a']
3
'>>> d[y]
3
'>>> d[y] = 8   # y is a string = 'a'
'>>> a  # The value of a is changed.
8
'>>>
Is this kinda what you mean?  I'm still new at this (and don't know REXX  
from Adam).

Thanks
Caleb

There are many situations where this is useful.   For instance, you  
might be
getting an input which is a string representing the name of a variable  
and
you wish to evaluate the expression (like a calculator application, for
instance).
--
http://mail.python.org/mailman/listinfo/python-list


Re: How do I do this? (eval() on the left hand side)

2004-12-07 Thread Russell Blau
"It's me" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> In REXX, for instance, one can do a:
>
> interpret y' = 4'
>
> Since y contains a, then the above statement amongs to:
>
> a = 4
>
> There are many situations where this is useful.   For instance, you might
be
> getting an input which is a string representing the name of a variable and
> you wish to evaluate the expression (like a calculator application, for
> instance).

In Python, the canonical advice for this situation is, "Use a dictionary."
This has a number of advantages, including keeping your user's namespace
separate from your application's namespace.  Plus it's easier to debug and
maintain the code.

But, if you absolutely, positively have to refer to your variable
indirectly, you could do:

exec "%s = 4" % y

If y refers to the string "a", this will cause the variable a to refer to
the value 4.

-- 
I don't actually read my hotmail account, but you can replace hotmail with
excite if you really want to reach me.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do I do this? (eval() on the left hand side)

2004-12-07 Thread Erik Max Francis
It's me wrote:
In REXX, for instance, one can do a:
interpret y' = 4'
Since y contains a, then the above statement amongs to:
a = 4
The direct equivalent in Python would be
a = 3
y = 'a'
exec '%s = 4' % y
The better question would be whether or not this as useful as one might 
thing in Python; if you find yourself doing this, often there are better 
ways to accomplish the same thing, such as using dictionaries.

--
Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
  But the system has no wisdom / The Devil split us in pairs
  -- Public Enemy
--
http://mail.python.org/mailman/listinfo/python-list


Re: Import a module without executing it?

2004-12-07 Thread Andy Gross
On Dec 7, 2004, at 4:20 PM, Steven Bethard wrote:
If you have source control over this file, you could write it with the 
more standard idiom...
I should have mentioned this first.  If you're just trying to avoid 
existing top-level code from being executed, use the if __name__ == 
"__main__" idiom.

--
http://mail.python.org/mailman/listinfo/python-list


Re: sys.stdin.read question

2004-12-07 Thread Grant Edwards
On 2004-12-07, It's me <[EMAIL PROTECTED]> wrote:
> Why do I get an "AttributeError: read" message when I do:
>
> import sys
> r=sys.stdin.read()

Dunno. Works fine for me under 2.3.4, and according to the
docs, should work under 2.4.

What do you get when you do this:

 import sys
 type(sys.stdin)
 dir(sys.stdin) 

> Some sample code I saw uses this function in the same manner I
> am and so I am assuming this is the correct syntax?

Should be.

> Or is this a bug in Python 2.4?

That would be a little hard to believe.

-- 
Grant Edwards   grante Yow!  PEGGY FLEMMING is
  at   stealing BASKET BALLS to
   visi.comfeed the babies in VERMONT.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Import a module without executing it?

2004-12-07 Thread finite . automaton
Functions and classes are created during the very execution you're
trying to skip so there's no precise way to do what you want.

That said, you can parse the code without executing it, and that will
give you some information about defined functions and classes.  It will
_not_ give you actual function objects; the only way to get those is to
execute the code.  It will also not catch anything created "on the
fly"*, e.g. "exec 'def func(x): pass'"


# example:

def defined_functions(code_text):
module_ast = parse(code_text)
return [statement for statement in
module_ast.node.nodes if
isinstance(statement, ast.Function)]

# read the module's source code
test_string = """
def foo(x):
pass
def bar(y):
pass
"""

# Which functions are defined in the test string?
function_asts = defined_functions(test_string)
print "Defined functions:", [f.name for f in function_asts]




* - Okay, everything in Python happens on-the-fly.  But you know what I
mean.

Footnote: Wow.  The new, "improved" google groups 2 beta has totally
annihilated my indentation.  Sorry about that.  Hopefully you can still
figure it out.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do I do this? (eval() on the left hand side)

2004-12-07 Thread Craig Ringer
On Wed, 2004-12-08 at 05:12, It's me wrote:

> There are many situations where this is useful.   For instance, you might be
> getting an input which is a string representing the name of a variable and
> you wish to evaluate the expression (like a calculator application, for
> instance).

While I do agree it can be handy, I also think that most possible uses
are also _very_ _dangerous_ security-wise. If possible it'd be safer to
write your code a different way to avoid the evaluation of user-supplied
expressions. For example, you could use a dictionary to store the
'user-accessible' namespace and have all their operations act on that.

You could probably do something _like_ what you want with exec() and
repr, but it'll break as soon as it encounters input that repr can't
make an exec()able string from. It's also really ugly.

If you know what namespace you want to modify ahead of time, or can pass
it to the function doing the modifying, you can also use
getattr()/setattr() or dict methods to do it. For example:

>>> # modify the globals space on the __main__ module
>>> import __main__
>>> varname = 'fred'
>>> setattr(__main__, varname, 'blech')
>>> fred
'blech'
>>> # same thing
>>> __main__.__dict__[varname] = 'yech!'
>>> fred
'yech!'
>>> # modify the attributes of some random object
>>> class dummy(object):
... pass
...
>>> obj = dummy()
>>> setattr(obj, varname, 'eew')
>>> obj.fred
'eew'
>>> # same thing using the object's __dict__, NOT RECOMMENDED
>>> # outside the class's own methods.
>>> obj.__dict__[varname] = 'unwise'
>>> obj.fred
'unwise'

This, however, won't do you much good if you don't know what you'll be
modifying. I know the locals() and globals() functions exist, but have
always been leery of the idea of modifying their contents, and am not
sure what circumstances you could do so under even if you felt like
doing so.

In general, it'll be _much_ safer to use a generic object with
getattr/setattr or a dict than to try to work with your local or global
namespaces like this...

--
Craig Ringer

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sys.stdin.read question

2004-12-07 Thread Caleb Hattingh
Hi
You are probably typing this within IDLE.  Try it after starting python in  
a shell like DOS or Bash.  Should work then (works for me, and I also get  
the AttributeError in IDLE.

Thanks
Caleb
On Tue, 07 Dec 2004 21:15:51 GMT, It's me <[EMAIL PROTECTED]> wrote:
Why do I get an "AttributeError: read" message when I do:
import sys
r=sys.stdin.read()
??
I've tried:
r=sys.stdin.read(80)
r=sys.stdin.read(1)
same error message.
I couldn't find any reference to this function in my Python book (they  
have
the stdout but not in).

Some sample code I saw uses this function in the same manner I am and so  
I
am assuming this is the correct syntax?

Or is this a bug in Python 2.4?
--
It's me

--
http://mail.python.org/mailman/listinfo/python-list


Re: Sorting in huge files

2004-12-07 Thread Steven Bethard
Paul wrote:
I expect a few repeats for most of the keys, and that s actually part
of what I want to figure out in the end. (Said loosely, I want to group
all the data entries having "similar" keys. For this I need to sort the
keys first (data entries having _same_ key), and then figure out which
keys are "similar").
If this is really your final goal, you may not want to sort.  Consider 
code like the following:

>>> entries = [('a', '4'),
...('x', '7'),
...('a', '2'),
...('b', '7'),
...('x', '4')]
>>> counts = {}
>>> for entry in entries:
... key = entry[0]
... counts.setdefault(key, []).append(entry)
...
>>> for key in counts:
... print key, counts[key]
...
a [('a', '4'), ('a', '2')]
x [('x', '7'), ('x', '4')]
b [('b', '7')]
I've grouped all entries with the same key together using a dict object 
and without the need for any sorting.  If you had a good definition of 
'similar', you could perhaps map all 'similar' keys to the same value in 
the dict.

If you really do need to sort, Python 2.4 provides a very nice way to 
sort by a particular key:

>>> import operator
>>> entries = [('a', '4'),
...('x', '7'),
...('a', '2'),
...('b', '7'),
...('x', '4')]
>>> entries.sort(key=operator.itemgetter(1))
>>> entries
[('a', '2'), ('a', '4'), ('x', '4'), ('x', '7'), ('b', '7')]
Here, I've sorted the entries by the second item in each tuple.  If you 
go this route, you should also look at itertools.groupby:

>>> import itertools
>>> entries = [('a', '4'),
...('x', '7'),
...('a', '2'),
...('b', '7'),
...('x', '4')]
>>> entries.sort(key=operator.itemgetter(1))
>>> for key, values in itertools.groupby(entries, operator.itemgetter(1)):
... print key, list(values)
...
2 [('a', '2')]
4 [('a', '4'), ('x', '4')]
7 [('x', '7'), ('b', '7')]
The groupby basically does the sort of grouping of a sorted list that I 
think you had in mind...

Steve
--
http://mail.python.org/mailman/listinfo/python-list


Re: sys.stdin.read question

2004-12-07 Thread Caleb Hattingh
It runs properly in a shell (bash), but on another matter:
'>>> r=sys.stdin.read(1)
g
'>>> r
'g'
'>>> r=sys.stdin.read(5)
1234567890
'>>> r
'\n1234'
'>>>
What exactly happened to my 1234567890?  I understand that I am only  
taking 5 characters, but where does the newline (\n) come from?  Is that a  
remnant from when I terminated the previous 'g' input?

Thanks
Caleb
On Tue, 07 Dec 2004 23:36:56 -0500, Caleb Hattingh <[EMAIL PROTECTED]>  
wrote:

Hi
You are probably typing this within IDLE.  Try it after starting python  
in a shell like DOS or Bash.  Should work then (works for me, and I also  
get the AttributeError in IDLE.

Thanks
Caleb
On Tue, 07 Dec 2004 21:15:51 GMT, It's me <[EMAIL PROTECTED]> wrote:
Why do I get an "AttributeError: read" message when I do:
import sys
r=sys.stdin.read()
??
I've tried:
r=sys.stdin.read(80)
r=sys.stdin.read(1)
same error message.
I couldn't find any reference to this function in my Python book (they  
have
the stdout but not in).

Some sample code I saw uses this function in the same manner I am and  
so I
am assuming this is the correct syntax?

Or is this a bug in Python 2.4?
--
It's me


--
http://mail.python.org/mailman/listinfo/python-list


Re: How do I do this? (eval() on the left hand side)

2004-12-07 Thread Steven Bethard
It's me wrote:
How do I do something like this:
I know that
a = 3
y = "a"
print eval(y)
would give me a print out of 3 - but how do I do something to the effect of:
eval(y) = 4# hopefully the value of a gets changed to 4
Generally, if you find yourself doing this, you may want to rethink your 
program organization.  That being said, if you are in the global scope, 
one option looks something like:

>>> a = 3
>>> y = 'a'
>>> globals()[y] = 4
>>> a
4
If you can give us some more context on why you want to do this, we can 
probably suggest a better approach.  There aren't too many places where 
even advanced Python programmers need to use eval...

Steve
--
http://mail.python.org/mailman/listinfo/python-list


Re: How do I do this? (eval() on the left hand side)

2004-12-07 Thread It's me
Yes, Russell, what you suggested works.

I have to chew more on the syntax to see how this is working.

because in the book that I have, it says:

exec code [ in globaldict [, localdict] ]

...

--
It's me


"Russell Blau" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "It's me" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> >
> > In REXX, for instance, one can do a:
> >
> > interpret y' = 4'
> >
> > Since y contains a, then the above statement amongs to:
> >
> > a = 4
> >
> > There are many situations where this is useful.   For instance, you
might
> be
> > getting an input which is a string representing the name of a variable
and
> > you wish to evaluate the expression (like a calculator application, for
> > instance).
>
> In Python, the canonical advice for this situation is, "Use a dictionary."
> This has a number of advantages, including keeping your user's namespace
> separate from your application's namespace.  Plus it's easier to debug and
> maintain the code.
>
> But, if you absolutely, positively have to refer to your variable
> indirectly, you could do:
>
> exec "%s = 4" % y
>
> If y refers to the string "a", this will cause the variable a to refer to
> the value 4.
>
> -- 
> I don't actually read my hotmail account, but you can replace hotmail with
> excite if you really want to reach me.
>
>


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sorting in huge files

2004-12-07 Thread Paul
I really do need to sort. It is complicated and I haven't said why, but
it will help in finding similar keys later on. Sorry I can't be more
precise, this has to do with my research.

Your two other suggestions with itertools and operator are more useful,
but I was mostly wondering about performance issue.

Is this reasonnable to do on 10^8 elements with repeats in the keys? I
guess I should just try and see for myself.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [BUG] IMO, but no opinions? Uncle Tim? was: int(float(sys.maxint)) buglet ?

2004-12-07 Thread Tim Peters
[Tim Peters]
>> ... there's no promise anywhere, e.g., that Python will return an int
>> whenever it's physically possible to do so.

[Bengt Richter]
> Ok, I understand the expediency of that policy, but what is now the meaning
> of int, in that case? Is it now just a vestigial artifact on the way to
> transparent unification of int and long to a single integer type?

I don't really know what you mean by "int".  Python isn't C, and the
distinction between Python's historical short integers and unbounded
integers is indeed going away.  "int" is the name of a specific Python
type, and the constructor for that type (which old-timers will think
of as the builtin function named "int()") is happy to return unbounded
integers in modern Pythons too.  Python-level distinctions here have
become increasingly meaningless over time; I expect that "int" and
"long" will eventually become synonyms for the same type at the Python
level.

The distinction remains very visible at the Python C API level, for
obvious reasons, but even C code has to be prepared to deal with that
a PyIntObject or a PyLongObject may be given in contexts where "an
integer" is required.

> Promises or not, ISTM that if int->float succeeds in preserving all 
> significant bits,
> then then a following float->int should also succeed without converting to 
> long.

Yes, that was obvious .  But you haven't explained why you
*care*, or, more importantly, why someone else should care.  It just
as obviously doesn't bother me, and I'm bold enough to claim that it
"shouldn't" bother anyone.  This seems as peripheral to me as arguing
that "there's something wrong" about returning "a long" in either of
these cases:

>>> import os
>>> os.path.getsize("a.py")
165L
>>> f = open("a.py")
>>> f.tell()
0L

The implementations of getsize() and .tell() certainly could have
endured complications to ensure that "an int", and not "a long", was
returned whenever physically possible to do so -- but why bother?

...
> The 2.3.2 source snippet in floatobject.c :
> --
> static PyObject *
> float_int(PyObject *v)
> {
...

> But this is apparently accessed through a table of pointers, so would you 
> oppose
> an auto-configuration that one time tested whether
> int(float(sys.maxint))==sys.maxint and 
> int(float(-sys.maxint-1))==-sys.maxint-1
> (assuming that's sufficient, of which I'm not 100% sure ;-) and if so switched
> the pointer to a version that tested if(LONG_MIN <= wholepart &&
>> wholepart<=LONG_MAX)
> instead of the safe-for-some-obscure-system version?

In the absence of identifying an actual problem this would solve, I
would oppose adding *gratuitous* complication.  Abusing your sense of
aesthetics isn't "an actual problem" in this sense to me, although it
may be to you.  Of course you're welcome to make any code changes you
like in your own copy of Python .

> Of course, if int isn't all that meaningful any more, I guess the problem can 
> be
> moved to the ctypes module, if that gets included amongst the batteries ;-)

What problem?  If there's an actual bug here, please open a bug report.
-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   >