ANNOUNCE: Optik 1.5.3

2006-07-24 Thread Greg Ward
Optik 1.5.3
===

Optik is a powerful, flexible, extensible, easy-to-use command-line
parsing library for Python.  Using Optik, you can add intelligent,
sophisticated handling of command-line options to your scripts with very
little overhead.

I have released Optik 1.5.3 mainly to ensure that Python 2.5 includes a
version of optparse that is derived from a known release of Optik.
Sharp-eyed readers will note that I didn't announce 1.5.2 -- that's
because I released it prematurely, and then noticed a change to
Lib/test/test_optparse.py in the Python source tree that I had to port
to Optik.  Oops.

You can get Optik 1.5.3 from

  http://sourceforge.net/projects/optik

Or you can just wait for Python 2.5rc1, which will include Optik 1.5.3
as optparse.

Anyways, here are the changes since the last proper release (1.5.1):

1.5.3 (23 Jul 2006)
---

  * Port r47026 from Python svn repository: fix unit test so
it doesn't screw up other tests in the Python test suite.

1.5.2 (22 Jul 2006)
---

  * Minor documentation tweaks.

  * SF bug #1498146: handle Unicode help strings (affects option help,
description, and epilog).

-- 
Greg Ward [EMAIL PROTECTED] http://www.gerg.ca/
God is omnipotent, omniscient, and omnibenevolent
---it says so right here on the label.
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


Pydev 1.2.2 released

2006-07-24 Thread Fabio Zadrozny
Hi All,

 

 Pydev and Pydev Extensions 1.2.2 have been released

 

 Details on Pydev Extensions: http://www.fabioz.com/pydev

 Details on Pydev: 
http://pydev.sf.net 

 Details on its development: http://pydev.blogspot.com




 Release Highlights in Pydev Extensions:

 -


 - Added the 'toggle completion type' when Ctrl is pressed in the code-completion for context-insensitive data

 IMPORTANT:The binding for creating the interactive console and
passing commands to the shell has been changed to Ctrl+Alt+Enter
(because Ctrl+Enter is now used when applying a toggled completion).
Details for toggle completion type:
Blog:http://pydev.blogspot.com/2006/07/improving-code-completion-in-pydev.html

- When getting some definition, if it is defined by an import..from, it keeps going until the actual token is found
- Duplicated signature is no longer warned inside an if..else
- Mark occurrences bug-fix
- Handling nested 'for' declarations and nested list comprehensions correctly in code-analysis
 Release Highlights in Pydev: -- Code Completion

 * Calltips added to pydev
 * The parameters are now linked when a completion is
selected (so, tab iterates through them and enter goes to the end of
the declaration)
 * Parameters gotten from docstring analysis for builtins that don't work with 'inspect.getargspec'
 * Getting completions for the pattern a,b,c=range(3) inside a class
 * Code completion for nested modules had a bug fixed
 * Added the 'toggle completion type' when ctrl is pressed in the code-completion for context-sensitive data
 * Code-completion works correctly after
instantiating a class: MyClass(). -- will bring correct completions
 * Code-completion can now get the arguments passed when instatiating a class (getting the args from __init__)
 * self is added as a parameter in the completion analyzing whether we're in a bounded or unbounded call
 * Pressing Ctrl+Space a second time changes default / template completions
 See details on toggling completion mode,
cycling through completions and linked mode (blog:
http://pydev.blogspot.com/2006/07/improving-code-completion-in-pydev.html)


Outline View

 * Added option for hiding comments and imports
 * Persisting configuration
 * Added option for expanding all

Others

 * Possibility of setting pyunit verbosity level (by Darrell Maples)
 * Errors getting the tests to run are no longer suppressed
 * Ctrl+2+kill also clears the internal cache for
compiled modules (especially useful for those that create compiled
dependencies).
 * Last opened path remembered when configuring the pythonpath (dialog)
 What is PyDev? --- 
PyDev is a plugin that enables users to use Eclipse for Python and
Jython development -- making Eclipse a first class Python IDE -- It
comes with many goodies such as code completion, syntax highlighting,
syntax analysis, refactor, debug and many others.   Cheers,  --  Fabio Zadrozny -- Software Developer  ESSS - Engineering Simulation and Scientific Software
 http://www.esss.com.br  Pydev Extensions 

http://www.fabioz.com/pydev  Pydev - Python Development Enviroment for Eclipse
 http://pydev.sf.net 

http://pydev.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


cx_OracleDBATools 2.2

2006-07-24 Thread Anthony Tuininga
What is cx_OracleDBATools?

cx_OracleDBATools is a set of Python scripts that handle Oracle DBA
tasks in a cross platform manner. These scripts are intended to work the
same way on all platforms and hide the complexities involved in managing
Oracle databases, especially on Windows. Binaries are provided for those
who do not have a Python installation.


Where do I get it?

http://starship.python.net/crew/atuining


What's new?

1) Added option --replace-existing to CloneDB in order to support
issuing one command to replace an existing database with a copy of
another one.
2) Always set the enviroment, even when connecting directly using
cx_Oracle, as otherwise the wrong SID could be set and the wrong
action take place.
3) Do not prompt for the value for ORACLE_HOME if the --no-prompts
option has been invoked.
4) Increase the size of the template system tablespace for Oracle 10g
as it was too small.
5) On Windows, wait until the service is actually started or stopped
before continuing.
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


Re: How to generate geometric random numbers?

2006-07-24 Thread Robert Kern
Paul Rubin wrote:
 Robert Kern [EMAIL PROTECTED] writes:
G = int(ceil(log(U) / log(1.0 - p)))
 
 I usually owuld write that as int(ceil(log(U, 1.0 - p))).

Knock yourself out. I was cribbing from my C implementation in numpy.

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth.
   -- Umberto Eco

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


Re: Isn't there a better way?

2006-07-24 Thread Steve Holden
Lawrence D'Oliveiro wrote:
 In message [EMAIL PROTECTED], Bruno Desthuilliers
 wrote:
 
 
Lawrence D'Oliveiro a écrit :


If you're calling a number of different routines in
the Processor class, all accessing the same data, then it makes perfect
sense to only pass it once.

Actually they are not passed.
 
 
 I think I'm going to plonk you.

And the rest of comp.lang.python has to know about this because ... ?

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb   http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

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

Re: How to generate geometric random numbers?

2006-07-24 Thread Paul Rubin
Robert Kern [EMAIL PROTECTED] writes:
  I usually owuld write that as int(ceil(log(U, 1.0 - p))).
 Knock yourself out. I was cribbing from my C implementation in numpy.

Oh cool, I thought you were pasting from a Python implementation. No prob. 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Isn't there a better way?

2006-07-24 Thread Lawrence D'Oliveiro
In message [EMAIL PROTECTED], Steve
Holden wrote:

 Lawrence D'Oliveiro wrote:
 In message [EMAIL PROTECTED], Bruno Desthuilliers
 wrote:
 
 
Lawrence D'Oliveiro a écrit :


If you're calling a number of different routines in
the Processor class, all accessing the same data, then it makes perfect
sense to only pass it once.

Actually they are not passed.
 
 
 I think I'm going to plonk you.
 
 And the rest of comp.lang.python has to know about this because ... ?

Some of them might be worth plonking as well?
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: How to force a thread to stop

2006-07-24 Thread Lawrence D'Oliveiro
In message [EMAIL PROTECTED],
[EMAIL PROTECTED] wrote:

 Python has no threadicide method, and its absence is not an
 oversight. Threads often have important business left to do, such
 as releasing locks on shared data; killing them at arbitrary times
 tends to leave the system in an inconsistent state.

Perhaps another reason to avoid threads and use processes instead?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Compiler for external modules for python

2006-07-24 Thread J�r�me Le Bougeant
VS2003 : http://vecchio56.free.fr/VCToolkitSetup.exe


 Hello:
 I have interesting external modules that I want to incorporate to
 python 2.4.3 and python 2.5b2 also. Some of them requires C/C++
 compiler. I work with Win XP Sp2 and have installed VC2005 express (I
 do not know if the compiler is the one with optimizing
 characterisitics), when trying to install some module using distutils
 program, it asks for C/C++ VC7 that is part of VS2003, it seems
 distutils is not configured for VC8 that is part of VC2005.
 Under this circumstances I tried to find the VC7 compiler from
 microsoft sites, however it deflect to the new version of VS2005, so I
 lost the cord and the goat .
 I do not know what to do. Does anybody has some guidelines about this
 matter?
 Thanks!!!
 


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


Re: Dive Into Python -- Still Being Updated?

2006-07-24 Thread Alan Franzoni
Il 22 Jul 2006 15:48:36 -0700, [EMAIL PROTECTED] ha scritto:

 http://diveintopython.org/getting_to_know_python/indenting_code.html
 
 The function called fib (presumably short for Fibonacci) appears to
 produce factorials. Anyway, 'fib' should really be called 'hem'. :)

I think this is just a bad name for the function... it's not stated
anywhere that it should return a Fibonacci sequence.


 
 http://diveintopython.org/native_data_types/tuples.html#odbchelper.tuplemethods
 
 I think tuples have methods, na?

Well... of course they have some *special* methods, (any python object has)
but they have no method of their own. I think this is pretty clear, it's
employed to emphasize the contrast with the list object.

BTW, you can see last update is 20 May 2004; it's right on the homepage.

-- 
Alan Franzoni [EMAIL PROTECTED]
-
Togli .xyz dalla mia email per contattarmi.
Rremove .xyz from my address in order to contact me.
-
GPG Key Fingerprint:
5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E 
-
Blog: http://laterradeglieroi.verdiperronchi.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: using names before they're defined

2006-07-24 Thread Bruno Desthuilliers
Nick Vatamaniuc wrote:
 Dave,
 
 Sometimes generating classes from .ini or XML files is not the best
 way. You are just translating one language into another and are making
 bigger headaches for your self. It is certainly cool and bragable to
 say that my classes get generated on the fly from XML but  Python is
 terse and reasonable enough to just write it in Python. In other words
 instead of saying turbine power2MW/power/turbine just write
 some Python code that instantiates a turbine  with a 2MW power based on
 your class. Then you can evaluate Python code in Python and you even
 got your on-the-fly generation.
 As a general rule, I would say to think 3 times before touching XML in
 Python unless you are absolutely forced to. Config .ini files can be
 more acceptable but Python is still best. Why write
 ;;My turbine class
 [turbine]
 power=2MW
 speed=800rpm
 ...
 when you can just say:
 #my turbine class
 t=Turbine( power=2MW, \
speed=800rpm, \
...
 First case is a little shorter but then you have to use a parser for it

There's one builtin.

 while in the second case you just execute the file, and besides, you
 can edit it with any Python editor.
 

This is certainly nice when the users are able to write python code, but
that's not always the case. Also, it can be dangerous to directly
execute user's python code...


-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: function v. method

2006-07-24 Thread Bruno Desthuilliers
Antoon Pardon wrote:
 On 2006-07-21, Bruno Desthuilliers [EMAIL PROTECTED] wrote:
 
Antoon Pardon wrote:

On 2006-07-21, fuzzylollipop [EMAIL PROTECTED] wrote:


danielx wrote:


(snip)


if you prefix with a single underscore, that tells the user, DON'T MESS
WITH ME FROM OUTSIDE! I AM AN IMPLEMENTATION DETAIL!


Personnaly I don't like this convention. 

To bad for you.
 
 
 I'll survive.
 
 
It isn't clear enough.

Oh yes ?


Suppose I am writing my own module, I use an underscore, to
mark variables which are an implementation detail for my
module.

Now I need to import an other module in my module and need access
to an implementation variable from that module.

So now I have
variables with an underscore which have two different meanings:

  1) This is an implemantation detail of this module, It is the
 users of my module who have to be extra carefull using it.

  2) This is an implemantation detail of the other module,
 I should be extra carefull using it.

Either you imported with the from othermodule import * form (which you
shouldn't do), and you *don't* have the implementation of othermodule,
or your used the import othermodule form, in which case it's pretty
obvious which names belongs to othermodule.
 
 
 As far as I understand the _name convention is often defended with the
 argument that it stands out.

It does.

 Now if you have to go and look at the
 import statements to make a disticntion, then it seems that the
 way _names standout isn't that usefull.

Please re-read the Fine Manual and try to understand what I wrote above.
You don't have to parse the import statements to know if you're dealing
with a local implementation detail or implementation of another module,
unless you do braindead renames of imported symbols.

Anyway, messing with another module's implementation should be *very* rare.

 
And I find variable starting or ending with an underscore ugly. :-)

Too bad for you. Choose another language then... PHP, Perl, Ruby ?-) 
 
 Not a very strong argument. Whether or not someone has a legitimat point
 of criticism against Python or some of the conventions used. You can
 always reply: Too bad, better choose another language then.

There are very few chances this convention will change anytime soon. You
may not like it for any good or bad reason, the fact is that you have to
live with it.

FWIW, the choice of other languages I proposed as an alternative is not
totally innocent : they all are possible replacements for Python, and
they all have their share of ugly cryptic notations... I'm not myself a
big fan of the leading underscore, but it's certainly a lesser evil when
compared to $php_vars or others @myperlishstuff. Or with C++
m_myMemberVar FWIW.


-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2006-07-24 Thread Markus
You know you're guilty of early/over optimisation, when it's almost two
in the morning and the file open in front of you reads as follows.

  The code you are about to read is real...
  Some of the variable names have been changed
  to protect the families of those involved.

[-snip-]

from timeit import Timer

if __name__=='__main__':
 t = Timer('len(argv)==1','from sys import argv')
 print %f usec/pass % (100 * t.timeit(number=10)/10)
 t = Timer('argv[0]==argv[-1]','from sys import argv')
 print %f usec/pass % (100 * t.timeit(number=10)/10)

[-snip-]

For anyone is in danger of making the same mistakes I've made...
the results were:

   0.219154 usec/pass
   0.297468 usec/pass


If anyone doesn't understand...
  Timer is a Class for timing execution speed of small code snippets.
  The quoted description of Timer and the original code I derived the
  above snippet from, can be found in the Python documentation.

Finally, for anyone who is wondering...
  I will seek help as soon as I have some free time.

;)

Markus



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


Re: function v. method

2006-07-24 Thread Bruno Desthuilliers
Antoon Pardon wrote:
 On 2006-07-21, fuzzylollipop [EMAIL PROTECTED] wrote:
 
Antoon Pardon wrote:


Suppose I am writing my own module, I use an underscore, to
mark variables which are an implementation detail for my
module.

Now I need to import an other module in my module and need access
to an implementation variable from that module. So now I have
variables with an underscore which have two different meanings:

you don't understand what implementation detail means, it means it is
NOT part of the public API and no client code should ever use it.

If you reference _vara in your code and it is in someone elses module
you don't understand YOU ARE NOT SUPPOSED TO DO THAT!
 
 
 Why do you assume that in my example the other module is
 not understood?

He doesn't, but it's clear that *you* didn't understand what
fuzzylollipop meant !-)

Hint : add a comma at the right place so parsing is unambigous:

If you reference _vara in your code and it is in someone elses module,
you don't understand YOU ARE NOT SUPPOSED TO DO THAT!



 
  1) This is an implemantation detail of this module, It is the
 users of my module who have to be extra carefull using it.

Users of your module should NEVER KNOW any of the _ or __ stuff exists
to begin with.


  2) This is an implemantation detail of the other module,
 I should be extra carefull using it.

You should NEVER use it.
 
 
 Well that may be your view, but AFAICS it is not the view of
 the python community. Because each time some mechanism is
 proposed for real private variable, people oppose it, they
 want people to have access to what are supposed to be
 private variables.

I'd express it in a somewhat different way: the view of the Python
community is that language-inforced access restrictions are useless and
annoying, IOW an unnecessary pain. Which doesn't imply that messing with
implementation of other modules is actually *encouraged*. Having the
possibility to easily do so is quite handy when that's the only/less
worse solution, but is not a recommended approach in general.

-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Nested function scope problem

2006-07-24 Thread Bruno Desthuilliers
Bruno Desthuilliers wrote:
(snip)
 First point: the nested function only have access to names that exists
 in the enclosing namespace at the time it's defined.

Duh.

Sometimes I'd better go to bed instead of answering posts here - I'd say
less stupidities. re-reading this, I can't believe I actually wrote such
an absurdity.




-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Nested function scope problem

2006-07-24 Thread Bruno Desthuilliers
danielx wrote:
 Bruno Desthuilliers wrote:
 
Josiah Manson a écrit :

I found that I was repeating the same couple of lines over and over in
a function and decided to split those lines into a nested function
after copying one too many minor changes all over. The only problem is
that my little helper function doesn't work! It claims that a variable
doesn't exist. If I move the variable declaration, it finds the
variable, but can't change it. Declaring the variable global in the
nested function doesn't work either.

But, changing the variable in the containing scope is the whole purpose
of this helper function.

I'm new to python, so there is probably some solution I haven't
encountered yet. Could you please suggest a nice clean solution? The
offending code is below. Thanks.

def breakLine(s):
 Break a string into a list of words and symbols.
 
 def addTok():
 if len(tok)  0:

 if tok:

An empty sequence evals to False in a boolean context.


 ls.append(tok)
 tok = ''

 
 
 I can't figure out why Josiah's breakLine function won't work either. I
 know Josiah has had his problem resolved, but I'd still like to know
 why his func won't work. I'd like to redirect this discussion in that
 direction, if I may.
 
 
First point: the nested function only have access to names that exists
in the enclosing namespace at the time it's defined.

oops - Sorry, said an obvious stupidity here (was very tired, should not
have answered at all...)

 
 Coming from lisp, that doesn't make very much sense, and I'm not sure
 that's true. If you move the def for addTok bellow the lines that
 initialize the locals of breakLines, you still get the same problem.

of course.

 
Second point: a nested function cannot rebind names from the enclosing
namespace. Note that in Python, rebinding a name and modifying the
object bound to a name are very distinct operations.
 
 
 I'm not sure that's the problem, because when I ran the debugger, the
 problem is with the line that says if len(tok), not the one bellow it
 which says tok = . 

That's a side-effect of rebinding tok - it makes the name local. Even if
the rebiding is done *after* first use of the name...


 
Third point : functions modifying their environment this way are usually
considered bad form.
 
 
 Again, this is coming from lisp, but I don't see anything wrong with
 that :P.



 ***
 
 After some experimentation, I am completely baffeled as to why
 breakLine won't work. Here is an example of one of the things I did,
 which I believe exactly mimics what breakLine does:
 
def outer():
 
 ...   def inner():
 ...   if outerLocal:
 ...   return I hear you, 'hello world'.
 ...   else:
 ...   return Come again?
 ...   outerLocal = hello world
 ...   return inner()
 ...
 
outer()
 
 I hear you, 'hello world'.
 
 As I said, I believe the line which sets tok should break (quietly),
 but not the line which tests tok. My experiment seems to confirm
 this...

You did not rebind 'outerLocal' in your above code.

 One thing I can understand is why the line tok =  in addTok won't
 work. This is because when Python sees that line, it should create a
 new local variable in the scope of addTok.

Yes. But this local name is referenced before assignment.

 Once addTok returns, that
 variable is lost. That's pretty deep, now that I've thought about it...
 

(snip)

Sorry once again for the obvious stupidity I wrote as first point. Next
time I'll go to bed instead, I promise :(

-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Isn't there a better way?

2006-07-24 Thread Bruno Desthuilliers
Lawrence D'Oliveiro wrote:
 In message [EMAIL PROTECTED], Bruno Desthuilliers
 wrote:
 
 
Lawrence D'Oliveiro a écrit :


If you're calling a number of different routines in
the Processor class, all accessing the same data, then it makes perfect
sense to only pass it once.

Actually they are not passed.
 
 
 I think I'm going to plonk you.

Do what you want.

-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Isn't there a better way?

2006-07-24 Thread Bruno Desthuilliers
Lawrence D'Oliveiro wrote:
 In message [EMAIL PROTECTED], Steve
 Holden wrote:
 
 
Lawrence D'Oliveiro wrote:

In message [EMAIL PROTECTED], Bruno Desthuilliers
wrote:



Lawrence D'Oliveiro a écrit :



If you're calling a number of different routines in
the Processor class, all accessing the same data, then it makes perfect
sense to only pass it once.

Actually they are not passed.


I think I'm going to plonk you.

And the rest of comp.lang.python has to know about this because ... ?
 
 
 Some of them might be worth plonking as well?

Certainly. I suggest that you put in your killfile anyone not agreeing
with you on any point, or having the bad idea to point out inexact or
ambigous stuff in your posts. This will surely make this ng a very more
friendly place to you - while perhaps not as useful.

-- 
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: How to force a thread to stop

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

If the processes are sharing resources, the exact same problems arise.
-- 
http://mail.python.org/mailman/listinfo/python-list


PySNMP Thread unsafe?

2006-07-24 Thread rob . audenaerde
I'm trying to monitor about 250 devices with SNMP, using PySNMP version
4. I use the threading.Thread to create a threadpool of 10 threads, so
devices not responding won't slow down the monitoring process too much.


Here comes my problem. When using PySNMP single threaded, every this
goes well; but if I create 10 threads, it all goes awry... It seems
PySNMP is not thread safe? Can anyone elaborate on this?

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


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

2006-07-24 Thread John Machin
Markus wrote:
 You know you're guilty of early/over optimisation, when it's almost two
 in the morning and the file open in front of you reads as follows.

   The code you are about to read is real...
   Some of the variable names have been changed
   to protect the families of those involved.

 [-snip-]

 from timeit import Timer

 if __name__=='__main__':
  t = Timer('len(argv)==1','from sys import argv')
  print %f usec/pass % (100 * t.timeit(number=10)/10)
  t = Timer('argv[0]==argv[-1]','from sys import argv')
  print %f usec/pass % (100 * t.timeit(number=10)/10)

 [-snip-]

 For anyone is in danger of making the same mistakes I've made...
 the results were:

0.219154 usec/pass
0.297468 usec/pass


 If anyone doesn't understand...
   Timer is a Class for timing execution speed of small code snippets.
   The quoted description of Timer and the original code I derived the
   above snippet from, can be found in the Python documentation.

 Finally, for anyone who is wondering...
   I will seek help as soon as I have some free time.


Do you realise that the two expressions that you are comparing are not
even equivalent, and moreover you ignored an expression that will be
faster and equivalent (unless/until somebody decides on an
optimisation like interning/sharing strings between/among sys.argv
elements).

C:\junktype showargs.py
from sys import argv
print argv, len(argv)==1, argv[0]==argv[-1], argv[0] is argv[-1]

C:\junkshowargs.py C:\junk\showargs.py
['C:\\junk\\showargs.py', 'C:\\junk\\showargs.py'] False True False

C:\junkpython -mtimeit -sa=['jabberwocky','jabber'+'wocky']
len(a)==1
100 loops, best of 3: 0.142 usec per loop

C:\junkpython -mtimeit -sa=['jabberwocky','jabber'+'wocky']
a[0]==a[-1]
100 loops, best of 3: 0.191 usec per loop

C:\junkpython -mtimeit -sa=['jabberwocky','jabber'+'wocky'] a[0] is
a[-1]
1000 loops, best of 3: 0.135 usec per loop

C:\junkpython -mtimeit -sa=['jabberwocky'] len(a)==1
100 loops, best of 3: 0.132 usec per loop

C:\junkpython -mtimeit -sa=['jabberwocky'] a[0]==a[-1]
100 loops, best of 3: 0.14 usec per loop

C:\junkpython -mtimeit -sa=['jabberwocky'] a[0] is a[-1]
100 loops, best of 3: 0.111 usec per loop

Cheers,
John

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


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

2006-07-24 Thread GinTon
I'm trying to get the 'FOO' string but the problem is that inner 'P'
tag there is another tag, 'a'. So:

 from BeautifulSoup import BeautifulSoup
 s = 'td width=88% valign=TOP p class=contentBodyFOO a 
 name=f/a /p/td'
 tree = BeautifulSoup(s)

 print tree.first('p')
p class=contentBodyFOO a name=f/a /p

So if I run 'print tree.first('p').string' to get the 'FOO' string it
shows Null value because it's the 'a' tag:

 print tree.first('p').string
Null

Any solution?

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


Re: Generating all possible combination of elements in a list

2006-07-24 Thread Mir Nazim

Martin v. Löwis wrote:
 Mir Nazim wrote:
  Example Problem:
 
  Generate all possible permutations for
  [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]
 
  [1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 1, 2] (notice an extra 2 )
 
  eliminate some combinations based on some conditions and combine the
  rest of combinations. And now generate all possible combinations for
  resulting data set.
  Hope you get the idea.

 Unfortunately, I don't. Why do you have two lists for which to generate
 permutations? Why is it important that the second list has an extra 2
 (actually, not extra, but it replaces a 1)?
 What are some conditions by which to eliminate permutations?
 How to combine the remaining permutations?
 What is the resulting data set, and what is a possible combination
 of it?

condition are there cannot be more than 3 consecutive 2's or 1's

 If the task is to produce all distinct permutations of 6 occurrences
 of 1 and 6 occurrences of 2, I suggest the program below. It needs
 produces much fewer than 12! results (namely, 924).


Yes that number I had already worked out and it is 792 for second list.
Now I have generated all distinct permutations and after eliminating
the permutations based on above condition I am left with 1060
permutations.

Now I ahave a lits with 1060 lists in it. Now comes the hard part.
How many possible distinct ways are there to arrange 1060 elements
taken 96 at a time

1060! / (1060 - 96)!


Hope you got the idea, why i need some faster ways to do it.
Now out of these i need to test only those lists whose sum of
elements(18 or 19) follows a particular pattern.

Can Anybody can alternate ways to do it on a Celeron 1.4 Ghz, 256 MB
RAM laptop.

Thnaks

 Regards,
 Martin

 numbers = [1,2]
 remaining = [None, 6, 6]
 result = [None]*12

 def permutations(index=0):
 if index == 12:
 yield result
 else:
 for n in numbers:
 if not remaining[n]:
 continue
 result[index] = n
 remaining[n] -= 1
 for k in permutations(index+1):
 yield k
 remaining[n] += 1
 
 for p in permutations():
 print p

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


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

2006-07-24 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], GinTon wrote:

 I'm trying to get the 'FOO' string but the problem is that inner 'P'
 tag there is another tag, 'a'. So:
 
 from BeautifulSoup import BeautifulSoup
 s = 'td width=88% valign=TOP p class=contentBodyFOO a 
 name=f/a /p/td'
 tree = BeautifulSoup(s)
 
 print tree.first('p')
 p class=contentBodyFOO a name=f/a /p
 
 So if I run 'print tree.first('p').string' to get the 'FOO' string it
 shows Null value because it's the 'a' tag:
 
 print tree.first('p').string
 Null
 
 Any solution?

In [53]: print tree.first('p').contents[0]
FOO

Ciao,
Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Generating all possible combination of elements in a list

2006-07-24 Thread Paul Rubin
Mir Nazim [EMAIL PROTECTED] writes:
 Now I ahave a lits with 1060 lists in it. Now comes the hard part.
 How many possible distinct ways are there to arrange 1060 elements
 taken 96 at a time
 
 1060! / (1060 - 96)!

More than you want to think about:

import math

def logf(n):
return base-10 logarithm of (n factorial)
f = 0.0 
for x in xrange(1,n+1):
f += math.log(x, 10)
return f

print logf(1060) - logf(1060 - 96)

Of course there are other ways you can calculate it, e.g.

   http://en.wikipedia.org/wiki/Stirlings_approximation
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re-evaluating a string?

2006-07-24 Thread John Machin

Tim Chase wrote:
[snip]
  As
 such, I'd rework the move() function I suggested to simply be
 something like

 def move(rate,lo,hi,chan=1):
   return !SC%c%c%c%c\r % (chan, rate, lo, hi)

 where you possibly even just pass in the position parameter,
 and let the function do the splitting with something like

 def move(rate,position,chan=1)
   hi,lo = divmod(position  0x, 256)
   return !SC%c%c%c%c\r % (chan, rate, lo, hi)

 or optionally use the struct module to unpack them.

Say what? We need to pack the position first, we can't use
struct.unpack on an integer, only a string. So that ends up looking
like this:

def move(rate,position,chan=1):
lo, hi = struct.unpack(BB, struct.pack(H, position))
return !SC%c%c%c%c\r % (chan, rate, lo, hi)

which is a bit, shall we say, unfortunate. Why unpack it when we've
already packed it just so we can pack it with another method? This is
getting close to dailyWTF territory. Forget that. Let's go the whole
hog with struct.pack:

def move(rate,position,chan=1):
return struct.pack(3sBBHs, !SC, chan, rate, position, \r)

What I tell you 3 times is true ... just use struct.pack and stop
faffing about. Get used to it. One day you'll have to output a negative
1-or-two-byte integer, a four-byte integer, a float even -- no
scratching your head about what bits to shift, what mask to use, just
fill in the codes from the manual and away you go.

HTH,
John



Cheers,
John

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


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

2006-07-24 Thread GinTon

Marc 'BlackJack' Rintsch wrote:
 In [53]: print tree.first('p').contents[0]
 FOO
 
Thanks! I was going to crazy with this.

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


Need a compelling argument to use Django instead of Rails

2006-07-24 Thread Ray
I just moved to another company that's mainly a Java/.NET shop. I was
happy to find out that there's a movement from the grassroot to try to
convince the boss to use a dynamic language for our development!

Two of the senior developers, however, are already rooting for Ruby on
Rails--although they haven't tried RoR themselves. When I suggested
Django, they went like, what's that?.

I said, It's like the Python counterpart of RoR.

Nah, we're not interested in Python.

I think they are already predisposed to RoR simply because of RoR's
visibility (i.e.: at my workplace everybody knows RoR but nobody knows
about Django unless they've used Python as well). So far the arguments
I can think of:

1. The investment of learning Python will be a good investment because
it transfer to platforms that we've already supported, i.e.: JVM and
.NET CLR (using Jython and IronPython). Ruby's availability on this
platform is not as mature--JRuby is still at 0.9 and I don't think
IronRuby is coming out anytime soon :)

2. Python is a much more mature language than Ruby--it's been around
since ages ago and as such has a lot more tools, articles, and other
resources than Ruby. It is also the language being used by
high-visibility company like Google, with the creator of the language
himself working there.

3. Python emphasizes readability instead of cleverness/conciseness.

4. What else? I haven't tried RoR so I can't argue meaningfully on
whether using Django will put us at an advantage.

Can you help me with my argument? Meanwhile I think I'll give RoR a try
as well.

Thank you,
Ray

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


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

2006-07-24 Thread Nick Vatamaniuc
Quick-n-dirty way:
After you  get your whole p string: p class=contentBodyFOO a
name=f/a /p
Remove any tags delimited by '' and '' with a regex. In your short
example you _don't_ show that there might be something between the a
and /a tags so I assume there won't be anything or if there would be
something then you  also want it included in the final text. As in
'p class=contentBodyFOO a name=fURLNAME/a /p' == 'FOO
URLNAME'

For the regex start with something simple like .*? and see if it
works then improve it.  Use kiki or kodos - python visual regex
helpers.

Hope this helps,
Nick V.


GinTon wrote:
 I'm trying to get the 'FOO' string but the problem is that inner 'P'
 tag there is another tag, 'a'. So:

  from BeautifulSoup import BeautifulSoup
  s = 'td width=88% valign=TOP p class=contentBodyFOO a 
  name=f/a /p/td'
  tree = BeautifulSoup(s)

  print tree.first('p')
 p class=contentBodyFOO a name=f/a /p

 So if I run 'print tree.first('p').string' to get the 'FOO' string it
 shows Null value because it's the 'a' tag:
 
  print tree.first('p').string
 Null
 
 Any solution?

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


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

2006-07-24 Thread Steve Holden
Ray wrote:
 I just moved to another company that's mainly a Java/.NET shop. I was
 happy to find out that there's a movement from the grassroot to try to
 convince the boss to use a dynamic language for our development!
 
 Two of the senior developers, however, are already rooting for Ruby on
 Rails--although they haven't tried RoR themselves. When I suggested
 Django, they went like, what's that?.
 
 I said, It's like the Python counterpart of RoR.
 
 Nah, we're not interested in Python.
 
 I think they are already predisposed to RoR simply because of RoR's
 visibility (i.e.: at my workplace everybody knows RoR but nobody knows
 about Django unless they've used Python as well). So far the arguments
 I can think of:
 
 1. The investment of learning Python will be a good investment because
 it transfer to platforms that we've already supported, i.e.: JVM and
 ..NET CLR (using Jython and IronPython). Ruby's availability on this
 platform is not as mature--JRuby is still at 0.9 and I don't think
 IronRuby is coming out anytime soon :)
 
 2. Python is a much more mature language than Ruby--it's been around
 since ages ago and as such has a lot more tools, articles, and other
 resources than Ruby. It is also the language being used by
 high-visibility company like Google, with the creator of the language
 himself working there.
 
 3. Python emphasizes readability instead of cleverness/conciseness.
 
 4. What else? I haven't tried RoR so I can't argue meaningfully on
 whether using Django will put us at an advantage.
 
 Can you help me with my argument? Meanwhile I think I'll give RoR a try
 as well.
 
I wouldn't waste your time. A man convinced against his will is of the 
same opinion still, and they already know they aren't interested in 
Python. There are probably many other matters about which they are 
uninformed and equally determined.

   http://sethgodin.typepad.com/seths_blog/2005/08/i_changed_my_mi.html

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb   http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

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


class instance scope

2006-07-24 Thread Ritesh Raj Sarraf
Hi,

I have a class defined in a file called foo.py

In bar.py I've imported foo.py
In bar.py's main function, I instantiate the class as follows:

log = foo.log(x, y, z)

Now in main I'm able to use log.view(), log.error() et cetera.

But when I call the same method from some functions which are in
bar.py, it fails giving me the following error:

NameError: global name 'log' is not defined

1) I tried lookng into the docs but couldn't find anything on instance
scope.
2) How is such situation tackled ? Will I have to instantiate in every
function ?

Ritesh

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


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

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

Well the thing is that I have to admit I have some stake in this. If
we're using Rails then everybody's starting from 0. Whereas if we're
using Python I already know it so I'll have an easier time :)

Also, those are just two developers. Convincing the big guy, the
decision maker, is a separate matter isn't it?

Do you know of any other arguments, or you do think that for somebody
who really, really doesn't care about which language, either RoR/Ruby
or Django/Python will do just fine?

Cheers
Ray


http://sethgodin.typepad.com/seths_blog/2005/08/i_changed_my_mi.html

 regards
   Steve
 --
 Steve Holden   +44 150 684 7255  +1 800 494 3119
 Holden Web LLC/Ltd  http://www.holdenweb.com
 Skype: holdenweb   http://holdenweb.blogspot.com
 Recent Ramblings http://del.icio.us/steve.holden

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


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

2006-07-24 Thread Ray
BTW the link below is good reading! Thanks Steve!

Steve Holden wrote:
http://sethgodin.typepad.com/seths_blog/2005/08/i_changed_my_mi.html

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


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

2006-07-24 Thread Tim Heaney
Ray [EMAIL PROTECTED] writes:

 Can you help me with my argument? 

Well, there is this study suggesting Django outperforms Ruby on Rails

  http://wiki.rubyonrails.com/rails/pages/Framework+Performance

 Meanwhile I think I'll give RoR a try as well.

Good idea. I think Ruby on Rails is terrific. Perhaps you'll think so
too. If not, at least you'll have a better idea of why you don't.

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


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

2006-07-24 Thread Ray

Tim Heaney wrote:
 Ray [EMAIL PROTECTED] writes:
 
  Can you help me with my argument?

 Well, there is this study suggesting Django outperforms Ruby on Rails

   http://wiki.rubyonrails.com/rails/pages/Framework+Performance

  Meanwhile I think I'll give RoR a try as well.

 Good idea. I think Ruby on Rails is terrific. Perhaps you'll think so
 too. If not, at least you'll have a better idea of why you don't.

Thanks Tim!! 

Cheers
Ray

 
 Tim

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


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

2006-07-24 Thread Steve Holden
Ray wrote:
 Steve Holden wrote:
 
I wouldn't waste your time. A man convinced against his will is of the
same opinion still, and they already know they aren't interested in
Python. There are probably many other matters about which they are
uninformed and equally determined.
 
 
 Well the thing is that I have to admit I have some stake in this. If
 we're using Rails then everybody's starting from 0. Whereas if we're
 using Python I already know it so I'll have an easier time :)
 
 Also, those are just two developers. Convincing the big guy, the
 decision maker, is a separate matter isn't it?
 
 Do you know of any other arguments, or you do think that for somebody
 who really, really doesn't care about which language, either RoR/Ruby
 or Django/Python will do just fine?
 
Well, my view is that both are frameworks, and so you will inevitably 
run out of steam at some point if your implementation plans become too 
ambitious. The impression I get is that Rails is relatively inflexible 
on database schemas, and once you get off the beaten track it gets 
difficult to cope with complex existing databases.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb   http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

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


Re: Python to log into web site

2006-07-24 Thread Christoph Haas
On Tuesday 18 July 2006 17:46, david brochu jr wrote:
 I have been browsing around the net looking for a way (hopefully an
 easily implemented module) to log into a web site using python. The site
 I wish to log into is an internal site which requires email address and
 password for authentication. Does anyone have any suggestions or links
 that might point me in the right direction?

Is http://twill.idyll.org/ perhaps something for you?

Regards
 Christoph
-- 
~
~
.signature [Modified] 1 line --100%--1,48 All
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: class instance scope

2006-07-24 Thread Steve Holden
Ritesh Raj Sarraf wrote:
 Hi,
 
 I have a class defined in a file called foo.py
 
 In bar.py I've imported foo.py
 In bar.py's main function, I instantiate the class as follows:
 
 log = foo.log(x, y, z)
 
 Now in main I'm able to use log.view(), log.error() et cetera.
 
Correct. Because, having instantiated the class and retained a reference 
to the instance, the methods of the instance are available relative to 
the name containing the reference.

 But when I call the same method from some functions which are in
 bar.py, it fails giving me the following error:
 
 NameError: global name 'log' is not defined
 
Well, that's preumbaly because your

   log = foo.log(x, y, z)

statement was inside a function, and so the name foo was created in 
that function's local namespace rather than in the module's global 
namespace.

 1) I tried lookng into the docs but couldn't find anything on instance
 scope.
 2) How is such situation tackled ? Will I have to instantiate in every
 function ?
 
The best thing to do would be to pass the instance in as an argument to 
the functions that need to manipulate it.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb   http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

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


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

2006-07-24 Thread Ray
Thanks Sybren for the reply! Regarding this point:

 The form handling is also excellent.

Is it excellent in a way that's better than RoR in certain ways?

Regards,
Ray

Sybren Stuvel wrote:
 Ray enlightened us with:
  Two of the senior developers, however, are already rooting for Ruby on
  Rails--although they haven't tried RoR themselves. When I suggested
  Django, they went like, what's that?.
 
  I said, It's like the Python counterpart of RoR.

 Bad answer. Now they think they'll get the same thing they already
 have with RoR, but that they'll have to put more effort into it.

  Nah, we're not interested in Python.

 Ask them why.

  I think they are already predisposed to RoR simply because of RoR's
  visibility (i.e.: at my workplace everybody knows RoR but nobody
  knows about Django unless they've used Python as well).

 Which means most of the people saying we're not interested in Python
 do so without proper reason, since they don't know the language.

  1. The investment of learning Python will be a good investment
  because it transfer to platforms that we've already supported, i.e.:
  JVM and .NET CLR (using Jython and IronPython). Ruby's availability
  on this platform is not as mature--JRuby is still at 0.9 and I don't
  think IronRuby is coming out anytime soon :)

 Jython isn't up to par with current Python versions either.

  2. Python is a much more mature language than Ruby--it's been around
  since ages ago and as such has a lot more tools, articles, and other
  resources than Ruby. It is also the language being used by
  high-visibility company like Google, with the creator of the
  language himself working there.

 That is _definitely_ true. The behaviour of Ruby hasn't even properly
 been defined.

  4. What else? I haven't tried RoR so I can't argue meaningfully on
  whether using Django will put us at an advantage.

 Check out the admin you get for free with Django. Add/edit/delete
 controls are easily done with RoR, but Django comes with a mature,
 easy to use, on-the-fly generated, customizable admin. The form
 handling is also excellent.

 Sybren
 --
 The problem with the world is stupidity. Not saying there should be a
 capital punishment for stupidity, but why don't we just take the
 safety labels off of everything and let the problem solve itself?
  Frank Zappa

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


Re: Python to log into web site

2006-07-24 Thread Steve Holden
david brochu jr wrote:
 Hi,
  
 I have been browsing around the net looking for a way (hopefully an 
 easily implemented module) to log into a web site using python. The site 
 I wish to log into is an internal site which requires email address and 
 password for authentication. Does anyone have any suggestions or links 
 that might point me in the right direction?
  
 
Look for mechanzie and clientform, both by John J Lee, in sourceforge. 
They can both help a lot.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb   http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

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


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

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

Hi Steve,

Thanks for the reply! Regarding running out of steam, well... we've
been using Struts + Spring + Hibernate on the Java side, so yeah, we're
quite used to molding our code to fit frameworks :)

Cheers
Ray


 regards
   Steve
 --
 Steve Holden   +44 150 684 7255  +1 800 494 3119
 Holden Web LLC/Ltd  http://www.holdenweb.com
 Skype: holdenweb   http://holdenweb.blogspot.com
 Recent Ramblings http://del.icio.us/steve.holden

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


Re: class instance scope

2006-07-24 Thread Ritesh Raj Sarraf

Steve Holden wrote:
 Ritesh Raj Sarraf wrote:
  But when I call the same method from some functions which are in
  bar.py, it fails giving me the following error:
 
  NameError: global name 'log' is not defined
 
 Well, that's preumbaly because your

log = foo.log(x, y, z)

 statement was inside a function, and so the name foo was created in
 that function's local namespace rather than in the module's global
 namespace.


So if I do the instantiation before calling main(), will it work.
Something like:

if __name__ == __main__:
log = foo.log(x, y, z)
main()

In this case, will log be global ?
But still I get the same error.

  1) I tried lookng into the docs but couldn't find anything on instance
  scope.
  2) How is such situation tackled ? Will I have to instantiate in every
  function ?
 
 The best thing to do would be to pass the instance in as an argument to
 the functions that need to manipulate it.


But then how do os, sys, and other modules which are imported, become
accessible to all the functions ?

I'm a newbie, so please bear with me.

Ritesh

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


Re: Python to log into web site

2006-07-24 Thread Steve Holden
Steve Holden wrote:
 david brochu jr wrote:
 
Hi,
 
I have been browsing around the net looking for a way (hopefully an 
easily implemented module) to log into a web site using python. The site 
I wish to log into is an internal site which requires email address and 
password for authentication. Does anyone have any suggestions or links 
that might point me in the right direction?
 

 
 Look for mechanzie and clientform, both by John J Lee, in sourceforge. 
 They can both help a lot.
 
Sorry, that first one is mechanize.
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb   http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

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


Pydev 1.2.2 released

2006-07-24 Thread Fabio Zadrozny
Hi All,

 

 Pydev and Pydev Extensions 1.2.2 have been released

 

 Details on Pydev Extensions: http://www.fabioz.com/pydev

 Details on Pydev: 
http://pydev.sf.net 

 Details on its development: http://pydev.blogspot.com




 Release Highlights in Pydev Extensions:

 -


 - Added the 'toggle completion type' when Ctrl is pressed in the code-completion for context-insensitive data

 IMPORTANT:The binding for creating the interactive console and
passing commands to the shell has been changed to Ctrl+Alt+Enter
(because Ctrl+Enter is now used when applying a toggled completion).
Details for toggle completion type:
Blog:http://pydev.blogspot.com/2006/07/improving-code-completion-in-pydev.html

- When getting some definition, if it is defined by an import..from, it keeps going until the actual token is found
- Duplicated signature is no longer warned inside an if..else
- Mark occurrences bug-fix
- Handling nested 'for' declarations and nested list comprehensions correctly in code-analysis
 Release Highlights in Pydev: -- Code Completion

 * Calltips added to pydev
 * The parameters are now linked when a completion is
selected (so, tab iterates through them and enter goes to the end of
the declaration)
 * Parameters gotten from docstring analysis for builtins that don't work with 'inspect.getargspec'
 * Getting completions for the pattern a,b,c=range(3) inside a class
 * Code completion for nested modules had a bug fixed
 * Added the 'toggle completion type' when ctrl is pressed in the code-completion for context-sensitive data
 * Code-completion works correctly after
instantiating a class: MyClass(). -- will bring correct completions
 * Code-completion can now get the arguments passed when instatiating a class (getting the args from __init__)
 * self is added as a parameter in the completion analyzing whether we're in a bounded or unbounded call
 * Pressing Ctrl+Space a second time changes default / template completions
 See details on toggling completion mode,
cycling through completions and linked mode (blog:
http://pydev.blogspot.com/2006/07/improving-code-completion-in-pydev.html)


Outline View

 * Added option for hiding comments and imports
 * Persisting configuration
 * Added option for expanding all

Others

 * Possibility of setting pyunit verbosity level (by Darrell Maples)
 * Errors getting the tests to run are no longer suppressed
 * Ctrl+2+kill also clears the internal cache for
compiled modules (especially useful for those that create compiled
dependencies).
 * Last opened path remembered when configuring the pythonpath (dialog)
 What is PyDev? --- 
PyDev is a plugin that enables users to use Eclipse for Python and
Jython development -- making Eclipse a first class Python IDE -- It
comes with many goodies such as code completion, syntax highlighting,
syntax analysis, refactor, debug and many others.   Cheers,  --  Fabio Zadrozny -- Software Developer  ESSS - Engineering Simulation and Scientific Software
 http://www.esss.com.br  Pydev Extensions 

http://www.fabioz.com/pydev  Pydev - Python Development Enviroment for Eclipse
 http://pydev.sf.net 

http://pydev.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list

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

2006-07-24 Thread David Cook
On 2006-07-24, Sybren Stuvel [EMAIL PROTECTED] wrote:

 Jython isn't up to par with current Python versions either.

But the last release is up to the level of C-Python 2.2 or so.  I don't
really feel like I'm missing that much with it.

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


Re: class instance scope

2006-07-24 Thread Ritesh Raj Sarraf
  log = foo.log(x, y, z)
 

Resulting line is:
log = foo.log(x, y, z)
global log

Making the instance log global makes it accessible to all the
functions.

Now I have only one question, Is this a correct way to do it ? Or are
there better way ?

Ritesh

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


Re: [Newbie] List from a generator function

2006-07-24 Thread Sion Arrowsmith
Paul Rubin  http://[EMAIL PROTECTED] wrote:
 print list(islice(starmap(random.choice, repeat((possible_notes,))), length))

Why the use of starmap() rather than
imap(random.choice, repeat(possible_notes))
?

-- 
\S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/
  ___  |  Frankly I have no feelings towards penguins one way or the other
  \X/  |-- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
-- 
http://mail.python.org/mailman/listinfo/python-list

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

2006-07-24 Thread Ray

David Cook wrote:
 On 2006-07-24, Sybren Stuvel [EMAIL PROTECTED] wrote:

  Jython isn't up to par with current Python versions either.

 But the last release is up to the level of C-Python 2.2 or so.  I don't
 really feel like I'm missing that much with it.

You mean the alpha? They're rushing for a beta now that'll bring Jython
to 2.2, I hope it'll come out soon. But yeah, compared to IronPython
(2.4 compliant, halfway to 2.5 even), it's pretty behind. But things
are changing the development seems to be picking up speed again!

Cheers
Ray

 
 Dave Cook

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


MySQLdb and dictcursor

2006-07-24 Thread borris
doesn anyone know a good reference, tute or examples of
MySQLdb's dictCursor 
I want to pass dictionaries into the sql exec statements.
I could only succeed with text as values


this is how I got the cursor object to call  cursor.execute(query)
connection = MySQLdb.connect( host = localhost, user = 
self.config.userName, passwd = self.config.password, cursorclass = 
MySQLdb.cursors.DictCursor)   

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


Re: class instance scope

2006-07-24 Thread Jeethu Rao
You could possibly make the log class a singleton or a borg.

Jeethu Rao

Ritesh Raj Sarraf wrote:
 log = foo.log(x, y, z)

   

 Resulting line is:
 log = foo.log(x, y, z)
 global log

 Making the instance log global makes it accessible to all the
 functions.

 Now I have only one question, Is this a correct way to do it ? Or are
 there better way ?

 Ritesh

   

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


Re: MySQLdb and dictcursor

2006-07-24 Thread Christoph Haas
On Monday 24 July 2006 14:06, borris wrote:
 doesn anyone know a good reference, tute or examples of
 MySQLdb's dictCursor
 I want to pass dictionaries into the sql exec statements.
 I could only succeed with text as values

A german linux magazin has an article about passing a *list* of items at
http://www.linux-magazin.de/Artikel/ausgabe/2002/06/python-api/python-api.html

For those who don't understand german here comes an example on how to pass 
lists:

cursor.execute(INSERT INTO Adressen (Name, Strasse, PLZ, Ort)
  VALUES (%s, %s, %s, %s),
   [ ('Dr. Hans Mustermann', 'Musterstraße 13', 50823, 'Köln'),
 ('Peter Lustig', 'Im Bauwagen 2', 50827, 'Porz'),
 ('Edmund Stoiber', 'Spendensumpf 1', 47011, 'Bimbesdorf'),
 ('Onkel Hotte', 'Im Siff 42', 57072, 'Siegen'),
 ('Gerhard Schröder', 'Großmaulweg 2', 11901, 'Worthülsen') ]
  )

However the DictCursor is helpful for *returning* dictionaries of values 
instead of just tuples. I always use DictCursor because it makes it 
clearer which rows I want to access in the result. But DictCursor can't 
pass dictionaries in a cursor.execute AFAIKT.

But with dict.iteritems that shouldn't be hard to send dictionary items to 
the SQL database in a loop either.

Regards
 Christoph
-- 
~
~
.signature [Modified] 1 line --100%--1,48 All
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python linker

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

Sure, I meant without wxWidgets.

 The easy solution is to compare apples with apples: if, in your
 application space, it is crucial to use only DLLs that are already
 installed on the target machines, you can do that from Python (with
 ctypes, for example) just as you can from C.

But even that is sadly not practical, since the Python DLL alone is
about 30 times the size of a tiny app like Notepad (for example).

 What generally happens in the real world is rather different:
 applications get programmed in whatever language and release/version is
 handy, and the runtimes are separately offered for download and install
 to those users who have not yet installed any previous application using
 the same language and release/version.

The real world is a big and diverse place, and I assure you that my
applications are no less real than your own! :)  Sometimes you simply
cannot pick a language and version at leisure and expect everybody to
install whatever is required. There are some things - casual
entertainment products for example, or one-shot system checking tools,
etc - where people are reluctant to install anything at all, and will
not bother if they see a 6MB download.

I wasn't saying this was a problem with Python - though I do expect
that .dll could be trimmed down a bit - but it is a bit of a shame that
I can't easily distribute something less than 1MB in size using Python.

-- 
Ben Sizer

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


Re: easy questions from python newbie

2006-07-24 Thread walterbyrd
Thanks to all who replied.

As I mentioned, I am new to python. I will have to look some of this
stuff, but that is fine. I am trying to learn.

I am sorry I forgot to mention, the platform is windows-xp. I am doing
this for a client who has a small warehouse operation. Personally, I
usually use debian at home.

If it matters, the origianl file is coming from a portable scanner.
After it's uploaded to the PC, the file needs to be hand processed,
then loaded into an remote site with a mysql backend.

When new items are recieved, they are scanned into a portable device,
then transferred to a file on a PC. The python app will then process
that file to provide item counts so that the shipment can be easily
compared to the packing list (there has been a lot of trouble with
shipments not matching). Once the list is checked, the items will have
to placed into bins - this is why I need the file to be loaded into
excel. The corresponding bin numbers will have to entered into that
spreadsheet, then saved to a cvs, then the cvs will be processed into
the online database.

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


Re: random shuffles

2006-07-24 Thread Ben Sizer
Ross Ridge wrote:
 David G. Wonnacott wrote:
  Couldn't we easily get an n*log(n) shuffle...

 Why are you trying to get an O(n*log(n)) shuffle when an O(n) shuffle
 algorithim is well known and implemented in Python as random.shuffle()?

I think David is referring to this: don't you still need to use
O(log(n)) time to find and remove the item from the collection?

The answer for him is no: as far as I know, the Python list is a
random-access structure, so looking up 2 items and swapping them runs
in constant time. You perform that N times to shuffle the sequence, so
it runs in O(N).

-- 
Ben Sizer

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


threading+ftp+import = block

2006-07-24 Thread Panard
Hi,
I'm experiencing a strange problem while trying to manage a ftp connection
into a separate thread.

I'm on linux, python 2.4.3

Here is a test :
-- ftp_thread.py --
import ftplib
import threading
import datetime

class test( threading.Thread ) :
ftp_conn = ftplib.FTP(localhost,user,pass)
def run( self ) :
print self.ftp_conn.pwd()
self.ftp_conn.dir(/)
print datetime.date.today()
def t() :
t = test()
t.start()
t.join()
t()
---

If I do :
$ python ftp_thread.py
/
drwxrwsr-x   2 panard   ftp  4096 Jul 24 12:48 archives
2006-07-24
== Works perfectly

But :
$ python
 import ftp_thread
/
program block

For a strange reason, I've tried to add theses lines before the 't()' call :

ftp_conn = ftplib.FTP(localhost,user,pass)
ftp_conn.dir(/)

And then, when calling t(), self.ftp_conn.dir(/) shows the list ! (I guess
a problem of globals()/import .. ?)
But... the program now blocks just before displaying today date...

I guess I'm doing something really wrong with threads.. but I don't know
what...

Any hints?

Thanks

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


Exercises for dive into python

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

Ben


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


_mssql on Python 2.5 Beta 2

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

*** glibc detected *** python2.5: free(): invalid pointer: 0xb7f08320
***
=== Backtrace: =
/lib/libc.so.6[0xa68424]
/lib/libc.so.6(__libc_free+0x77)[0xa6895f]
/usr/local/lib/python2.5/site-packages/_mssql.so[0x7f5d8c]
python2.5[0x8080a72]
python2.5(PyDict_SetItem+0x6c)[0x8080e4c]
python2.5(_PyModule_Clear+0x15d)[0x8083929]
python2.5(PyImport_Cleanup+0x1e5)[0x80d1159]
python2.5(Py_Finalize+0xaf)[0x80dc4c3]
python2.5(Py_Main+0x39d)[0x805646d]
/lib/libc.so.6(__libc_start_main+0xc6)[0xa19de6]
python2.5[0x8055f89]
=== Memory map: 
00131000-00175000 r-xp  03:03 6723934
/usr/lib/libncursesw.so.5.4
00175000-0017d000 rwxp 00044000 03:03 6723934
/usr/lib/libncursesw.so.5.4
0017d000-0017e000 rwxp 0017d000 00:00 0
001fa000-0023f000 r-xp  03:03 166172
/usr/local/lib/libsybdb.so.5.0.0
0023f000-00242000 rwxp 00045000 03:03 166172
/usr/local/lib/libsybdb.so.5.0.0
004b7000-004c r-xp  03:03 4124789
/lib/libnss_files-2.3.5.so
004c-004c1000 r-xp 8000 03:03 4124789
/lib/libnss_files-2.3.5.so
004c1000-004c2000 rwxp 9000 03:03 4124789
/lib/libnss_files-2.3.5.so
0074c000-0075a000 r-xp  03:03 4124807
/lib/libpthread-2.3.5.so
0075a000-0075b000 r-xp d000 03:03 4124807
/lib/libpthread-2.3.5.so
0075b000-0075c000 rwxp e000 03:03 4124807
/lib/libpthread-2.3.5.so
0075c000-0075e000 rwxp 0075c000 00:00 0
0076f000-00778000 r-xp  03:03 4127052
/lib/libgcc_s-4.0.2-20051126.so.1
00778000-00779000 rwxp 9000 03:03 4127052
/lib/libgcc_s-4.0.2-20051126.so.1
007dc000-007dd000 r-xp 007dc000 00:00 0
007f4000-007f8000 r-xp  03:03 2324725
/usr/local/lib/python2.5/site-packages/_mssql.so
007f8000-007f9000 rwxp 4000 03:03 2324725
/usr/local/lib/python2.5/site-packages/_mssql.so
007f9000-007fb000 rwxp 007f9000 00:00 0
008b8000-008ba000 r-xp  03:03 4127074/lib/libutil-2.3.5.so
008ba000-008bb000 r-xp 1000 03:03 4127074/lib/libutil-2.3.5.so
008bb000-008bc000 rwxp 2000 03:03 4127074/lib/libutil-2.3.5.so
009e7000-00a01000 r-xp  03:03 4127066/lib/ld-2.3.5.so
00a01000-00a02000 r-xp 00019000 03:03 4127066/lib/ld-2.3.5.so
00a02000-00a03000 rwxp 0001a000 03:03 4127066/lib/ld-2.3.5.so
00a05000-00b29000 r-xp  03:03 4127067/lib/libc-2.3.5.so
00b29000-00b2b000 r-xp 00124000 03:03 4127067/lib/libc-2.3.5.so
00b2b000-00b2d000 rwxp 00126000 03:03 4127067/lib/libc-2.3.5.so
00b2d000-00b2f000 rwxp 00b2d000 00:00 0
00b31000-00b33000 r-xp  03:03 4127069/lib/libdl-2.3.5.so
00b33000-00b34000 r-xp 1000 03:03 4127069/lib/libdl-2.3.5.so
00b34000-00b35000 rwxp 2000 03:03 4127069/lib/libdl-2.3.5.so
00b37000-00b59000 r-xp  03:03 4127073/lib/libm-2.3.5.so
00b59000-00b5a000 r-xp 00021000 03:03 4127073/lib/libm-2.3.5.so
00b5a000-00b5b000 rwxp 00022000 03:03 4127073/lib/libm-2.3.5.so
00b86000-00b95000 r-xp  03:03 4124849
/lib/libresolv-2.3.5.so
00b95000-00b96000 r-xp e000 03:03 4124849
/lib/libresolv-2.3.5.so
00b96000-00b97000 rwxp f000 03:03 4124849
/lib/libresolv-2.3.5.so
00b97000-00b99000 rwxp 00b97000 00:00 0
00b9b000-00bc2000 r-xp  03:03 4190263
/usr/lib/libreadline.so.5.0
00bc2000-00bc6000 rwxp 00027000 03:03 4190263
/usr/lib/libreadline.so.5.0
00bc6000-00bc7000 rwxp 00bc6000 00:00 0
00c0-00c01000 r-xp  03:03 6715661
/usr/lib/gconv/ISO8859-1.so
00c01000-00c03000 rwxp  03:03 6715661
/usr/lib/gconv/ISO8859-1.so
00c43000-00c46000 r-xp  03:03 1178681
/usr/local/lib/python2.5/lib-dynload/time.so
00c46000-00c48000 rwxp 2000 03:03 1178681
/usr/local/lib/python2.5/lib-dynload/time.so
00c8d000-00c91000 r-xp  03:03 1178665
/usr/local/lib/python2.5/lib-dynload/collections.so
00c91000-00c92000 rwxp 4000 03:03 1178665
/usr/local/lib/python2.5/lib-dynload/collections.so
00d89000-00d97000 r-xp  03:03 1178660
/usr/local/lib/python2.5/lib-dynload/datetime.so
00d97000-00d9a000Aborted

Any suggestions?
Thanks,
Matt

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


Re: find_longest_match in SequenceMatcher

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

Hello John, thank you for investigating and responding!

Yes, I can reproduce the behaviour with different results within the
same version -- which is 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310
32 bit (Intel)]

The catch is to remove the last character, as i described in my
original post, as opposed to passing reduced length parameters to
find_longest_match, which is what you did.

It is morning now, but i still fail to see the mistake i am making --
if it is indeed a bug, where do i report it? 

Cheers!

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


Re: [Newbie] List from a generator function

2006-07-24 Thread Paul Rubin
Sion Arrowsmith [EMAIL PROTECTED] writes:
 Why the use of starmap() rather than
 imap(random.choice, repeat(possible_notes))
 ?

Hmm, not sure what I was thinking.  I remember imap... no that won't
work... ok, starmap.  It was late.  It's late now.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: _mssql on Python 2.5 Beta 2

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

You aren't using the same library you used with 2.4, by any chance? 
Compiled extensions are specific to a particular major version of 
Python, so (for example) 2.3 extension modules won't run under 2.4. 
Though normally, IIRC, that would give you problems on import, so this 
may be no help at all (in which case, sorry!)

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb   http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

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


Re: _mssql on Python 2.5 Beta 2

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

Steve,
I recompiled the library for the 2.5 version.  If it makes a
difference, I used the altinstall option for python, so it's installed
as python2.5.

Thanks,
Matt

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


Re: MySQLdb and dictcursor

2006-07-24 Thread Francesco Panico
On 7/24/06, Christoph Haas [EMAIL PROTECTED] wrote:
On Monday 24 July 2006 14:06, borris wrote: doesn anyone know a good reference, tute or examples of MySQLdb's dictCursor I want to pass dictionaries into the sql exec statements. I could only succeed with text as values
A german linux magazin has an article about passing a *list* of items athttp://www.linux-magazin.de/Artikel/ausgabe/2002/06/python-api/python-api.html
For those who don't understand german here comes an example on how to passlists:cursor.execute(INSERT INTO Adressen (Name, Strasse, PLZ, Ort)VALUES (%s, %s, %s, %s),
 [ ('Dr. Hans Mustermann', 'Musterstraße 13', 50823, 'Köln'), ('Peter Lustig', 'Im Bauwagen 2', 50827, 'Porz'), ('Edmund Stoiber', 'Spendensumpf 1', 47011, 'Bimbesdorf'), ('Onkel Hotte', 'Im Siff 42', 57072, 'Siegen'),
 ('Gerhard Schröder', 'Großmaulweg 2', 11901, 'Worthülsen') ])However the DictCursor is helpful for *returning* dictionaries of valuesinstead of just tuples. I always use DictCursor because it makes it
clearer which rows I want to access in the result. But DictCursor can'tpass dictionaries in a cursor.execute AFAIKT.But with dict.iteritems that shouldn't be hard to send dictionary items tothe SQL database in a loop either.
You can use the same syntax you use for string formatting, even without using DictCursor class:cursor.execute('SELECT * FROM tablename WHERE id = %(id)s', {'id':43})RegardsFrancesco

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

json implementation

2006-07-24 Thread jon cashman

Hi everyone,

Is there a doc comparing different json implementation (example:
python-json, simplejson)? Does anyone have a strong recommendation
to make? Any problem/issue for a particular implementation?

Thanks.

- jon

_
Is your PC infected? Get a FREE online computer virus scan from McAfee® 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


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

Re: _mssql on Python 2.5 Beta 2

2006-07-24 Thread Steve Holden
[EMAIL PROTECTED] wrote:
 Steve Holden wrote:
 
You aren't using the same library you used with 2.4, by any chance?
Compiled extensions are specific to a particular major version of
Python, so (for example) 2.3 extension modules won't run under 2.4.
Though normally, IIRC, that would give you problems on import, so this
may be no help at all (in which case, sorry!)
 
 
 Steve,
 I recompiled the library for the 2.5 version.  If it makes a
 difference, I used the altinstall option for python, so it's installed
 as python2.5.
 
Nope, sounds like you've done everything right. Sorry ...

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb   http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

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


Re: Python newbie needs constructive suggestions

2006-07-24 Thread Chris Lambacher
On Sat, Jul 22, 2006 at 09:31:26PM +0200, Bruno Desthuilliers wrote:
 Lawrence D'Oliveiro a ?crit :
  In message [EMAIL PROTECTED],
  [EMAIL PROTECTED] wrote:
  
  
   b) give up on using an anonymous function and create a named successor
   function with def,
  
  
  This is what you have to do.
 
 Not necessarily.
 
 map(lambda x, one=1: one + x, range(42))
Note that in Python this particular expression is normally written as:
 a = [x + 1 for x in range(42)]

List comprehension and Generator expressions are generally seen as the
solution to not having to deal with map, and reduce.
 
  For some reason mr van Rossum has this aversion
  to anonymous functions, and tries to cripple them as much as possible.
 
 For some reasons, including the fact that Python is statement based and 
 have significative indentation, it's actually not trivial to come with a 
 better syntax for lambdas. The horse has been beaten to hell and back, 
 and no one managed to propose anything worth implementing so far. But if 
 you have the solution to this problem, please share...
 -- 
 http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Connecting to internet under proxy

2006-07-24 Thread Chema
Hi all.

   I have a little script to connect to the internet and download some
files. I developed it in my house (direct connection) and it wordked
properly. But the problem is that in the office (under a proxy) it
doesn't run. My script is like:

import urllib
f=urllib.urlopen(SOME_WEB)
print f.read

I have tried to set the environmet variable
http_proxy=192.168.1.100:2929 and also:

import urllib
proxy={'http','http://192.168.1.100:2929'} and using
f=urllib.urlopen(SOME_WEB, proxy)
print f.read

the error was always the same:

(11001, 'getaddrinfo failed')


Any idea?? The proxy that we use is normally, in some programs I use a
tipical http proxy without authentification without problem.

Thanks in advanced.

Bye

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


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

2006-07-24 Thread David G. Wonnacott
O.K., I'll publicly retract this for the whole list -- EVERYBODY
PLEASE DISREGARD my thought about implementing an n*log(n) shuffle.

I had hinted in my message that this was probably something that I
should review from a data structures course, and of course there was a
simple oversight in my message: you don't have to preserve the order
of the collection from which you extract the element, so you can
extract it in O(1) time by just swapping it, and easily get an O(n)
shuffle algorithm (or, more easily, call random.shuffle()).

Thanks for the polite tone with which many folks have pointed out my
gross oversight.

for i in range(1,100):
print I will not post to the Python list without thinking first

Now suitably embarrassed,
Dave Wonnacott


   Date: 24 Jul 2006 06:24:48 -0700
   From: Ben Sizer [EMAIL PROTECTED]
   Subject: Re: random shuffles
   To: python-list@python.org

   Ross Ridge wrote:
David G. Wonnacott wrote:
 Couldn't we easily get an n*log(n) shuffle...
   
Why are you trying to get an O(n*log(n)) shuffle when an O(n) shuffle
algorithim is well known and implemented in Python as random.shuffle()?

   I think David is referring to this: don't you still need to use
   O(log(n)) time to find and remove the item from the collection?

   The answer for him is no: as far as I know, the Python list is a
   random-access structure, so looking up 2 items and swapping them runs
   in constant time. You perform that N times to shuffle the sequence, so
   it runs in O(N).

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


P.S. Re: Python newbie needs constructive suggestions

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

   map(lambda x: x+1, [5, 17, 49.5])

one would write

   map(lambda x, one=1: x+one, [5, 17, 49.5])

I've been using this happily in several cases, but just discovered
that (of course), the variable x is not in scope until the
expression in the lambda, so if one wanted to, say, have a variable
that was 3*x, one could NOT write

   map(lambda x, threex=3*x: x+threex, [5, 17, 49.5])

[obviously there are easier ways to find 4*x, but I'm trying to keep
close to my simplified example].

I'll need to show the code to beginners, so I don't want to get into
the complexity of using the more advanced solutions that were
suggested (closures or callable classes), so I'm going to bail out in
such cases and just not use an anonymous function here.

I'm not sure there's really a question here, other than the implicit
please let me know if there's yet another cool thing I can do here,
but I thought I'd add this postscript to my earlier postings for the
benefit of anyone following this thread. [I often see interesting
threads in the archive but am left with an unresolved question I
wonder how that worked out].

Dave Wonnacott

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


mingw extension modules hang

2006-07-24 Thread Peter Bienstman
Hi,

I'm having some problems with scripts using Python extension modules compiled 
using mingw.

* Some of them work fine if I run them from a command prompt. However, if I 
double click on them, or run them from within IDLE, they seem to hang.
* Other scripts always seem to hang, even if I start them from the command 
prompt.

If I try running the extension module through gdb and I manage to interrupt 
it, it seems to be hanging in 
_C__loewis_release_python_PCBuild_libpython24_a_iname()

Could this have anything to do with the mixing of MSVCRT and MSVCR71, or do 
issues related to that have a different signature?

It's a fairly complex extension module, requiring Boost.Python and Blitz, 
using scons for the building of the dll, rather than distutils.

Needless to say, they run fine under Linux.

Peter


pgpyYPcF7xuH7.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: PySNMP Thread unsafe?

2006-07-24 Thread Chris Lambacher
On Mon, Jul 24, 2006 at 02:21:10AM -0700, [EMAIL PROTECTED] wrote:
 I'm trying to monitor about 250 devices with SNMP, using PySNMP version
 4. I use the threading.Thread to create a threadpool of 10 threads, so
 devices not responding won't slow down the monitoring process too much.
 
 
 Here comes my problem. When using PySNMP single threaded, every this
 goes well; but if I create 10 threads, it all goes awry... It seems
 PySNMP is not thread safe? Can anyone elaborate on this?
What does 'goes awry' mean?  Your statement is too vague to be able to help
you figure out your problem.
 
 -- 
 http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2006-07-24 Thread Duncan Booth
David G. Wonnacott wrote:

 In response to my question, ``What is the idiomatically appropriate
 Python way to pass, as a function-type parameter, code that is most
 clearly written with a local variable?'', a number of you made very
 helpful suggestions, including the use of a default argument; if one
 wanted to give a name to the constant one in my original example,
 
map(lambda x: x+1, [5, 17, 49.5])
 
 one would write
 
map(lambda x, one=1: x+one, [5, 17, 49.5])
 
 I've been using this happily in several cases, but just discovered
 that (of course), the variable x is not in scope until the
 expression in the lambda, so if one wanted to, say, have a variable
 that was 3*x, one could NOT write
 
map(lambda x, threex=3*x: x+threex, [5, 17, 49.5])
 
 [obviously there are easier ways to find 4*x, but I'm trying to keep
 close to my simplified example].
 
 I'll need to show the code to beginners, so I don't want to get into
 the complexity of using the more advanced solutions that were
 suggested (closures or callable classes), so I'm going to bail out in
 such cases and just not use an anonymous function here.
 

Not using an anonymous function certainly sounds to me like the most 
idiomatically appropriate Python way to do this.

def fourx(x):
   threex = 3 * x
   return x + threex

map(fourx, [5, 17, 49.5])

The advantages over the lambda include the ability to use local variables 
and split the function naturally over multiple lines. Also you get to use a 
meaningful name to describe the function.
-- 
http://mail.python.org/mailman/listinfo/python-list


list of indices

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

Re: list of indices

2006-07-24 Thread Chris Lambacher
On Mon, Jul 24, 2006 at 08:14:35AM -0700, Julien Ricard wrote:
hi,
 
is there any method to get only some elements of a list from a list of
indices. Something like:
 
indices=[0,3,6]
new_list=list[indices]
new_list = [list[x] for x in indicies]
 
which would create a new list containing 0th, 3rd and 6th elements from
the original list? I do this with a loop but I'd like to know if there is
a simpler way.
 
thanks in advance
 
Jul

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


Re: Regular expression issue

2006-07-24 Thread Sibylle Koczian
[EMAIL PROTECTED] schrieb:
 I'm trying to parse a line of html as follows:
 
 td style=width:20% align=left101.120:( KPA (-)/td
 td style=width:35% align=leftSnow on Ground)0 /td
 
 however, sometimes it looks like this:
 
 td style=width:20% align=leftN/A/td
 td style=width:35% align=leftSnow on Ground)0 /td
 
 
 I want to get either the numerical value 101.120 (which could be a
 different number depending on the data that's been fed into the page,
 or in terms of the second option, 'N/A'.
 
 The regexp I'm using is:
 
 .*?Pressure.*?left(?Pbaro\d+?|N/A)/td|\sKPA.*?Snow\son\sGround
 

Wouldn't it be simpler to use HTMLParser or something similar first to 
separate text and HTML tags and get the content of each cell separately? 
Then you have only to find the 'right' cell, possibly quite simply by 
its position in the HTML table, and check if it contains 'N/A' or 
something numeric (that check wouldn't need a regular expression if its 
really so simple).

No Python here so I can't try it out to be more specific, but look for 
HTMLParser in the library reference.

-- 
Dr. Sibylle Koczian
Universitaetsbibliothek, Abt. Naturwiss.
D-86135 Augsburg
e-mail : [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: list of indices

2006-07-24 Thread Tim Chase
indices=[0,3,6]
new_list=list[indices]
 new_list = [list[x] for x in indicies]

and just as a caveat, it's generally considered bad form to 
shadow the built-in list as such...

-tkc




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


Re: using names before they're defined

2006-07-24 Thread davehowey
  First case is a little shorter but then you have to use a parser for it

 There's one builtin.

do you mean 'configparser'? I'm just trying to figure out how this
works. Does it generate objects from the config file automatically?

Dave

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


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

2006-07-24 Thread Paul McGuire
John Machin [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Markus wrote:
  You know you're guilty of early/over optimisation, when it's almost two
  in the morning and the file open in front of you reads as follows.
 
snip
 
  from timeit import Timer
 
  if __name__=='__main__':
   t = Timer('len(argv)==1','from sys import argv')
   print %f usec/pass % (100 * t.timeit(number=10)/10)
   t = Timer('argv[0]==argv[-1]','from sys import argv')
   print %f usec/pass % (100 * t.timeit(number=10)/10)
 
  [-snip-]

You're worried about the performance of len(sys.argv)?! Is your command line
processing *really* your program bottleneck?  If so, I'd say making a better
len is the least of your problems.

Hard to imagine you'll do better than len, especially for lists as short as
command line args.  If you are *really* doing lots of len'ning, copy len to
a local to cut down on lookup costs:

C:\Documents and Settings\Paulpython -mtimeit -sa=['abc','abc'] len(a)
100 loops, best of 3: 0.218 usec per loop

C:\Documents and Settings\Paulpython -mtimeit -sa=['abc','abc'];len_=len
len_(a)
1000 loops, best of 3: 0.172 usec per loop

But honestly, do some profiling before adding these maintenance-hindering
and readability-impairing optimizations.

-- Paul


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


Parsing Baseball Stats

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

Also, I would like to do this for numerous players whose IDs I have
stored in a text file (e.g.: cobbty01, ruthba01, speaktr01, etc.).
These IDs should change the URL to get the corresponding player's
stats. Is this doable and if yes, how? I have only recently finished
learning Python (used the book: How to Think Like a Computer Scientist:
Learning with Python). Thanks for your help...

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


Re: Connecting to internet under proxy

2006-07-24 Thread Steve Holden
Chema wrote:
 Hi all.
 
I have a little script to connect to the internet and download some
 files. I developed it in my house (direct connection) and it wordked
 properly. But the problem is that in the office (under a proxy) it
 doesn't run. My script is like:
 
 import urllib
 f=urllib.urlopen(SOME_WEB)
 print f.read
 
 I have tried to set the environmet variable
 http_proxy=192.168.1.100:2929 and also:
 
 import urllib
 proxy={'http','http://192.168.1.100:2929'} and using
 f=urllib.urlopen(SOME_WEB, proxy)
 print f.read
 
 the error was always the same:
 
 (11001, 'getaddrinfo failed')
 
 
 Any idea?? The proxy that we use is normally, in some programs I use a
 tipical http proxy without authentification without problem.
 
 Thanks in advanced.
 
[EMAIL PROTECTED] /c/colinux
$ export http_proxy=http://localhost:37004;

[EMAIL PROTECTED] /c/colinux
$ python
Python 2.5b2 (trunk:50713, Jul 19 2006, 16:04:09)
[GCC 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)] on cygwin
Type help, copyright, credits or license for more information.
Started with C:/Steve/.pythonrc
   import urllib
   u = urllib.urlopen(http://www.holdenweb.com/;)
  

OK, it works with an environment variable (I saw the access in my 
mousehole proxy log). Now in a new shell:

[EMAIL PROTECTED] ~
$ export | grep http

[EMAIL PROTECTED] ~
$ python
Python 2.5b2 (trunk:50713, Jul 19 2006, 16:04:09)
[GCC 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)] on cygwin
Type help, copyright, credits or license for more information.
Started with C:/Steve/.pythonrc
   import urllib
   proxy = {'http': 'http://localhost:37004'}
   u = urllib.urlopen(http://www.holdenweb.com/;, proxies=proxy)
  

Yup. that worked too. Maybe it's just because you aren't making proxies 
a keyword argument? If I try that (under cygwin) I see:

   u = urllib.urlopen(http://www.holdenweb.com/;, proxy)
Traceback (most recent call last):
   File stdin, line 1, in module
   File /usr/local/lib/python2.5/urllib.py, line 84, in urlopen
 return opener.open(url, data)
   File /usr/local/lib/python2.5/urllib.py, line 192, in open
 return getattr(self, name)(url, data)
   File /usr/local/lib/python2.5/urllib.py, line 327, in open_http
 h.send(data)
   File /usr/local/lib/python2.5/httplib.py, line 707, in send
 self.sock.sendall(str)
   File string, line 1, in sendall
TypeError: sendall() argument 1 must be string or read-only buffer, not dict

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb   http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

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


python xmlrpc: cannot handle connection errors

2006-07-24 Thread xristoph
Hello everyone!

I am trying to set up a broker-worker system (one broker, multiple and
heterogeneous workers) in python for a local network (though possibly
also over inet). I am using SimpleXMLRPCServer and
xmlrpclib.ServerProxy for connections.

Whatever I do, after about 100,000 to 150,000 XMLRPCalls over a single
ServerProxy connection, I am getting a connection error (usually
connection reset by peer). I have tried deleting the ServerProxy,
setting up a new one and calling the function again when the error
occurs, but this does not change anything:

# this is the worker's secureRPC; the broker's works analogously
def worker_secureRPC(self, fname, args=None):
tries = 2 # raising the nr of tries does not change
anything
retval = None
for i in range(0,tries):
try:
fref = self.getfref(fname)
# returns a reference to
self.sender.fname
if (args==None):
retval = fref()
else:
retval = fref(*args)
except:
self.sender = None
time.sleep(1)
self.sender = ServerProxy(http://; + 
self.brokerHost + : +
str(self.brokerPort))
if (i=(tries-1)):
raise


Then, thinking that maybe the return statement produces the error, I
tried doing error handling there as well (keep in mind that the
function might have been called already, so don't do the same action
twice):

def worker_foo(self, popcontainer, failed=[]):
self.lock.acquire()
if (len(failed)  0):
while (len(failed)  0):
failed.pop()
else:
do_stuff_in_new_thread()
self.lock.release()
try:
return True
except:
failed.append(failed)

The function foo gets called remotely after the set-up of the new
ServerProxy, but does produce the same error again! (socket.error:
connection reset by peer). Btw, another function sends the result back
to the Broker again via xmlrpc, resulting in asynchronous
communication, so we only need to return some bogus value here.

Am I missing sth obvious here, or why can I not re-build the
connection? What can I do to handle this error correctly?

cheers,

Christoph

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


Re: Parsing Baseball Stats

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

 Also, I would like to do this for numerous players whose IDs I have
 stored in a text file (e.g.: cobbty01, ruthba01, speaktr01, etc.).
 These IDs should change the URL to get the corresponding player's
 stats. Is this doable and if yes, how? I have only recently finished
 learning Python (used the book: How to Think Like a Computer Scientist:
 Learning with Python). Thanks for your help...

Pyparsing and BeautifulSoup are both useful options to look into.

Also, take care not to run afoul of the terms of service for this site
(included below).  A strict interpretation of them probably prohibits what
you intend to do.

-- Paul


Restrictions

You agree to not use the Service:

* to upload, post, email, transmit or otherwise make available (A) any
content that you do not have a right to make available and any commercial
publication or exploitation of the Service or any content provided in
connection therewith is specifically prohibited and anyone wishing to do so
must first request and receive prior written permission from PEV to do so;
(B) any content that infringes any patent, trademark, trade secret,
copyright or other proprietary rights (Rights) of any party; (C) any
unsolicited or unauthorized advertising, promotional materials, junk mail,
spam, chain letters, pyramid schemes, or any other form of
solicitation except for vendors so authorized to do so; or (D) any content
that is unlawful, harmful, threatening, abusive, harassing, tortious,
defamatory, vulgar, obscene, libelous, invasive of another's privacy,
hateful, or racially, ethnically or otherwise objectionable;

* to forge headers or otherwise manipulate identifiers in order to disguise
the origin of any content transmitted through or made available through the
Service;

* to collect or store personal data about other users; or deleting or
revising any content (including, but not limited to, legal notices) posted
by PEV or attempting to decipher, decompile, disassemble or reverse engineer
any of the software or content provided through, comprising or making up the
Service;

* to use or attempt to use any engine, software, tool, agent or other device
or mechanism (including without limitation browsers, spiders, robots,
avatars or intelligent agents) to navigate or search this Site other than
the search engine and search agents available from Experience on this Site
and other than generally available third-party web browsers (e.g., Netscape
Navigator, Microsoft Explorer) or;

* to intentionally or unintentionally violate any applicable local, state,
national or international law.


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


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

2006-07-24 Thread Paddy

Ray wrote:
 I just moved to another company that's mainly a Java/.NET shop. I was
 happy to find out that there's a movement from the grassroot to try to
 convince the boss to use a dynamic language for our development!

 Two of the senior developers, however, are already rooting for Ruby on
 Rails--although they haven't tried RoR themselves. When I suggested
 Django, they went like, what's that?.

 I said, It's like the Python counterpart of RoR.

 Nah, we're not interested in Python.

 I think they are already predisposed to RoR simply because of RoR's
 visibility (i.e.: at my workplace everybody knows RoR but nobody knows
 about Django unless they've used Python as well). So far the arguments
 I can think of:

 1. The investment of learning Python will be a good investment because
 it transfer to platforms that we've already supported, i.e.: JVM and
 .NET CLR (using Jython and IronPython). Ruby's availability on this
 platform is not as mature--JRuby is still at 0.9 and I don't think
 IronRuby is coming out anytime soon :)

 2. Python is a much more mature language than Ruby--it's been around
 since ages ago and as such has a lot more tools, articles, and other
 resources than Ruby. It is also the language being used by
 high-visibility company like Google, with the creator of the language
 himself working there.

 3. Python emphasizes readability instead of cleverness/conciseness.

 4. What else? I haven't tried RoR so I can't argue meaningfully on
 whether using Django will put us at an advantage.

 Can you help me with my argument? Meanwhile I think I'll give RoR a try
 as well.
 
 Thank you,
 Ray

Ruby does not have doctest :-)

- Paddy.

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


Re: function v. method

2006-07-24 Thread fuzzylollipop

Gerhard Fiedler wrote:
 On 2006-07-22 16:32:38, danielx wrote:

  ...and source code...
 
  *shudders* What happened to all the goodness of abstraction?
 
  Abstraction as you seem to use it requires complete docs of the interface.
  Which is what you said you don't have... So the original abstractor broke
  the abstraction when publishing insufficient docs, not the one who looks
  into the sources to find out what actually happens.
 
  Absolutely. I didn't mean the user was breaking abstraction (let's not
  blame the victim). I was saying that we should really have more
  sympathy for him.

 I have all the sympathy in the world for him... after all, he's me :)

 But one reason why I try to write (and insist on as much as possible from
 people writing for or with me) self-documenting code is that wherever you
 have documentation and code separated (which is the case of API docs), you
 can bet (without losing) that sooner or later code and doc will diverge.
 This has a probability that approaches 1 :)

 So, I agree with you that good API docs are a good thing, as they tell me
 everything I need to know without having to wade through tons of
 implementation details that may be interesting but don't serve my immediate
 need (of having to use the API). But reality seems to be (and mine so far
 definitely is) that these docs, even the good ones, are not completely in
 alignment with the reality of the code. (We all know that code has bugs...
 and the API always describes, at best, how the code /should/ work. It never
 describes how it actually works, including the bugs g (this
 notwithstanding the bugs that have been elevated to features and henceforth
 been described in the API docs).

 So... the final authority /is/ the code. I don't see an alternative. For
 me, good abstraction doesn't mean I don't have to read the sources; good
 abstraction means (among other things) that I can read the sources easily.

 Gerhard

having auto generated docs, which means the documentatin is in the code
as doc strings, javadoc, reflex, or whatever format is the BEST way of
doing API documentation, period.

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


Re: function v. method

2006-07-24 Thread fuzzylollipop

Antoon Pardon wrote:
 On 2006-07-21, fuzzylollipop [EMAIL PROTECTED] wrote:
 
  Antoon Pardon wrote:
 
  Suppose I am writing my own module, I use an underscore, to
  mark variables which are an implementation detail for my
  module.
 
  Now I need to import an other module in my module and need access
  to an implementation variable from that module. So now I have
  variables with an underscore which have two different meanings:
 
  you don't understand what implementation detail means, it means it is
  NOT part of the public API and no client code should ever use it.
 
  If you reference _vara in your code and it is in someone elses module
  you don't understand YOU ARE NOT SUPPOSED TO DO THAT!

 Why do you assume that in my example the other module is
 not understood?

1) This is an implemantation detail of this module, It is the
   users of my module who have to be extra carefull using it.
 
  Users of your module should NEVER KNOW any of the _ or __ stuff exists
  to begin with.
 
2) This is an implemantation detail of the other module,
   I should be extra carefull using it.
 
  You should NEVER use it.

 Well that may be your view, but AFAICS it is not the view of
 the python community. Because each time some mechanism is
 proposed for real private variable, people oppose it, they
 want people to have access to what are supposed to be
 private variables.

 --
 Antoon Pardon

actually you are really way off base, the _ and __ convention IS the
INTENDED way of doing private and really private documentation of
members in Python.

I didn't make this up, it is in the official Python documentation.

You need to read my previous response for COMPREHENSION one more time.
There is LESS THAN ZERO value in having a runtime enforcement of member
access control.

Python does have ALREADY have an OFFICAL mechanism for private members,
prefix your names with _ or __. Both are ommited from autogenerated
docuementation and both are OFFICALLY not supposed to be used.

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


prob with struct and byte order

2006-07-24 Thread nephish
hello there, all.

i have a difficult app that connects to a server to get information for
our database here.
this server is our access point to some equipment in the field that we
monitor.

the messages come in over a socket connection. And according to their
(very limited) documentation, are set up in a particular order. like
this

STX [length indicator] [message type] [message body] ENX

length indicator = length of the message body in 4 bytes
message type = the code for what type of message is being sent
   for example 200 = login
message body = the actual command to send to the server

STX and ENX are the values assigned to start and stop a message.
they are literally 'STX' and 'ENX'


when i capture a message i can print it to the screen and the 'STX' at
the beginning and the 'ENX' at the end are discernable, but the rest of
the message looks like this..

\x00\x00\x00,\x00\x00\x00\e17758\x00\x00   and so on and so forth...
with some commas and other symbols in there. (the e before the 17758
has a little hat on it)
 If i print it out to a text file, i get this...
STXNULNULNULea17758NULLNULL etc..

now the 17758 is significant because it is the actual unit number of
the machine we want to monitor. I just dont know how to extract the
real values out of this message.

anyone have an idea where to start? i have experimented with struct,
but do not know enough about it. Does anyone know a good tutorial about
learning byte codes and such. The docs on pythons website explain the
module well, but i still do not know what to do with it. Or how to
generate a message or pull apart these values to get a message out of
what the server sends us. 

thanks
sk

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


Re: Which Pyton Book For Newbies?

2006-07-24 Thread John Salerno
danielx wrote:

 I'm sure you will hear this many times, but that's a great choice ;). I
 really think you'll like Learning Python from O'Reilly Press. The
 authors claim you can read the book even with no prior programming
 experience, which seems plausible having read it. Of course, you
 already have some programming experience, so it should go much more
 smoothly with you. Good luck finding the right book!

I second this, as usual. Learning Python (2nd ed.) is excellent and all 
you need to get started.

But for GUI programming, you'll need more. Tkinter comes with Python and 
is usually considered easy to start using. After a few days with it, I 
decided to simply go all out and learn wxPython instead (wxPython in 
Action is a great book). wxPython is a lot easier than I thought it 
would be, and a much more complete toolkit.

But I think the usual caveat for GUI programming is, is it necessary? 
Would it work just as well to make a website interface to do your work, 
rather than spend the time learning a GUI toolkit and creating a GUI app?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Exercises for dive into python

2006-07-24 Thread Tal Einat
Ben Edwards (lists lists at videonetwork.org writes:

 
 Have been working through Dive Into Python which is excellent.  My only
 problem is that there are not exercises.  I find exercises are a great
 way of helping stuff sink in and verifying my learning.  Has anyone done
 such a thing?
 
 Ben
 


I recently gave a Python crash-course in my company, and ran into the same
problem. There are many good Python tutorials, manuals, references etc., most
are accompannied by various code examples, but there are very few exercises. I
had a hard time collecting and inventing a few good exercises, about 12 in all.

There are probably some good exercises out there, but they seem to be relatviely
hard to find. Maybe they should be collected and organized at Python.org?

I think building a large collection of good Python exercises could help both
those teaching Python and those learning it. Also, gathering a set of Python
exercises for those learning general programming concepts (variables, functions,
object-oriented, etc.) could help spread the use of Python for teaching
programming.

- Tal

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


Functions, Operators, and Overloading?

2006-07-24 Thread Michael Yanowitz
Hello:

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

   However, operators can be overloaded. 
   So can I define a new operator?  If so, can I
define func1 as an operator?

(on the side, I have always wanted to define the
++ operator as +=1. Is that possible?)

Thanks in advance:
Michael Yanowitz

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


Re: Type signature

2006-07-24 Thread paul kölle
Marc 'BlackJack' Rintsch wrote:
 In [EMAIL PROTECTED], Yacao Wang
 wrote:
 
 However, type signatures are not only a kind of information provided for
 the compiler, but also for the programmer, or more important, for the
 programmer. Without it, we have to infer the return type or required
 agument types of a function, and this can't be done without seeing the
 implementation of it,
 
 That's what documentation is meant for.  If you are forced to look at the
 implementation, the documentation is bad.
I think the OP refers to reading the *code*, the documentation might not
exist (yet). Sometimes I feel python is easier to write than to read and
 missing argument type declarations (just for documentation purposes)
are  IMHO one reason. Another are missing (optional) argument type
checks at runtime. Something like WrongArgumentType exceptions instead
of rather unspecific AttributeError from deep inside the code would be
very convenient.

Yes docstrings are nice but sometimes a simple:

foo(int:param1, string:param2) is way better than:

foo(param1, param2):
  
  @type param1: integer
  @type parame2: string
  

cheers
 Paul

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


pyserial to read from DS1615 temperature recorder chip

2006-07-24 Thread alexandre_irrthum
Hi there,

I am trying to use pyserial to read data from a temperature logger
device (T-logger). T-logger is based on the DS1615 temperature recorder
chip (Dallas Semiconductor). According to the DS1615 docs, writing to
the chip is performed one byte  at a time. To read from the chip, one
must issue the read page command (33h), followed by the two-byte
address of the requested page (pages are 32 bytes long). After
receiving this, the DS1615 will send the data in a burst of (up to) 32
bytes. I can send data to the device, e.g. I can make the device's LED
blink with the test command (44h), but I am unable to read from it.
Connection parameters below are according to DS1615 docs.

 import serial
 s = serial.Serial(0, baudrate=9600, bytesize=8, parity='N', stopbits=1, 
 timeout=None)
 s.write(\x33)
 s.write(\x00)
 s.write(\x00)
 s.read()   # \x00 is returned here. This byte was already in the receive 
 buffer before issueing the write commands.
 s.read()   # The interpreter is blocked here as there is nothing to read 
 from the serial port.

I'm completely clueless and would really appreciate your comments. If
it helps, I can post a log from a serial port monitor captured when the
provided T-logger program pulls data from the device, as well as a log
when pyserial is used. And finally, this is a snippet of some basic
code found on the web, that is suppose to do what I want (untested by
me):

open COM1:9600,N,8,1,CS0,DS0,CD0,ME,FE as 1
print #1, chr$(H33);chr$(H00);chr$(H00)
result$ = input$(34, #1)

Many thanks,

alex

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


Re: prob with struct and byte order

2006-07-24 Thread Steve Holden
[EMAIL PROTECTED] wrote:
 hello there, all.
 
 i have a difficult app that connects to a server to get information for
 our database here.
 this server is our access point to some equipment in the field that we
 monitor.
 
 the messages come in over a socket connection. And according to their
 (very limited) documentation, are set up in a particular order. like
 this
 
 STX [length indicator] [message type] [message body] ENX
 
 length indicator = length of the message body in 4 bytes
 message type = the code for what type of message is being sent
for example 200 = login
 message body = the actual command to send to the server
 
 STX and ENX are the values assigned to start and stop a message.
 they are literally 'STX' and 'ENX'
 
I believe you, but this is clearly a perversion of the single-character 
start of transmission and end of transmission that are part of the 
ASCII alphabet. So the protocol designer may have been inexperienced, 
and the documentation may be confused ...
 
 when i capture a message i can print it to the screen and the 'STX' at
 the beginning and the 'ENX' at the end are discernable, but the rest of
 the message looks like this..
 
 \x00\x00\x00,\x00\x00\x00\e17758\x00\x00   and so on and so forth...
 with some commas and other symbols in there. (the e before the 17758
 has a little hat on it)
  If i print it out to a text file, i get this...
 STXNULNULNULea17758NULLNULL etc..
 
The \x00 is the Python repr() of a single-byte string containing a 
null byte (i.e. a byte whose decimal value is zero).

 now the 17758 is significant because it is the actual unit number of
 the machine we want to monitor. I just dont know how to extract the
 real values out of this message.
 
 anyone have an idea where to start? i have experimented with struct,
 but do not know enough about it. Does anyone know a good tutorial about
 learning byte codes and such. The docs on pythons website explain the
 module well, but i still do not know what to do with it. Or how to
 generate a message or pull apart these values to get a message out of
 what the server sends us. 
 
Well if the string you are seeing (when you print it from Python) looks like

STX\x00\x00\x00,\x00\x00\x00\e17758\x00\x00 ... ETX

then it looks like the bytes you want can be obtained, supposing the 
string is stored in variable s, as s[12:17].

   s = STX\x00\x00\x00,\x00\x00\x00\e17758\x00\x00 ... ETX
   s[12:17]
'17758'
  

You may need to juggle about with the indexes a little, but one of the 
joys of Python is that the interactive interpreter is so cooperative!

Good luck.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd  http://www.holdenweb.com
Skype: holdenweb   http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

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


Re: Which Pyton Book For Newbies?

2006-07-24 Thread Gerhard Fiedler
On 2006-07-24 13:39:20, John Salerno wrote:

 But I think the usual caveat for GUI programming is, is it necessary?
 Would it work just as well to make a website interface to do your work,
 rather than spend the time learning a GUI toolkit and creating a GUI
 app?

While I don't doubt that there are many applications that are well-suited
for web apps and that there are a number of good reasons for making some
apps web-based, why do you think web programming is /not/ GUI programming? 

If you just need a few text boxes and buttons in a table-like layout, both
are easy. If you need fancier functionality, both get a bit more
complicated. There isn't much of a difference in terms of designing the
GUI, IMO. 

(Actually, complex GUI functionality is probably easier to design to run
well in a local application. You don't have to split up the GUI
functionality between server-side and client-side and you don't have to
deal with the subtle but sometimes significant differences between
browsers.)

Gerhard

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


Re: Detecting socket connection failure

2006-07-24 Thread Dieter Maurer
[EMAIL PROTECTED] writes on 19 Jul 2006 08:34:00 -0700:
 ...
 Were you also using mac osx?

No, I have observed the problem under Linux.


 Dieter Maurer wrote:
 
  I have seen something similar recently:
 
I can write (send to be precise) to a socket closed by
the foreign partner without error
(but of course, the written data does not arrive at the remote side).
Only the second send raises an exception.
  
I expect this is a TCP bug.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Type signature

2006-07-24 Thread Hugo Ferreira
Which is expecially true when using IDEs with auto-completion.Using
VisualStudio/MonoDevelop and C# I rarely need to look at the
documentation because I can quickly see what a method accept and
returns. And when I need to pass flags or options, enums are much more
neat and encapsulated.
With Python I'm constantly looking at the documentation when
surfing a library. I personally like the terse code and abstraction
features of Python which is making me slowly writing more and more
tools in it. Still, I have to agree that there are edges (like these)
that must be sharpened out...On 7/24/06, paul kölle [EMAIL PROTECTED] wrote:
Marc 'BlackJack' Rintsch wrote: In [EMAIL PROTECTED], Yacao Wang wrote: However, type signatures are not only a kind of information provided for
 the compiler, but also for the programmer, or more important, for the programmer. Without it, we have to infer the return type or required agument types of a function, and this can't be done without seeing the
 implementation of it, That's what documentation is meant for.If you are forced to look at the implementation, the documentation is bad.I think the OP refers to reading the *code*, the documentation might not
exist (yet). Sometimes I feel python is easier to write than to read and missing argument type declarations (just for documentation purposes)areIMHO one reason. Another are missing (optional) argument type
checks at runtime. Something like WrongArgumentType exceptions insteadof rather unspecific AttributeError from deep inside the code would bevery convenient.Yes docstrings are nice but sometimes a simple:
foo(int:param1, string:param2) is way better than:foo(param1, param2):@type param1: integer@type parame2: stringcheers Paul--
http://mail.python.org/mailman/listinfo/python-list-- GPG Fingerprint: B0D7 1249 447D F5BB 22C55B9B 078C 2615 504B 7B85
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: How to force a thread to stop

2006-07-24 Thread Carl J. Van Arsdall
Dennis Lee Bieber wrote:
 On Sat, 22 Jul 2006 14:47:30 +0200, Hans [EMAIL PROTECTED] declaimed
 the following in comp.lang.python:

   
 Hi all,

 Is there a way that the program that created and started a thread also stops 
 it.
 (My usage is a time-out).

 
   Hasn't this subject become a FAQ entry yet? G

   The only reliable way of stopping a thread is from inside the thread
 itself. That is, the thread must, at some point, examine some flag
 variable which, when set, says stop

 Without using actual code:

 class StoppableThread(...):
   def __init__(self, ...):
   #whatever is needed to initialize as a thread
   self.Stop = False

   def run(self, ...):
   while not self.Stop:
   #do one cycle of the computation


   

My problem with the fact that python doesn't have some type of thread 
killer is that again, the only solution involves some type of polling 
loop.  I.e. if your thread of execution can be written so that it 
periodically checks for a kill condition.  This really sucks, not just 
because polling is a ridiculous practice, but it forces programmers in 
many situations to go through a lengthy process of organizing operations 
into a list.  For, say I have threads that share a bunch of common 
memory (yea, i'm saying this exclusively to get the procses users off my 
back) that executes a series of commands on remote nodes using rsh or 
something.  So if i've constructed my system using threads I need to 
neatly go and dump all operations into some sort of list so that I can 
implement a polling mechanism, i.e.

opList = [op1, op2, op3, op4]
for op in opList:
  checkMessageQueue()
  op()

That works if you can easily create an opList.  If you want good 
response time this can become quite ugly, especially if you have a lot 
going on.  Say I have a function I want to run in a thread:

#Just pretend for the sake of arguement that 'op' actually means 
something and is a lengthy operation
def func_to_thread():
  os.system('op 1')
  os.system('op 2')
  os.system('op 3')


#In order to make this killable with reasonable response time we have to 
organize each of our ops into a function or something equally annoying

op_1():
  os.system('op 1')

op_2():
  os.system('op 2')

op_3():
  os.system('op 3')

opList(op_1, op_2, op_3)
def to_thread():
  for op in opList:
checkMessageQueue()
op()


So with this whole hey mr. nice thread, please die for me concept gets 
ugly quickly in complex situations and doesn't scale well at all.  
Furthermore, say you have a complex systems where users can write 
pluggable modules.  IF a module gets stuck inside of some screwed up 
loop and is unable to poll for messages there's no way to kill the 
module without killing the whole system.  Any of you guys thought of a 
way around this scenario?


-- 

Carl J. Van Arsdall
[EMAIL PROTECTED]
Build and Release
MontaVista Software

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


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

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

This is too true.  Fortunately progress proceeds
slowly nonetheless.  For example C++ is much
less used these days where it is totally and
catastrophically inappropriate than in years past
-- maybe because the true C++ boneheads have
been promoted or are retiring...  Nevertheless I was
recently told by a new grad that I should translate
one of my (working, no problems) python apps to
C++ because C++ is a higher level language.
But I'm sure he'll fall in line with the next stream
of lemmings rather than sink into the tarpit with the
dinosaurs.

   -- Aaron Watters

===
Paradigms shift when the old guys retire.  -- Kuhn (?)

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


Re: Functions, Operators, and Overloading?

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

Correct.

However, operators can be overloaded.
So can I define a new operator?  If so, can I
 define func1 as an operator?

No. Operators in Python are merely syntax for magic methods on the
corresponding type. For instance, x + y would call x.__add__(y). In this
sense you are not really overloading the operator, you are simply
defining or overwriting its behavior (just like above, where the second
func1 overwrites the previous).

 (on the side, I have always wanted to define the
 ++ operator as +=1. Is that possible?)

No, for the reason above -- there is no magic method associated with ++,
which isn't a real Python operator.

--
Brian Beck
Adventurer of the First Order
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Exercises for dive into python

2006-07-24 Thread Ben Edwards (lists)
On Mon, 2006-07-24 at 16:39 +, Tal Einat wrote:
 Ben Edwards (lists lists at videonetwork.org writes:
 
  
  Have been working through Dive Into Python which is excellent.  My only
  problem is that there are not exercises.  I find exercises are a great
  way of helping stuff sink in and verifying my learning.  Has anyone done
  such a thing?
  
  Ben
  
 
 
 I recently gave a Python crash-course in my company, and ran into the same
 problem. There are many good Python tutorials, manuals, references etc., most
 are accompannied by various code examples, but there are very few exercises. I
 had a hard time collecting and inventing a few good exercises, about 12 in 
 all.
 
 There are probably some good exercises out there, but they seem to be 
 relatviely
 hard to find. Maybe they should be collected and organized at Python.org?

That sounds like an exelent idea.  Maybe the way to structure it is my
book/chapter. 

 
 I think building a large collection of good Python exercises could help both
 those teaching Python and those learning it. Also, gathering a set of Python
 exercises for those learning general programming concepts (variables, 
 functions,
 object-oriented, etc.) could help spread the use of Python for teaching
 programming.

I think there is little doubt about this.  The reason I liked the
'Thinking in Java' book was it had 10 exercises at the end of each
chapter.  I would not more onto a chapter until I had completed them
all.

Ben

 
 - Tal
 


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


Re: prob with struct and byte order

2006-07-24 Thread Grant Edwards
On 2006-07-24, Steve Holden [EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED] wrote:
 hello there, all.
 
 i have a difficult app that connects to a server to get information for
 our database here.
 this server is our access point to some equipment in the field that we
 monitor.
 
 the messages come in over a socket connection. And according to their
 (very limited) documentation, are set up in a particular order. like
 this
 
 STX [length indicator] [message type] [message body] ENX
 
 length indicator = length of the message body in 4 bytes
 message type = the code for what type of message is being sent
for example 200 = login
 message body = the actual command to send to the server
 
 STX and ENX are the values assigned to start and stop a message.
 they are literally 'STX' and 'ENX'

 I believe you, but this is clearly a perversion of the
 single-character start of transmission and end of
 transmission that are part of the ASCII alphabet. So the
 protocol designer may have been inexperienced, and the
 documentation may be confused ...

I had the same reaction: surely he means the frame is delmited
at the beginning by the ASCII STX character (0x02) and the end
by the ETX character (0x03).  

If somebody is indeed sending the three character string STX
to mark the beginning of a frame and ENX to mark the end,
then they're seriously confused (and can't spell).

 when i capture a message i can print it to the screen and the 'STX' at
 the beginning and the 'ENX' at the end are discernable, but the rest of
 the message looks like this..
 
 \x00\x00\x00,\x00\x00\x00\e17758\x00\x00   and so on and so forth...
 with some commas and other symbols in there. (the e before the 17758
 has a little hat on it)

So the unit number is an ASCII string.  Firstly, I'd recommend
printing the message in hex:

print ' '.join([%02.2x % ord(b) for b in message])

That should make it easier to figure how which byte indexes
contain the info you're looking for.

 If i print it out to a text file, i get this...
 STXNULNULNULea17758NULLNULL etc..

I'm a but baffled how the string shown above would get printed
like that.

 The \x00 is the Python repr() of a single-byte string containing a 
 null byte (i.e. a byte whose decimal value is zero).

 now the 17758 is significant because it is the actual unit number of
 the machine we want to monitor. I just dont know how to extract the
 real values out of this message.

What is meant by real values?

 anyone have an idea where to start? i have experimented with
 struct, but do not know enough about it. Does anyone know a
 good tutorial about learning byte codes and such.

What are byte codes?

 The docs on pythons website explain the module well, but i
 still do not know what to do with it.

You've got to figure out the format and location within the
message of the objects you care about.  Once you know that, you
use struct to pull out the appropriate bytes and convert them
into Python objects.

If you know (or suspect) there are IEEE 754 32-bit floating
point values in the message, then start converting all of the
possible 4-byte chunks into Python floats (using both endian
conventions) until you see numbers you recognize.

Same for 64-bit floats and interger values of various sizes.

-- 
Grant Edwards   grante Yow!  HUMAN REPLICAS are
  at   inserted into VATS of
   visi.comNUTRITIONAL YEAST...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: function v. method

2006-07-24 Thread Gerhard Fiedler
On 2006-07-24 13:25:14, fuzzylollipop wrote:

 So... the final authority /is/ the code. I don't see an alternative. For
 me, good abstraction doesn't mean I don't have to read the sources; good
 abstraction means (among other things) that I can read the sources easily.

 having auto generated docs, which means the documentatin is in the code
 as doc strings, javadoc, reflex, or whatever format is the BEST way of
 doing API documentation, period.

It may be the best way, no contest to that. But it still is not the code.
(I actually think that possibly the current way of embedding javadoc-like
documentation into sources is only a stepping stone into the direction
generally pointed to by what Wirth called literate programming. In any
case, I'd rather not call it the best way, period; calling it the best
currently widely supported way seems more appropriate to me.)

Even doc strings tend to get out of sync with the code. And even doc
strings document (at best) what the code should do, not what it actually
does. And even doc strings are not always complete in describing the
functionality.

So auto generated docs are also incomplete and out of sync with the code,
sometimes more, sometimes less, sometimes so little that it is not
relevant. But you can't know how much out of sync they are from reading the
docs alone. So when push comes to shove (or so the saying goes? :), the
code is the authority. Even with auto generated docs. Period... ?!? g

Gerhard

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


  1   2   3   >