Re: Folding in vim

2005-07-04 Thread Ron Adam
Terry Hancock wrote:

 On Saturday 02 July 2005 10:35 pm, Terry Hancock wrote:
 
I tried to load a couple of different scripts to 
automatically fold Python code in vim, but none of them
seems to do a good job.

I've tried:
python_fold.vim by Jorrit Wiersma
http://www.vim.org/scripts/script.php?script_id=515
 
 
 Actually, I think this one is doing what I want now. It seems
 to be that it isn't robust against files with lots of mixed tabs
 and spaces.  I also got space_hi.vim which highlights tabs
 and trailing spaces, which made it a lot easier to fix the 
 problem.

I edited my syntax coloring file to do the same thing.  Not to mention 
adding a few key words that were missing.  :-)

 After fixing my source files, python_fold seems to be able
 to handle them just fine.
 
 I must also recommend C. Herzog's python_box.vim
 which is fantastic -- especially the automatic Table of
 Contents generation for Python source, and pydoc.vim
 which puts access to pydoc into the editor.

Sounds good. I'll give it a try!  :-)


 Nice.  Now that I have a very sharp saw, I'm going to
 have to go cut some stuff for a bit. ;-)
 
 --
 Terry Hancock ( hancock at anansispaceworks.com )
 Anansi Spaceworks  http://www.anansispaceworks.com
 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Folding in vim

2005-07-04 Thread Andrea Griffini
On Sun, 3 Jul 2005 22:42:17 -0500, Terry Hancock
[EMAIL PROTECTED] wrote:

It seems to be that it isn't robust against files
with lots of mixed tabs and spaces.

My suggestion is:

- never ever use tabs; tabs were nice when they had
  a de-facto meaning (tabbing to next 8-space boundary)
  nowdays they're just noise as the meaning depends
  on the phase of the moon.
  Making tabs meaning anything had the pretty obvious
  implication of making tabs meaning nothing.

- stick to 4-space indent

I've even run in the past in editors that damaged
my python sources because they were indented with
two spaces (I'm used to an indent size of 2 when
working in C/C++). With python IMO 4 spaces is
perfectly adequate anyway; onced I tried it I never
had the temptation of looking back.

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


RE: Determining actual elapsed (wall-clock) time

2005-07-04 Thread Coates, Steve (ACHE)



 -Original Message-
 From: Roy Smith [mailto:[EMAIL PROTECTED]
 Sent: 02 July 2005 21:22
 To: python-list@python.org
 Subject: Re: Determining actual elapsed (wall-clock) time
SNIP
 If you get the UTC time, daylight savings time doesn't enter
 the equation. 
 If the system clock is reset, however, you're out of luck.  I
 can't think of any time-related API which doesn't rely on the
 system clock as a reference.  If the system clock is good,
 you get good time.  If the system clock sucks, or changes, you don't.

 If you care about time, you want your system clock controlled
 by NTP. 
 There's just no excuse not to.

 Is there some reason you can't just use the system clock?  I
 suppose if you had to, you could hobble together your own NTP
 client which keeps network time independent of the system
 clock.  But that would be a lot of work and it's hard to
 imagine the effort would be justified.



There is already an NTP client in the ASPN cookbook :-

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/117211

**
The information contained in, or attached to, this e-mail, may contain 
confidential information and is intended solely for the use of the individual 
or entity to whom they are addressed and may be subject to legal privilege.  If 
you have received this e-mail in error you should notify the sender immediately 
by reply e-mail, delete the message from your system and notify your system 
manager.  Please do not copy it for any purpose, or disclose its contents to 
any other person.  The views or opinions presented in this e-mail are solely 
those of the author and do not necessarily represent those of the company.  The 
recipient should check this e-mail and any attachments for the presence of 
viruses.  The company accepts no liability for any damage caused, directly or 
indirectly, by any virus transmitted in this email.
**
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: custom Tkinter ListBox selectMode

2005-07-04 Thread Eric Brunel
On Fri, 1 Jul 2005 20:19:20 -0400, Ron Provost [EMAIL PROTECTED] wrote:

 Hello,

 I've written a simple GUI which contains a listbox to hold some information.
 I've found that the click-selection schemes provided by Tkinter are
 insufficient for my needs.  Essentiall I need to impletement a custom
 selectMode.  As a first go, I've attempted to implement a click-on-click-off
 mode.  So for each entry, a click on that entry toggels its selection mode.
 A click on any entry does not affect the selection mode of any other entry.

What you describe is exactly the behavior you get when you set 
selectmode='multiple' on a list box; see:
http://www.tcl.tk/man/tcl8.3/TkCmd/listbox.htm#M57

HTH
-- 
python -c print ''.join([chr(154 - ord(c)) for c in 
'U(17zX(%,5.zmz5(17;8(%,5.Z65\'*9--56l7+-'])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What are the other options against Zope?

2005-07-04 Thread Max M
phil wrote:
 Peter Hansen wrote:

 Now understand, I know what very well what Python, Apache, PhP,
 MySQL, IE and javascript do.  I just don't know what Zope
 does.
 
 And if the answer is going contain phrases like brings together
 or sits on top of, don't bother. :-)


It's an object oriented database, with a structure that is similar to 
files and directories in an ordinary OS.

But it is a lot smarter, because the files and directories are actually 
objects with different attributes and parameters.

The methods on these objects can then be called eg. from a web browser 
with different parameters. But you can also use other protocols than 
http like dav, ftp etc.

This is a very effective way to build web applications, and does not 
need sql-object remapping as normal web apps does.

-- 

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter Checkbutton initialization problem

2005-07-04 Thread Eric Brunel
On 03 Jul 2005 02:32:21 -0700, Paul Rubin http://[EMAIL PROTECTED] wrote:

 Python 2.4, Windows XP.  If I say:

 f = Frame()
 f.grid()
 v = IntVar()
 c = Checkbutton(f, text='hi there', variable=v)
 c.grid()
 f.mainloop()

 then the checkbutton should initially display as being checked.
 But it doesn't.  It shows up unchecked, even though v.get() returns 1.
 The select operation DOES update the display if there's no variable.

In tcl/tk, booleans are not integers. So using an IntVar to represent something 
which is basically a boolean will cause unexpected behaviors like the one 
you're experiencing here. Just do:

...
v = BooleanVar()
v.set(1)
...

and everything should be fine.

HTH
-- 
python -c print ''.join([chr(154 - ord(c)) for c in 
'U(17zX(%,5.zmz5(17;8(%,5.Z65\'*9--56l7+-'])
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: math.nroot [was Re: A brief question.]

2005-07-04 Thread OKB (not okblacke)
Tom Anderson wrote:

 Yes. However, it's an excellent reason why python's precedence
 rules are wrong - in conventional mathematical notation, the unary
 minus, used to denote the sign of a literal number, does indeed
 have higher precedence than exponentiation: -1^2 evaluates to 1,
 not -1. 

This isn't true.  The unary minus operator is just a shorthand 
for multiplication by -1.  As such, it has the same operator precedence 
as multiplication.

-- 
--OKB (not okblacke)
Brendan Barnwell
Do not follow where the path may lead.  Go, instead, where there is
no path, and leave a trail.
--author unknown
-- 
http://mail.python.org/mailman/listinfo/python-list


'Deep' pickling

2005-07-04 Thread jeanphilippe . aumasson
Hi,

I have some problems when pickling an instance of a class, i don't
retrieve all its attributes instances after loading. I'm quite a
beginner in Python, so it may be a stupid error... Here the full
description :

I have a class Test, having an attribute self.problem, as an instance
of Problem class, defined in the same module.
Problem as an attribute self.optimum, that is a list of Point
instances, also defined in the same module.
So i use to write self.problem.optimum[i] to get some Points of my
Test...

I pickle a Test with the following lines :
import copy
cPickle.dump( copy.deepcopy(self), open('TEST', 'w'))
and unpickle in another module with :
fd = open( os.path.join(p, 'TEST'), 'r' )
s = cPickle.load( fd )

But the problem is, when i try to access the self.problem.optimum
field, i get an empty list, instead of having a list full of Points. I
can access string, int, or even Point attributes of Problem. This only
happens when i load AFTER restarting Python interpreter.

I thought that pickling self from my Test wasn't enought to get
instances of attributes copied to, that's why i used a deepcopy(self)
instead, but it didn't resolve my problem... I tryed to define a
__getState__() method, but didn't help...

Can someone help ?

Thx

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


Re: how to retrive highlighted text in a browser?

2005-07-04 Thread wcc
Thanks for reply.  I did not expect it to be a browser specific
problem.  I've been using a freeware dictionary tool called wordweb (it
is a  great tool) and it can detect highlighted text in browsers or
text editors, etc..  I'll keep searching.  Thanks again.   - wcc

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


Re: question about raw_input

2005-07-04 Thread wcc
Thanks for your suggestion Michael. 

-wcc

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


Outlook COM: how to create a MailItem from a .msg file

2005-07-04 Thread Guy Lateur
Hi all,

I've been writing some code to move some data into and out of Outlook (2003 
+ Exchange 2003). I have some email .msg files on our file server, and I 
can't seem to get them back into the Outlook object I need, ie a MailItem. 
I've tried to use App.CopyFile() to (temporarily) put the file in an OL 
folder. Problem is, however, this returns a DocumentItem and not a MailItem.

Is there any way I could 'cast' this DItem into a MItem? Apparently, OL 
treats it as any general document - which, btw, shows in the view, too; it 
has another icon and you have to open it to view it). Or maybe there's 
another way to open it; I really only need the object in memory. Any ideas?

TIA,
g


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


Re: Better console for Windows?

2005-07-04 Thread Richie Hindle

[Richie]
 does anyone know of a way to scroll a Command Prompt window using the 
 keyboard?

[Bengt]
 Alt-spacebar, e, l, (uparrow/downarrow)*, Esc
  (lower case L)--^   ^--does the scrolling. Esc ends the 
 scrolling mode.

[Christos]
 Damn! it says Scroll in there in the system menu, doesn't it?  Talk
 about blindness...

aolMe too!/aol

Many thanks, Bengt.

-- 
Richie Hindle
[EMAIL PROTECTED]

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


Re: When someone from Britain speaks, Americans hear a British accent...

2005-07-04 Thread Richie Hindle

[Chan]
 T can be silent in England too ..
 
 frui'
 cricke'

[Stephen]
 Both of those words (fruit and cricket) have the letter T sounded.
 
 Stephen (Nationality: English).

Not necessarily - in my native accent they'd be replaced with glottal stops.

Richie (Nationality: West Yorkshire 8-)

(Having a daughter has improved my speech - I'm much more careful about
enunciating my words properly so that she doesn't pick up my bad habits.)

-- 
Richie Hindle
[EMAIL PROTECTED]

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


f*cking re module

2005-07-04 Thread jwaixs
arg... I've lost 1.5 hours of my precious time to try letting re work
correcty. There's really not a single good re tutorial or documentation
I could found! There are only reference, and if you don't know how a
module work you won't learn it from a reference!

This is the problem:

 import re
 str = blablapythonRe modules sucks!/pythonblabla
 re.search((python)(/python), str).group()
Traceback (most recent call last):
  File stdin, line 1, in ?
AttributeError: 'NoneType' object has no attribute 'group'

the only thing I want are the number of places blabla, Re modules
sucks! and blabla are.

Noud

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


Re: f*cking re module

2005-07-04 Thread Simon Brunning
On 4 Jul 2005 01:04:47 -0700, jwaixs [EMAIL PROTECTED] wrote:
 arg... I've lost 1.5 hours of my precious time to try letting re work
 correcty. There's really not a single good re tutorial or documentation
 I could found!

http://www.amk.ca/python/howto/regex/

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


Re: f*cking re module

2005-07-04 Thread Erik Max Francis
jwaixs wrote:

 arg... I've lost 1.5 hours of my precious time to try letting re work
 correcty. There's really not a single good re tutorial or documentation
 I could found! There are only reference, and if you don't know how a
 module work you won't learn it from a reference!

Then Google for regular expression tutorials, not regular expression 
references.

 import re
 str = blablapythonRe modules sucks!/pythonblabla
 re.search((python)(/python), str).group()
 Traceback (most recent call last):
   File stdin, line 1, in ?
 AttributeError: 'NoneType' object has no attribute 'group'
 
 the only thing I want are the number of places blabla, Re modules
 sucks! and blabla are.

Your question is still not clear.  What you're searching for is 
'python/python', which isn't there, so .search returns None, and so 
you get that exception (.group takes an argument, anyway).

-- 
Erik Max Francis  [EMAIL PROTECTED]  http://www.alcyone.com/max/
San Jose, CA, USA  37 20 N 121 53 W  AIM erikmaxfrancis
   With such a weapon I could boil the Earth to vapor.
   -- Chmeee
-- 
http://mail.python.org/mailman/listinfo/python-list


Debugging embedded python

2005-07-04 Thread fotis
hello there!
I am playing with embedded python these days. I wrote sth like this:

-- Code ---
#include Python.h
#include iostream
#include cmath

/* Return the square root of an argument */
static PyObject* Fotis_root(PyObject *self, PyObject *args)
{
double d=0;
if(!PyArg_ParseTuple(args,d,d))
return NULL;
return Py_BuildValue(d, sqrt(d));
}

static PyMethodDef FotisMethods[] = {
{root,Fotis_root, METH_VARARGS,
 Return the root of a double.},
{NULL, NULL, 0, NULL}
};

int main(int argc,char** argv)
{
Py_Initialize();
Py_InitModule(fotis, FotisMethods);
PyRun_SimpleString(from fotis import root);
PyRun_SimpleString(print \Testing embedded python...\);
FILE* fp=stdin;
char *filename=Embedded;
PyRun_InteractiveLoop(fp,filename);
Py_Finalize();
 return 0;
}

--
I linked it to python24.lib (under eclipse cdt/win2k) and it compiles,
links and runs fine.
The problem is when I try to debug it (gdb). I cannot go single
stepping into the code, more than one threads seem to be running, I get
messages like No source file named d:/workspace/pyTest/main.cpp, and
if I set a breakpoint to the function Fotis_root then I cannot see any
variables. In fact I cannot see no stack, no registers nothing, within
this function!
With msvc 6.0 debuging goes smoothly.
Any ideas?
Thank you.
Fotis._

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


Re: Lost in a sea of documentation...can you point me in the right direction?

2005-07-04 Thread Simon Brunning
On 6/30/05, Bruno Desthuilliers [EMAIL PROTECTED] wrote:
 There are 2 problems to solve:
 1/ change the 'wallpaper'
 2/ run as a background task (a 'service' on Win32, a 'daemon' on unix-likes)
 
 The 2nd one is already solved by your os (use Windows' task scheduler or
 *n*x's cron).

I was playing about with the 1st problem a couple of years ago:
http://www.brunningonline.net/simon/blog/archives/winDesktop.py.html

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


Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-04 Thread Carl Banks


Steven D'Aprano wrote:
 Carl Banks wrote:

  The shamelessness with which you inflated the verbosity of the latter
  is hilarious.

 [snip]

  [ x**2 + y**2 for (x,y) in izip(xlist,ylist) ]
 
  Now there's no longer much advantage in conciseness for the map version
  (seeing that you'd have to define a function to pass to map), and this
  is more readable.

 and then, five minutes later in another post, wrote:

   If you're doing heavy functional programming,
   listcomps are tremendously unwieldy compared to
   map et al.

 Having a dollar each way I see :-)


Don't think so.  The verbosity I spoke of was your describing the code
snippets  in English, not the conciseness of the example.  map and
friends are more concise than listcomps, I wasn't arguing that, except
that for the typical Pythonic use of listcomps it isn't much.  One
listcomp or one call to map is not heavily functional.


-- 
CARL BANKS

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


Re: web programming with mod_python

2005-07-04 Thread Gregory Bond
Rodrigo Dominguez wrote:

 My question is: is there some kind of framework that works with mod_python?

I use and love Albatross, but there are heaps of others.  Check the 
mod_python FAQ, in particular

http://www.modpython.org/FAQ/faqw.py?req=showfile=faq03.010.htp
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: email link and foreign accent

2005-07-04 Thread Vittorio
Peter Hansen [EMAIL PROTECTED] wrote in news:6f-dnTSTQazBSlvfRVn-
[EMAIL PROTECTED]:

 Vittorio wrote:
 printa href=mailto:%s; %(campovalore.encode('iso-8859-1'))
 print campovalore.encode('iso-8859-1')
 print /a
 
 It might help if you showed us the output of repr(x) where x is the 
 output of the campovalore.encode('iso-8859-1') part above.

Thanks Peter for replying.
This is an example of the output of repr(x) as you requested:

'[EMAIL PROTECTED]'

Results:
link opened from IE6-Outlook: it works
link opened from IE6-Pocomail: it works
link opened from Firefox-Outlook: characters with accent fail
link opened from Firefox-Pocomail: characters with accent fail

It looks like having to do more with Firefox than with Python itself but 
maybe someone can help anyway?

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


Re: f*cking re module

2005-07-04 Thread Matthias Huening
jwaixs (04.07.2005 10:04):
 arg... I've lost 1.5 hours of my precious time to try letting re work
 correcty. There's really not a single good re tutorial or documentation
 I could found! 

Did you try this one?
http://www.amk.ca/python/howto/regex/regex.html

import re
str = blablapythonRe modules sucks!/pythonblabla
re.search((python)(/python), str).group()
 
 Traceback (most recent call last):
   File stdin, line 1, in ?
 AttributeError: 'NoneType' object has no attribute 'group'

RE doesn't find (python)(/python) because it isn't in your string. 
That's why group fails.

  import re
  s = blablapythonRe module is great!/pythonblabla
  re.search((python).*(/python), s).group()
'pythonRe module is great!/python'


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


Re: f*cking re module

2005-07-04 Thread Max M
jwaixs wrote:
 arg... I've lost 1.5 hours of my precious time to try letting re work
 correcty. There's really not a single good re tutorial or documentation
 I could found! There are only reference, and if you don't know how a
 module work you won't learn it from a reference!

If you want to try out re interactively you could use:

Python\Tools\Scripts\redemo.py


-- 

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: f*cking re module

2005-07-04 Thread Diez B. Roggisch
jwaixs wrote:
 arg... I've lost 1.5 hours of my precious time to try letting re work
 correcty. There's really not a single good re tutorial or documentation
 I could found! There are only reference, and if you don't know how a
 module work you won't learn it from a reference!
 
 This is the problem:
 
 
import re
str = blablapythonRe modules sucks!/pythonblabla
re.search((python)(/python), str).group()
 
 Traceback (most recent call last):
   File stdin, line 1, in ?
 AttributeError: 'NoneType' object has no attribute 'group'
 
 the only thing I want are the number of places blabla, Re modules
 sucks! and blabla are.

Others gave you advice on how to deal withe regexes. I'm going to add 
that regexes aren't the way to go for this - use HTMLParser. With your 
regex, you won't be able to handle correctly either this

foosome text/foofoosome other text/foo

as you will get the whole string, not just the first match. You can 
alter the so-called longest match behaviour, but then

foosome oute text foosome inner text/foo some more outer text/foo


won't work


Try and do not use regexps. Or at least do it in a way that you tokenize 
the text and then can sweep over it collecting the data you need 
yourself (but that's basically rewriting the html parsers out there).

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


Re: How do you program in Python?

2005-07-04 Thread dirk dierickx
On Sun, 03 Jul 2005 17:35:16 +0100, anthonyberet wrote:

 I see lots of alternate IDEs etc, but which would allow me the simple 
 interface that I have described? - I really don't know about IDEs in 
 general, and I suspect I would be out of my depth with one of those.

Eclipse and pydev are good. for testing out small routines you can use
ipython, which is great.

-- 
If you tell the truth you don't have to remember anything.
-- Mark Twain

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


Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-04 Thread Carl Banks
Christopher Subich wrote:
 Carl Banks wrote:
 
  Christopher Subich wrote:
 I've heard this said a couple times now -- how can listcomps not
 completely replace map and filter?
  If you're doing heavy functional programming, listcomps are
  tremendously unwieldy compared to map et al.

 Interesting; could you post an example of this?  Whenever I try to think
 of that, I come up with unwieldly syntax for the functional case.  In
 purely functional code the results of map/filter/etc would probably be
 directly used as arguments to other functions, which might make the
 calls longer than I'd consider pretty.  This is especially true with
 lots of lambda-ing to declare temporary expressions.

I suspect you're misunderstanding what I mean by heavily functional.

You appear to see maps and listcomps merely as a shortcut for a for
loop.  You're comparing the map shortcut and the listcomp shortcut and
seeing which one's less verbose.  In a mostly procedural program which
uses functional constructs in isolation, listcomps are going to win
most of those battles.

Heavily functional programming is a different mindset altogether.  In
heavily functional programming, things like maps and filters and
function applications are actually what you're thinking about.  map
isn't an indirect way to do a for loop; it's a direct way to do a map.

When your mind is focused on applying a function to each member of
this list and returning a list of the results as opposed to
convenient shortcut to a for loop, map is going to be far superior to
a listcomp.  And when you're doing dozens and dozens of maps over a
large purely functional program, you don't want to write out a listcomp
every single time you want to do it.


-- 
CARL BANKS

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


Re: f*cking re module

2005-07-04 Thread Gurpreet Sachdeva
try:
re.search((python)(/python), str).group()
except:
print 'not found'

otherwise,

 re.search((python).*?(\/python), str).group()

this is will help!

Regards,
Gurpreet Singh

Blogging [at] http://garrythegambler.blogspot.com

On 4 Jul 2005 01:04:47 -0700, jwaixs [EMAIL PROTECTED] wrote:
 arg... I've lost 1.5 hours of my precious time to try letting re work
 correcty. There's really not a single good re tutorial or documentation
 I could found! There are only reference, and if you don't know how a
 module work you won't learn it from a reference!
 
 This is the problem:
 
  import re
  str = blablapythonRe modules sucks!/pythonblabla
  re.search((python)(/python), str).group()
 Traceback (most recent call last):
   File stdin, line 1, in ?
 AttributeError: 'NoneType' object has no attribute 'group'
 
 the only thing I want are the number of places blabla, Re modules
 sucks! and blabla are.
 
 Noud
 
 --
 http://mail.python.org/mailman/listinfo/python-list
 


-- 
Thanks and Regards,
GSS
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Embedding performance.

2005-07-04 Thread [EMAIL PROTECTED]
amit wrote:
  Is there any kind of performance differences to the different ways of
 embedding python?
   PyEval_EvalCode()
   PyRun_SimpleFile()
   PyObject_CallObject()


AFAIK, these are only different wrappers, while you're generally
getting at the same functionality. I assume you're somewhat familiar
with the Python API. What you're saving using the third one is parsing
and compiling time, since the other two functions do it every time
they're called, I believe. With PyObject_CallObject() you already have
the PyObject, so it just goes straight to the interpreter core, and
does not do any parsing and compiling. That said, you have to get the
object from somewhere first, possibly using the other two :), which may
not apply if you're calling something embedded (that is, written in C).


A quick look in the Python sources brings up the following:
PyRun_SimpleFile: adds __main__. sets __file__. looks for .pyc or .pyo
files, loads the code object from them, or parses text, and finally
calls PyEval_EvalCode with the code object. So there, you have the
overhead.
PyObject_CallObject: goes through some redirection to PyObject_Call,
which calls obj-ob_type-tp_call directly.
PyEval_EvalCode: checks for globals, checks for arguments, creates a
frame with all the necessary stuff, checks for generators, calls
PyEval_EvalFrame() which does all the dirty running of python code.

So there, the least overhead seems to be in CallObject. Don't treat
this as an authoritative answer, though.:)

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


Re: email link and foreign accent

2005-07-04 Thread Vittorio
Vittorio [EMAIL PROTECTED] wrote in news:Xns96896D46D9DCCSoToSpeak@
195.110.128.18:

 Thanks Peter for replying.
 This is an example of the output of repr(x) as you requested:
 
 '[EMAIL PROTECTED]'
 
 Results:
 link opened from IE6-Outlook: it works
 link opened from IE6-Pocomail: it works
 link opened from Firefox-Outlook: characters with accent fail
 link opened from Firefox-Pocomail: characters with accent fail

adjournment:

link opened from Firefox-Thunderbird:it works
link opened from IE6-Thunderbird:it works
-- 
http://mail.python.org/mailman/listinfo/python-list


MySQL posting confirmation for python-list@python.org

2005-07-04 Thread MySQL Lists Automoderator
This is an automatic reply to an email you sent to a MySQL mailing address
protected by our 'self-moderation' system. To reduce the amount of spam
received at these addresses, we require you to confirm that you're a real
person before your email will be allowed through.

Unfortunately, we got a bounce for one of the confirmation emails we
already sent, so you've been added to the list of addresses which will
get bounced immediately.

In order to have yourself added to the list of real email addresses, and
removed from the list of those who have bounced, you need to click on the
following link (or cut-and-paste it to a browser):

 
http://lists.mysql.com/c/a285fefe95ba36aded1612a93a5711cc/python-list@python.org

After we have received your confirmation, python-list@python.org
will be added to the list of pre-approved mail addresses for all of
the MySQL mail addresses and future emails from that address will be
delivered without delay automatically.

You will not receive an email confirmation of your confirmation -- future
messages will simply be sent along without delay.

Sorry for the hassle, but the volume of unsolicited commercial email
sent to these addresses has made this step necessary.

--- Your original email is below.

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


Re: I am a Java Programmer

2005-07-04 Thread bruno modulix
[EMAIL PROTECTED] wrote:
 I am a java programmer 
Too bad :(

 and I want to learn Python 
So there's still hope !-)

 Please help me.
1/ download and install Python
2/ go thru the 'dive into Python' and 'Thinking in Python' free books
3/ post here when you're in doubt or in trouble...

And don't forget: Python is *not* Java !-)

-- 
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: your purge request

2005-07-04 Thread Lyris ListManager
Re: your purge request
 purge

Sorry, but your email address: python-list@python.org
is not listed as a member of a mailing list.

Thus, you could not be unsubscribed from any mailing lists.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to compare files

2005-07-04 Thread bruno modulix
Lad wrote:
 Hi,
 What is the best method for comparing two files by words?

try the difflib module:
http://www.python.org/doc/2.4.1/lib/module-difflib.html


-- 
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: f*cking re module

2005-07-04 Thread Stephen Harris

jwaixs [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 arg... I've lost 1.5 hours of my precious time to try letting re work
 correcty. There's really not a single good re tutorial or documentation
 I could found! There are only reference, and if you don't know how a
 module work you won't learn it from a reference!


PowerGrep is a commercial Windows tool. However, it comes
with a manual that has a 45 page tutorial on regular expressions.
www.powergrep.com/manual/PowerGREP.pdf  tutorial: pages 109-156
There is also a new Wrox book besides the O'Reilly/Friedl Owl book.

http://www.uhacc.org/tech_docs/guides/regex1.php
also regex2.php, and regex3.php

Only the delimiters have been changed to protect the innocent,
Stephen 


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


curses -- getxy() error

2005-07-04 Thread shablool
Hi,
Could someone please explain why stdscr.getxy() always raise an
exception:

import curses
import traceback

def init(stdscr):
x = y = 0
while 1:
c = stdscr.getch()
if c == ord('q'):
break
stdscr.addch(c)
(x, y) = stdscr.getxy()
stdscr.refresh()

def main():
try:
curses.wrapper(init)
except Exception, e:
traceback.print_exc()
   
if __name__ == __main__:
main()

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


Re: curses -- getxy() error

2005-07-04 Thread [EMAIL PROTECTED]
shablool wrote:
 Could someone please explain why stdscr.getxy() always raise an
 exception:
[code here]
the method is named getyx(), this is old unix heritage.
see http://www.python.org/doc/2.0.1/lib/curses-window-objects.html

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


Re: How do you program in Python?

2005-07-04 Thread Terry Hancock
On Sunday 03 July 2005 11:35 am, anthonyberet wrote:
 What I would really like is something like an old-style BASIC 
 interpreter, in which I could list, modify and test-run sections of 
 code, to see the effects of tweaks, without having to save it each time, 
 or re-typing it over and over (I haven't even worked out how to cut and 
 paste effectively in the IDLE environment).

How old style? Basic has changed a lot over the years. ;-)

But seriously, I think I know what you mean.   I'm going to suggest that
you try going very low tech with this and don't use an IDE at all.  I'm
sure you have some form of window environment (X, Windows, or Mac)
and can open a terminal and an editor of your choice on screen (even if
it's Notepad).

Start the Python interpreter up in the terminal by just typing python.
In the interpreter you can try simple one or two liners.  You can even
define a short function and try it out.

But you'll get annoyed by having to up-arrow and retrieve lines one-
by-one to repeat the function after you've made a mistake, so that'll
get old for anything more than 5 lines long.

So, use your editor.   Type up a short program that you want to test
in the editor, then copy and paste it into the Python interpreter.  This
way, when you (inevitably) find mistakes, you can just tweak them in
the editor and then paste them again.

You can, of course, paste statements from the interpreter back into
your editor, but you'll have to avoid the  prompts (or delete them),
so it's usually better to write in the editor and paste into the interpreter.

And when you're done, you can just save the result to file so you
can get it back later.

My point is, you don't have to use a fancy all-in-one application to
do the job, nor must you run your programs from within your editor.
It's not so hard to just use tools you already understand.

Personally, I did things like this for years, and still do from time to time.
I've hardly ever used an IDE, and I'm still not totally convinced they
are worth the effort involved in learning them.  I used to hop from computer
to computer a lot, and if I tried to learn my way around separate IDEs
on Macs, Windows, DOS, Solaris, and Debian Linux, I would've spent
a lot of time twiddling with the tools instead of just writing code.

Lately, I've settled into using Vim, which is nice editor (especially if you
once wrote  a several thousand line program in Vi with nothing but a
fold-up quick reference for a manual ;-) ).  There may well be friendlier
ones, but I know this one fairly well, and it has a pretty large community
of developers who are constantly tweaking it to make it a better editor
for programming.  I only just recently started seriously customizing it
to work well with Python, though.

You can always go shopping for an IDE to buy into heavily *after*
you've learned the language.  Meanwhile, don't let trifles get in the
way -- just use your window system as your IDE.  That way, you
can pick the editor to suit you.  And the Python interpreter is great,
it will give you no trouble and quick answers.

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com

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


Re: Will Guido's Python Regrets ever get implemented/fixed?

2005-07-04 Thread Peter Maas
George Sakkis schrieb:
 Given that the latest 2.x python will be 2.9

Why not 2.13 or 2.4711? Version strings are sequences of arbitrary
integers separated by dots and not decimal numbers, or are they?

-- 
---
Peter Maas,  M+R Infosysteme,  D-52070 Aachen,  Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
---
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: looping over a big file

2005-07-04 Thread Terry Hancock
On Sunday 03 July 2005 08:28 pm, Peter Hansen wrote:
 If open() can ever return things other than files, it seems likely it 
 will do so only under conditions that make it pretty much safe to assume 
 that existing code will continue to operate as expected (note: not 
 always with a file).

WHEN it returns things other than files.  Like a StringIO object,
which can be quite handy.  True, it won't be a big file, but it'd
be nice if the same code would tolerate it.  I've used this with
e.g. PIL quite a bit when working with Zope, because it isn't
really desireable to have to write the file out to disk and read
it back when you've already got it in memory.

Quack! ;-)
Terry
--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com

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


Re: f*cking re module

2005-07-04 Thread jwaixs
Thank you for your replies, it's much obvious now. I know more what I
can and can't do with the re module. But is it possible to search for
more than one string in the same line?

bv. I want to replace the python with  
/python with \n and every thing that's not between the two python
tags must begin with \nprint \\\ and end with n? Or do I
need more than one call?

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


Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-04 Thread Terry Hancock
On Sunday 03 July 2005 07:05 pm, Erik Max Francis wrote:
 I personally think that map looks clearer than a list comprehension for 
 a simple function call, e.g.

I have to disagree
 
   map(str, sequence)

This says call a function 'map' on 'str' and 'sequence'

Which, syntactically, is not terribly informative.

I have to remember:

* str is actually a callable
* map is a mathematical concept of linking one thing to another.  What
things?  str to sequence?  No! Wrong guess.  str is the mapping function,
and the result is the thing sequence is to be linked to.

Now, sure, I know all this, and I learned what map did from the manual,
but it's not especially easy to remember.

This on the other hand,

   [str(x) for x in sequence]

is practically plain English:

call the function str on x, for every x in sequence

Other than chopping out a few words, and using the () operator instead
of call, it's hard to imagine this being any closer to exactly what you
would say to describe the operation. And for most of us, English comes
easier than Computer Science jargon.

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com

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


Re: f*cking re module

2005-07-04 Thread Cyril BAZIN
If you are looking for HTML tags or something like that. Have a look
at the HTMLParser (docs.python.org).

On 4 Jul 2005 03:37:02 -0700, jwaixs [EMAIL PROTECTED] wrote:
 Thank you for your replies, it's much obvious now. I know more what I
 can and can't do with the re module. But is it possible to search for
 more than one string in the same line?
 
 bv. I want to replace the python with  
 /python with \n and every thing that's not between the two python
 tags must begin with \nprint \\\ and end with n? Or do I
 need more than one call?
 
 --
 http://mail.python.org/mailman/listinfo/python-list

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


precision problems in base conversion of rational numbers

2005-07-04 Thread Brian van den Broek
Hi all,

I guess it is more of a maths question than a programming one, but it 
involves use of the decimal module, so here goes:

As a self-directed learning exercise I've been working on a script to 
convert numbers to arbitrary bases. It aims to take any of whole 
numbers (python ints, longs, or Decimals), rational numbers (n / m n, 
m whole) and floating points (the best I can do for reals), and 
convert them to any base between 2 and 36, to desired precision.

I'm pretty close but I know I am not handling the precision quite 
right. Nothing other than understanding hangs on it, but, that's 
enough :-)

To do all this I'm using the decimal module (for the first time) and 
I've been setting the precision with

decimal.getcontext().prec = max(getcontext().prec,
 x * self.precision )

This is in my class's __init__ method before I convert every number to 
Decimal type and self.precision is at this point an int passed.

The first term is to be sure not to reduce precision anywhere else. In 
the last term I'd started off with x = 1, and that works well enough 
for small cases (i.e. cases where I demanded a relatively low degree 
of precision in the output).

I've no idea how to work out what x should be in general. (I realize 
the answer may be a function of my choice of algorithm. If it is 
needed, I'm happy to extract the relevant chunks of code in a 
follow-up -- this is long already.)

For getcontext.prec = 80 (i.e x = 1) when I work out 345 / 756 in base 
17 to 80 places (i.e. self.precision = 80) I get:

  print Rational_in_base_n(345, 756, 17, 80)
0.7CF0CA7CF0CA7CF0CA7CF0CA7CF0CA7CF0CA7CF0CA7CF0CA7CF0CA7CF0CA7CF0D5C1G603999179EB

(Rational_in_base_n(numerator, denominator, base, precision) is the 
rational specific subclass. When I convert the result back to decimal 
notation by hand it agrees with the correct answer to as many places 
as I cared to check.)

I've discovered empirically that I have to set getcontext.prec = 99 or 
greater (i.e. x = 1.2375) to get
0.7CF0CA7CF0CA7CF0CA7CF0CA7CF0CA7CF0CA7CF0CA7CF0CA7CF0CA7CF0CA7CF0CA7CF0CA7CF0CA7C

(I do feel safe in assuming that is the right answer. :-)

How would I go about working out what degree of precision for the 
decimal module's context is needed to get n 'digits' of precision in 
an expression of base m in general? (I've no formal training in Comp 
Sci, nor in the relevant branches of mathematics.)

Thanks and best,

Brian vdB

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


Review of 'data crunching'

2005-07-04 Thread TechBookReport
There's a review of 'Data Crunching' by Greg Wilson over at 
TechBookReport. This is not a teach-yourself Python book but one that 
uses Python to solve various common data-related tasks with regular 
expressions, XML, SQL and so on.

The review is here: http://www.techbookreport.com/tbr0172.html

-- 
TechBookReport - Programminghttp://www.techbookreport.com/ProgIndex.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: math.nroot [was Re: A brief question.]

2005-07-04 Thread George Sakkis
Steven D'Aprano [EMAIL PROTECTED] wrote:

 But it doesn't make sense to say that two flags are equal:

 keep_processing = True
 more_reading_needed = True
 while more_reading_needed and keep_processing:
  get_more_records()
  process_records()
 if not keep_processing:
  print User clicked Cancel

 What does it mean to say that the flag done_processing
 is equal to the flag more_reading_needed? (That is not
 the same question as asking if the two flags have the
 same value.)

Huh ? Equality *is* the answer to whether two things (flags or
whatever) have the same value or not. What else could it be ? Certainly
not whether they are *the same*; you have the 'is' operator for
checking identity. In any case, done_processing ==
more_reading_needed is perfectly valid and most people would agree
that if the result is True, done_processing and more_reading_needed
are equal.

 It gets worse. Consider this example of logic:

 x = log(-5)  # a NaN
 y = log(-2)  # the same NaN
 x == y  # you want this to be true for NaNs

 Then:

 # compare x and y directly
 log(-5) == log(-2)
 # if x == y then exp(x) == exp(y) for all x, y
 exp(log(-5)) == exp(log(-2))
 -5 == -2

Such paradox cases can be avoided if the only operations defined for
NaNs are equality/inequality; all others yield NaN too. That is,
exp(NaN) is NaN, as it is log(NaN), 3**NaN / 5i and so on. Think of NaN
as a black hole that absorbs and assimilates what falls into it, so
log(-5) and log(-2) are just NaN, they lose their identity as two
distinct things, log(-5) and log(-2).

  Similarly, if z=0/0, z would also be invalid, but
  different from x and y, since it is the result of a different invalid
  operation. This brings us to the many-NaN situation.

 The problem is, the many NaNs in the IEEE standard (or
 at least Apple's implementation of it) refer to _kinds_
 of NaNs, not NaNs themselves.

 log(-2) is not the same not a number as log(-2.0001),
 or log(-2.3). They might be the same kind of failure,
 but that's it.

That's absolutely fine; as long as two things are invalid and they're
invalid for the same reason (kind of failure), they are equal to me.

 Having given reasons why it is utterly bogus to be
 comparing NaNs for equality, I will say this.
 Practicality beats purity. If you can demonstrate a
 good usage case for testing equality with NaNs, I will
 accept that it is a good thing to do.

 if x in (SOME_NAN, SOME_OTHER_NAN, ANOTHER_NAN, \
  YET_ANOTHER_NAN, AND_ANOTHER_NAN, ..., \
  # 240+ more NaNs listed
  ALMOST_FINISHED_NOW, LAST_NAN):
  print Calculation failed!

 is _not_ a good usage case, since it is best handled with:

 if isNan(x):  # handled by the floating point package
  print Calculation failed!

Agreed on that, if all you need to know is if the outcome of an
expression is valid or not. But since a NaN can be thought of as a
flag representing the fact that an error occurred, as you mentioned,
it makes sense in practice to ask whether two errors are of the same
kind, e.g. for handling them differently. If I understood correctly,
your objection is using the equality operator '==' with these semantics
for NaNs. I would say that it's a reasonable choice for practicality
beats purity reasons, if nothing else.

George

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


Unicode drives me crazy...

2005-07-04 Thread [EMAIL PROTECTED]
Hi !

I want to get the WMI infos from Windows machines.
I use Py from HU (iso-8859-2) charset.

Then I wrote some utility for it, because I want to write it to an XML file.

def ToHU(s,NoneStr='-'):
if s==None: s=NoneStr
if not (type(s) in [type(''),type(u'')]):
   s=str(s)
if type(s)type(u''):
   s=unicode(s)
s=s.replace(chr(0),' ');
s=s.encode('iso-8859-2')
return s

This fn is working, but I have been got an error with this value: 
'Kommunik\xe1ci\xf3s port (COM1)'

This routine demonstrates the problem

s='Kommunik\xe1ci\xf3s port (COM1)'
print s
print type(s)
print type(u'aaa')
s=unicode(s) # error !

This is makes me mad.
How to I convert every objects to string, and convert (encode) them to 
iso-8859-2 (if needed) ?

Please help me !

Thanx for help:
 ft




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


Trapping user logins in python ( post #1)

2005-07-04 Thread thinkgeek
I am writting a daemon in python which should start at system start up
with all inet.d serviceson an NIS server. Then it should listen to any
user login and then start a new process for that user on his login
which will continue throughout his entire session.

Can anyone give any help or any suggestion or any useful links.

thinkgeek

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


Re: Outlook COM: how to create a MailItem from a .msg file

2005-07-04 Thread Simon Brunning
On 7/4/05, Guy Lateur [EMAIL PROTECTED] wrote:
 I've been writing some code to move some data into and out of Outlook (2003
 + Exchange 2003). I have some email .msg files on our file server, and I
 can't seem to get them back into the Outlook object I need, ie a MailItem.
 I've tried to use App.CopyFile() to (temporarily) put the file in an OL
 folder. Problem is, however, this returns a DocumentItem and not a MailItem.
 
 Is there any way I could 'cast' this DItem into a MItem? Apparently, OL
 treats it as any general document - which, btw, shows in the view, too; it
 has another icon and you have to open it to view it). Or maybe there's
 another way to open it; I really only need the object in memory. Any ideas?

Well, I don't know anything about Outlook's COM interface, so I don't
know if this will work, but you might try win32com.client.CastTo().
Something like:

my_MItem = win32com.client.CastTo(my_DItem, 'MItem')

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


Connecting to Firebird database using Kinterbasdb+Python

2005-07-04 Thread Maurice LING
Hi,

I've been using FB1.5 and access the database using Kinterbasdb + 
Python. My connection is established using kinterbasdb.connect() method 
and the parameters host, dns, database, user, password are all defaulted 
to 'None'.

On my own machine running Mac OSX 10.3, I can connect using the following:
host = 'localhost'
database = 'my path to FB database'
user = 'user'
password = 'password'

At the same time, I can also connect if I set host=None on my machine.

However, I cannot use 'localhost' on a shared Linux machine (not 
allowed. Don't ask why, system admin's mandate. And the Linux machine is 
without inetd). So when I set host=None, I get this error:

Connecting to Muscopedia Database
Connection: 
localhost:/mnt/disk/home/mling/muscorian/BioDatabases/muscopedia.fdb:mouse:mouse
 
-- default
None -- actual host (with 'print self.dbhost' where 
kinterbasdb.connect(host = self.dbhost,.)
OperationalError
(-902, 'isc_attach_database: Unable to complete network request to host 
localhost.. Failed to establish a connection.. Connection refused. ')
   File muscorian.py, line 641, in main
 result = mosys.run(command)

   File muscorian.py, line 597, in run
 elif (command[0] == 'linkmuscopedia'): 
self.commandLinkMuscopediaDB(command)

   File muscorian.py, line 129, in commandLinkMuscopediaDB
 self.muscopedia = PubMedGrabber.FBUtilities(str(command[1]))

   File abcrawl/PubMedGrabber.py, line 340, in __init__
 user = self.dbuser, password = self.dbpwd, charset='UNICODE_FSS')

   File /usr/lib/python2.2/site-packages/kinterbasdb/__init__.py, line 
470, in connect
 return Connection(*args, **keywords_args)

   File /usr/lib/python2.2/site-packages/kinterbasdb/__init__.py, line 
608, in __init__
 self._C_con = _k.attach_db(dsn, dpb, dialect)

Any ideas or solutions?

Thanks in advance.

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


RE: Unicode drives me crazy...

2005-07-04 Thread Tim Golden
[EMAIL PROTECTED]

| I want to get the WMI infos from Windows machines.
| I use Py from HU (iso-8859-2) charset.

OK, there are people better placed than I to explain
about Unicode. Check out the following article, for
example:

http://www.joelonsoftware.com/printerFriendly/articles/Unicode.html

but in short, you need to understand that WMI hands
you back a unicode object -- not a string, a unicode
object. If you want to write that out to a file, you
must write out a string representation of it. And
that string representation must use one of the
standard encodings (or you could invent your own, I
suppose, but why bother?).

One way of doing this would be:

code
import wmi
import codecs

f = codecs.open (c:/temp/info.txt, w, encoding=iso-8859-2)

try:
  c = wmi.WMI ()
  for port in c.Win32_SerialPort ():
f.write (Caption = %s\n % port.Caption)
f.write (DeviceID = %s\n % port.DeviceID)
finally:
  f.close ()
/code

You now have a text file -- info.txt -- which holds
string representations of several unicode objects. If
the characters all fall within the common A-Z/1-9
characters, it will appear just the same as an old-fashioned
ascii file. If the original data represented (presumably) 
Hungarian characters, there will be some representation of
that, probably using \x sequences.

This file can be read by any other program which knows
that it's an iso-8859-2 encoding of unicode. (Knows, because
you write the program or because you've told the programmer).
Obviously, if this were an XML file, you would put an
encoding tag or whatever it's called (I'm not up on XML).

TJG


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

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


Re: python project layout

2005-07-04 Thread Huron
Hi Peter,

Thanks for you detailed reply.
The layout that you suggest sounds wise to me (I'm about to start a
project).
I confess that, coming from the java world, I've trouble to move away 
from
the paradigm one class = one file ... and to gather things inside
python modules ...

-- huron


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


Cancelling a subprocess based on its output

2005-07-04 Thread jelle
Hi,

I'm using the subprocess module to run a open-source lighting
simulation software, Radiance, and am using python to script it. When
Radiance finds a scene where no light is present its prints out
'warning - no light sources found' to the console. I'm looking for a
way to terminate the subprocess when this message is spitted out to the
console. Searching this forum on subprocess  stderr didn't lead to a
clue to solving this problem. I'm using both win32  linux to run these
simulations, so a cross-platform way of doing this is important. Any
suggestions?

Cheers, Jelle.

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


Re: python project layout

2005-07-04 Thread Huron
Hi again,

For instance, if you have several classes implementing the same 
interface
(say, doing the same things with different strategies), how would you
organize that in terms of files (modules) and directories (packages) ?

-- huron

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


Re: How do you program in Python?

2005-07-04 Thread bruno modulix
anthonyberet wrote:
 My question isn't as all-encompassing as the subject would suggest...
 
 I am almost a Python newbie, but I have discovered that I don't get
 along with IDLE, as i can't work out how to run and rerun a routine
 without undue messing about.
 
 What I would really like is something like an old-style BASIC
 interpreter, in which I could list, modify and test-run sections of
 code, to see the effects of tweaks, without having to save it each time,
 or re-typing it over and over 
(snip)
 I see lots of alternate IDEs etc, but which would allow me the simple
 interface that I have described? 

Try Emacs + python-mode. Emacs surely has a lot of warts, but I'm still
looking for a better and more versatile code editor/IDE - specially when
it comes to languages with REPL (- Read-Eval-Print Loop).

-- 
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 do you program in Python?

2005-07-04 Thread Roy Smith
bruno modulix [EMAIL PROTECTED] wrote:

 Try Emacs + python-mode. Emacs surely has a lot of warts, but I'm still
 looking for a better and more versatile code editor/IDE - specially when
 it comes to languages with REPL (- Read-Eval-Print Loop).

When you build Python, make sure you build it with Gnu readline support.  
Then you can just fire up an interpreter, and use emacs (or, I suppose, vi) 
editing commands to scroll back through (and change) your input history.  
It's not as good as a real IDE, but it's still very handy for quick 
explorations.

The next step up would be to run a real emacs, do M-X shell, then fire up a 
Python interpreter inside that.

Or, go into split screen mode in emacs, editing your python source file in 
one window and running a shell in the other.  Edit some code in the source 
window, and it takes about 6 keystrokes to save it, flip to the other 
window, and re-run the file (you can get it down to a single keystroke by 
defining a simple macro and binding it to a function key).
-- 
http://mail.python.org/mailman/listinfo/python-list


OT: ^ in redirection (windows)

2005-07-04 Thread Miki Tebeka
Hello All,

Can someone explain me the difference between:
echo 1  1.txt 21
and
echo 1  1.txt 2^1

(Windows XP cmd shell)

Both produce 1.txt with the content 1.

(Sadly, I don't know how to search for ^ in google).

Thanks.
--

Miki Tebeka [EMAIL PROTECTED]
http://tebeka.bizhat.com
The only difference between children and adults is the price of the toys



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

Re: Unicode drives me crazy...

2005-07-04 Thread Sybren Stuvel
[EMAIL PROTECTED] enlightened us with:
 I want to get the WMI infos from Windows machines.
 I use Py from HU (iso-8859-2) charset.

Why not use Unicode for everything?

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: Unicode drives me crazy...

2005-07-04 Thread Fuzzyman


[EMAIL PROTECTED] wrote:
 Hi !

 I want to get the WMI infos from Windows machines.
 I use Py from HU (iso-8859-2) charset.

 Then I wrote some utility for it, because I want to write it to an XML file.

 def ToHU(s,NoneStr='-'):
 if s==None: s=NoneStr
 if not (type(s) in [type(''),type(u'')]):
s=str(s)
 if type(s)type(u''):
s=unicode(s)
 s=s.replace(chr(0),' ');
 s=s.encode('iso-8859-2')
 return s

 This fn is working, but I have been got an error with this value:
 'Kommunik\xe1ci\xf3s port (COM1)'

 This routine demonstrates the problem

 s='Kommunik\xe1ci\xf3s port (COM1)'
 print s
 print type(s)
 print type(u'aaa')
 s=unicode(s) # error !

 This is makes me mad.
 How to I convert every objects to string, and convert (encode) them to
 iso-8859-2 (if needed) ?


s is a 'byte string' - a series of characters encoded in bytes. (As is
every string on some level). In order to convert that to a unicdoe
object, Python needs to know what encoding is used. In other words it
needs to know what character each byte represents.

See this :

t = s.decode('iso-8859-1')
t
u'Kommunik\xe1ci\xf3s port (COM1)'
print t
Kommunikációs port (COM1)
print type(s)
type 'str'
print type(t)
type 'unicode'

The decode instruction converts s into a unicode string - where Python
knows what every character is. If you call unicdoe with no encoding
specified, Python reverts to the system default - which is *probably*
'ascii'. You string contains characters which have *no meaning* in the
ascii codec - so it reports an error

Does this help ?

Once you 'get unicode', Python support for it is pretty easy. It's a
slightly complicated subject though. Basically you need to *know* what
encoding is being used, and whenever you convert between unicode and
byte-strings you need to specify it.

What can complicate matters is that there are lot's of times an
*implicit* conversion can take place. Adding strings to unicode
objects, printing strings, or writing them to a file are the usual
times implicit conversion can happen. If you haven't specified an
encoding, then Python has to use the system default or the file object
default (sys.stdout often has a different default encoding than the one
returned by sys.getdefaultencoding()). It is these implicit conversions
that often cause the 'UnicodeDecodeError's and 'UnicodeEncodeError's.

HTH

Best Regards,

Fuzzy
http://www.voidspace.org.uk/python

 Please help me !
 
 Thanx for help:
  ft

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


Re: Unicode drives me crazy...

2005-07-04 Thread Fuzzyman
At some point you have to convert - esp. when writing data out to file.
If you receive data as a byte string and have to store it as a byte
string, it is sometimes convenient to *not* convert in the middle.

Best Regards,

Fuzzy
http://www.voidspace.org.uk/python

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


trace function calls to get signatures

2005-07-04 Thread harold fellermann
Hi all,

I am trying to write a script that prints out the signatures
of each function call that occurs during the execution of
a second script which is invoked by my program. i.e. if the
inspected program is 'foo.py':

def bar(x,y,z=None) : pass
bar(1,a,bar)
bar(2,int)

the output of my script should be:
foo.bar(int,str,function)
foo.bar(int,type,NoneType)


I thought I go for sys.settrace() and achieved the following:

import sys
import types

def tracefunc(frame,event,arg) :
 if event is 'call' : return trace_call(frame,event,arg)
 else : return None

def trace_call(frame,event,arg) :
 code = frame.f_code
 scope = frame.f_locals
 try :
 print code.co_name+(+,.join(
 [ str(type(scope[var])).split(')[1]
 for var in code.co_varnames
 ]
 )+)
 except KeyError : pass
 return None

if __name__ == __main__ :
 prog = sys.argv[1]
 sys.argv.pop(0)
 sys.settrace(tracefunc)
 __import__(prog)


the output of the above example is:
bar(int,str,function)
bar(int,type,NoneType)

which is pretty close, but I need / would like to improve several 
things,
but have no idea how to do it:

1. I would like to have not only the name of the functions and type 
arguments
but their full package/module/class-path, e.g.
xml.dom.pulldom.PullDOM.clear
However, I cannot find a way from the frame object to the function 
object
where I could find the information.

2. The KeyError in my code is raised by the from XXX import statement:
from distutils import setup results in

  File tracetest.py, line 28, in ?
__import__(prog)
  File /Volumes/space/Users/harold/uni/pace/dpd/setup.py, line 1, 
in ?
from distutils.core import setup, Extension
  File tracetest.py, line 5, in tracefunc
if event is 'call' : return trace_call(frame,event,arg)
  File tracetest.py, line 12, in trace_call
print code.co_name+(+,.join(
  KeyError: 'setup'

does anyone know how I can circumvent this?

3. Is there any way to set the __name__ attribute for the inspected 
script to
__main__, so that tracing is really transparent?

4. finally, does a functionality like this already exist in the library 
or
did anyone of you come up with an implementation?

thanks,

- harold -


--
Military intelligence is a contradiction in terms.
-- Groucho Marx

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


Re: Dr. Dobb's Python-URL! - weekly Python news and links (Jun 29)

2005-07-04 Thread TZOTZIOY
On Sun, 03 Jul 2005 08:59:30 +1000, rumours say that John Machin
[EMAIL PROTECTED] might have written:

Neutral: no, they always seem to be active combatants.
Neuter: one would hope so, lest they procreate.

Thanks for the correction.  The first line of my sig is not completely
humourous, I believe you noticed :)
-- 
TZOTZIOY, I speak England very best.
Dear Paul,
please stop spamming us.
The Corinthians
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Will Guido's Python Regrets ever get implemented/fixed?

2005-07-04 Thread John Roth
Peter Maas [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 George Sakkis schrieb:
 Given that the latest 2.x python will be 2.9

 Why not 2.13 or 2.4711? Version strings are sequences of arbitrary
 integers separated by dots and not decimal numbers, or are they?

Because Guido said (somewhere) that he didn't want to go over
release 2.9.

John Roth

 -- 
 ---
 Peter Maas,  M+R Infosysteme,  D-52070 Aachen,  Tel +49-241-93878-0
 E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
 --- 

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


Re: f*cking re module

2005-07-04 Thread George Sakkis
jwaixs [EMAIL PROTECTED] wrote:

 Thank you for your replies, it's much obvious now. I know more what I
 can and can't do with the re module. But is it possible to search for
 more than one string in the same line?

 bv. I want to replace the python with  
 /python with \n and every thing that's not between the two python
 tags must begin with \nprint \\\ and end with n? Or do I
 need more than one call?

You can do it in one call, but it's ugly; as other have told you
already, use HTMLParser or some other parsing package. Now if you
insist...

regex = re.compile(r'''(?:
(?:python)
(.*?)  # group 1: inside tags
(?:/python)
) |# OR
([^]*)# group 2: outside tags
   ''', re.DOTALL | re.VERBOSE)

def replace(match):
g1,g2 = match.groups()
if g1:
return g1
else:
return '\nprint %s\n' % g2


text = '''this is pythona stupid
sentence/python but still I
pythonhave to/python write it.'''

print regex.sub(replace,text)

= Output ==

print this is 
a stupid
sentence
print  but still I

have to
print  write it.

===

George

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


Re: OT: ^ in redirection (windows)

2005-07-04 Thread Duncan Booth
Miki Tebeka wrote:

 Can someone explain me the difference between:
 echo 1  1.txt 21
 and
 echo 1  1.txt 2^1
 
 (Windows XP cmd shell)
 
 Both produce 1.txt with the content 1.
 
 (Sadly, I don't know how to search for ^ in google).
 

The first of these joins stderr to stdout, but since there is no output to 
stderr has no visible effect.

The second should prevent special treatment of the  character, but in this 
particular case actually has no effect.

You can see the effects more clearly if you redirect a handle which 
actually does have some output:

stdout redirected to stderr, but stderr still goes to console so no visible 
effect:

C:\tempecho hi 12
hi

stdout redirected to stderr, then stderr redirected to a file, but stdout 
still points at original stderr so no visible effect:

C:\tempecho hi 12 2x.txt
hi

stderr redirected to a file, then stdout redirected to same file. Output 
goes in a file:
C:\tempecho hi 2x.txt 12

C:\temptype x.txt
hi

Same as above. Using ^ to avoid special interpretation of the  has no 
effect:
C:\tempecho hi 2x.txt 1^2

C:\temptype x.txt
hi

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


Re: Unicode drives me crazy...

2005-07-04 Thread John Roth
[EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi !

 I want to get the WMI infos from Windows machines.
 I use Py from HU (iso-8859-2) charset.

 Then I wrote some utility for it, because I want to write it to an XML 
 file.

 def ToHU(s,NoneStr='-'):
if s==None: s=NoneStr
if not (type(s) in [type(''),type(u'')]):
   s=str(s)
if type(s)type(u''):
   s=unicode(s)
s=s.replace(chr(0),' ');
s=s.encode('iso-8859-2')
return s

 This fn is working, but I have been got an error with this value: 
 'Kommunik\xe1ci\xf3s port (COM1)'

 This routine demonstrates the problem

 s='Kommunik\xe1ci\xf3s port (COM1)'
 print s
 print type(s)
 print type(u'aaa')
 s=unicode(s) # error !

 This is makes me mad.
 How to I convert every objects to string, and convert (encode) them to 
 iso-8859-2 (if needed) ?

 Please help me !

As Tim Golden already explained, you're getting a unicode
object from the WMI interface. The best design help I can
give is to either convert it to iso-8859-2 at the point you
get the object and do your entire program with iso-8859-2
encoded strings, or do your entire program with unicode
objects and encode them as iso-8859-2 strings whenever
you want to write them out. Trying to do your conversion
in the middle will lead to excessive complexity, with the
resulting debugging problems.

If you do  go the unicode route, you must remember that
any method or function that's defined to return a string will
most likely throw an exception. This includes str()! Whether
or not the print statement will work depends on a number
of factors in how your Python installation was set up.

HTH

John Roth


 Thanx for help:
 ft

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


Re: Debugging embedded python

2005-07-04 Thread Miki Tebeka
Hello Fotis,

 I linked it to python24.lib (under eclipse cdt/win2k) and it compiles,
 links and runs fine.
 The problem is when I try to debug it (gdb). I cannot go single
 stepping into the code, more than one threads seem to be running, I get
 messages like No source file named d:/workspace/pyTest/main.cpp, and
 if I set a breakpoint to the function Fotis_root then I cannot see any
 variables. In fact I cannot see no stack, no registers nothing, within
 this function!
I *think* that you need to tell GDB where are the source directories (try
help dir)

HTH.
--

Miki Tebeka [EMAIL PROTECTED]
http://tebeka.bizhat.com
The only difference between children and adults is the price of the toys


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

Obtaining glyph width in Python

2005-07-04 Thread Charlie
Hi, I'm looking for a way to obtain the width of a string, either in actual
inches/centimeters, or pixels will also work.  Unfortunately this seems
difficult as I'd like to keep things as close to the stock Python install as
possible, and I'm not working with Graphics or X at all.  Here are the options
I've found, and why they're less than optimal for my use:

PIL = Huge for only using one function.  I'm not working with any graphics.
PyFT = Everyone uses FreeType2 now, and PyFT seems dead anyhow.
PyFT2 = Does not exist.
tkinter.text() = Works with X, creates windows no matter what you do.
t1lib = Separate package, no TTF support.
t1python = Same thing as t1lib?

Ultimately, I'm looking to take a stream of text, and break it up into lines
based on page width... and I need to know how wide (and ultimately how tall,
for page breaks) the individual glyphs are so I can break properly.  If there's
an easier way to do this than calculating individual glyph width, I'm open to
that too.

I was really just looking to see if there was anything out there that wasn't
too large or too obscure/dated.  Maybe there's something lower level that could
be done to achieve this?  Is there metadata in the font that holds this
information that could be extracted?

Thanks in advance,
-Charlie
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Connecting to Firebird database using Kinterbasdb+Python

2005-07-04 Thread Mathias Waack
Maurice LING wrote:

 I've been using FB1.5 and access the database using Kinterbasdb +
 Python. My connection is established using kinterbasdb.connect() method
 and the parameters host, dns, database, user, password are all defaulted
 to 'None'.
 
 On my own machine running Mac OSX 10.3, I can connect using the following:
 host = 'localhost'
 database = 'my path to FB database'
 user = 'user'
 password = 'password'
 
 At the same time, I can also connect if I set host=None on my machine.
 
 However, I cannot use 'localhost' on a shared Linux machine (not
 allowed. Don't ask why, system admin's mandate. And the Linux machine is
 without inetd). So when I set host=None, I get this error:

Just for my understanding: if you start your script on the machine hosting
the DB you're able to connect. If you start it on a different machine, you
are not able to connect without giving a hostname? Whats wrong with
offering the the name (or IP-address) of your MacOS-box instead of
'localhost' to the script?

Mathias

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


Re: Debugging embedded python

2005-07-04 Thread fotis
Thank's a lot miki for your response!

It seems that this problem is now solved, yet a new one now occured.
And the name of my new problem is...

Stack is not available: Cannot access memory at address 0x1.

Let me rewrite the code a little bit more clearly...

//***
// C O D E
//***
01
//___
02 // Includes mpla, mpla mpla...
03 #include Python.h
04 #include iostream
05 #include cmath
06 using namespace std;
07
08
//___
09 // My function
10 /* Return the sqrt of a double */
11 static PyObject* Fotis_root(PyObject *self, PyObject *args)
12 {
13double d=0;
14if(!PyArg_ParseTuple(args,d,d)) return NULL;
15return Py_BuildValue(d, sqrt(d));
16 }
17
18
//___
19 // Some python module stuff
20 static PyMethodDef FotisMethods[] = {
21 {root,Fotis_root, METH_VARARGS,
22  Return the root of a double.},
23 {NULL, NULL, 0, NULL}
23 };
24
25
//___
26 // Main program
27 int main(int argc,char** argv)
28 {
29  Py_Initialize();
30  Py_InitModule(fotis, FotisMethods);
31  PyRun_SimpleString(from fotis import root);
32  FILE* fp=stdin;
33  char *filename=Solver;
34  PyRun_InteractiveLoop(fp,filename); 35 Py_Finalize();
36  return 0;
37 }

Now lets say i set two breakpoints: line 29, and line 13. This is what
happens:
1. Breakpoint at line 29: There is a strange combination of next, step,
and other stuff that can move me from line 29 to line 34. No matter how
deeply I digged everywhere I cannot realy understand what really
happens there, but what the hack this is not what I'm really interested
in. by the way if i try too many steps then there is no way back...
2. Breakpoint at line 13: When I finally reach the much awaited line
34, the python interpreter is there and running and waiting for my
commands, which here is the fotis.root(double) command. when I give
though this command control is totally lost: i get the message
described above and after that everything seems to be dead. I really do
not know where I am, why am I there, and what exactly I am doing at the
point that I am.

What is really happening?
 
Any help will be very appreciated.
fotis._

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


Re: Obtaining glyph width in Python

2005-07-04 Thread Andreas Lobinger
Aloha,

Charlie wrote:
 Hi, I'm looking for a way to obtain the width of a string, either in actual
 inches/centimeters, or pixels will also work.  Unfortunately this seems
 difficult as I'd like to keep things as close to the stock Python install as
 possible, and I'm not working with Graphics or X at all. 

So you need both: metrics for single characters/glyphs and con-
catenated glyphs and words.

 PIL = Huge for only using one function.  I'm not working with any graphics.
 PyFT = Everyone uses FreeType2 now, and PyFT seems dead anyhow.
 PyFT2 = Does not exist.
 tkinter.text() = Works with X, creates windows no matter what you do.
 t1lib = Separate package, no TTF support.
 t1python = Same thing as t1lib?

For the glyph metrics and informations there is the ttx/fonttools
project on sourceforge available. Afiar fonttools only need a
Numeric installation.

 Ultimately, I'm looking to take a stream of text, and break it up into lines
 based on page width... and I need to know how wide (and ultimately how tall,
 for page breaks) the individual glyphs are so I can break properly.  If 
 there's
 an easier way to do this than calculating individual glyph width, I'm open to
 that too.

It looks like a little bit that you're redeveloping TeX (in python)...

 I was really just looking to see if there was anything out there that wasn't
 too large or too obscure/dated.  Maybe there's something lower level that 
 could
 be done to achieve this?  Is there metadata in the font that holds this
 information that could be extracted?

Actually there is not only meta but real data included in the font,
speaking of Type1, TrueType and OpenType scalable outline fonts.

Wishing a happy day
LOBI


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


Where can I get the new version of python-mode for emacs?

2005-07-04 Thread Marcio Rosa da Silva
Hi all,

My first try on using RST to write an email. so I can (will) make 
mistakes :-)

I am experiencing the problem shown in this thread_ of the 
`python-mode`_ discussion list hosted at SourceForge.

.. _thread: 
https://sourceforge.net/tracker/?func=detailatid=581349aid=1215039group_id=86916
.. _`python-mode`: http://sourceforge.net/projects/python-mode/

I have version 4.70 installed in my debian system (installed with 
apt-get, so I don't know where the sources are from). After reading the 
thread_ at sourceforge, I did a google search for python emacs and 
found the `Emacs goodies`_ page at python.org

.. _`Emacs goodies`: http://www.python.org/emacs/

where I was redirected to the `python-mode`_ page at SourceForge. There 
I could only find version 1.0alpha (4.6) (the one said too old in the 
thread_)

I also tried the `Barry Warsaw's Elisp packages`_ as suggested at `Emacs 
goodies`_ page for some more up-to-date versions of these files, but 
the link doesn't work.

.. _`Barry Warsaw's Elisp packages`: http://barry.warsaw.us/elisp/

So, *where can I find a newer version of emacs' python-mode*?

Thanks,

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


importing pyc from memory?

2005-07-04 Thread Derek van Vliet
Using the Python/C API, is there a way I can import a pyc file that I
have in memory (as opposed to loading from disk)?

I'm trying to save compiled python code in a proprietary file format to
cut reduce the overhead of compiling all my scripts when my app starts
up.

Derek

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


Re: Outlook COM: how to create a MailItem from a .msg file

2005-07-04 Thread Guy Lateur
Thanks for the tip, Simon, but unfortunately it doesn't work; it says The 
interface name 'MailItem' does not appear in the same library as object 
'win32com.gen_py.Microsoft Outlook 11.0 Object Library._DocumentItem 
instance at 0x29912600

Anything else I could try?

Cheers,
g




Simon Brunning [EMAIL PROTECTED] schreef in bericht 
news:[EMAIL PROTECTED]

Well, I don't know anything about Outlook's COM interface, so I don't
know if this will work, but you might try win32com.client.CastTo().
Something like:

my_MItem = win32com.client.CastTo(my_DItem, 'MItem')

-- 
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/ 


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


Re: python project layout

2005-07-04 Thread Peter Hansen
Huron wrote:
 Hi Peter,
 Thanks for you detailed reply.
 The layout that you suggest sounds wise to me (I'm about to start a
 project).

I wouldn't necessarily recommend something so complex (not that it's 
particular complex, but it's more than just flat) for a newcomer, 
however.  One of the few small issues you have to deal with in order to 
get such a layout working properly is the python path issue, and how 
to import modules that are in another folder.

Normally (aside from the standard library and extensions) only the 
current directory is in sys.path.  Any subfolders that contain 
__init__.py modules are packages and you can import from them using 
the dotted notation (e.g. import mypkg.mymodule will try to load a 
file from ./mypkg/mymodule.py if there is also a ./mypkg/__init__.py 
(even if that file is empty!)).

To import a module in the *parent* directory, however, is another story 
entirely.  You need to get it added to the sys.path, and that's one of 
the things done (dynamically) by our test utilities, so we can be in the 
tests subfolder and type story015.py and have it load modules in the 
parent folder.

So in short, start simple and let your layout evolve as you need it to. 
  Don't try to start with a more complex layout than you need or know 
how to handle.  And if you're using a revision control system like 
Subversion (and you better be using something! :-) ) then it's an easy 
matter to rename or move folders at a later time, without losing your 
revision history.

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


Re: Determining actual elapsed (wall-clock) time

2005-07-04 Thread Peter Hansen
Coates, Steve (ACHE) wrote:
 
 There is already an NTP client in the ASPN cookbook :-
 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/117211

Thanks Steve.  As it turns out, Windows XP already has support (via NTP 
I presume, though of course since this is Microsoft they try to keep the 
user base ignorant by making no mention of that even in the help page) 
for keeping the clock accurate, right on the last tab (labelled 
Internet Time) of the Date and Time Properties dialog.

And on Linux, of course, this is already a trivial matter.

With what Tim clarified about time.time(), it will be quite sufficient 
when used in conjunction with a threatened slap on the wrist (or a label 
on the side of the monitor) for any user who tries to change the 
clock...  (Thanks, Tim!  time.time() makes sense finally.)

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


Re: curses -- getxy() error

2005-07-04 Thread shablool
Thanks! (silly me)

[EMAIL PROTECTED] wrote:
 shablool wrote:
  Could someone please explain why stdscr.getxy() always raise an
  exception:
 [code here]
 the method is named getyx(), this is old unix heritage.
 see http://www.python.org/doc/2.0.1/lib/curses-window-objects.html

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


Re: Determining actual elapsed (wall-clock) time

2005-07-04 Thread Roy Smith
Peter Hansen [EMAIL PROTECTED] wrote:
 As it turns out, Windows XP already has support (via NTP 
 I presume, though of course since this is Microsoft they try to keep the 
 user base ignorant by making no mention of that even in the help page) 
 for keeping the clock accurate, right on the last tab (labelled 
 Internet Time) of the Date and Time Properties dialog.

Sigh.  Unfortunately, it's not just MS.  Apple does the same thing.  In the 
Date  Time control panel, there's an option to Set Date  Time 
Automatically.  What it's doing is turning on NTP, but it doesn't say that 
(even in the help text).

In this case, it was pretty easy to guess (and verify with tcpdump), but 
sometimes it's really infuriating when software providers eschew the use of 
technical terms for easy to understand plain english to the point of 
making it impossible to figure out what's really going on.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-04 Thread Tom Anderson
On Sun, 3 Jul 2005, Robert Kern wrote:

 Erik Max Francis wrote:
 Ron Adam wrote:
 
 So you are saying that anything that has a 1% use case should be included 
 as a builtin function?
 
 I think I can find a few hundred other functions in the library that are 
 used more than ten times as often as reduce.  Should those be builtins 
 too?
 
 This is a practical over purity issue, so what are the practical reasons 
 for keeping it.  It's already there isn't a practical reason.  And it 
 covers 100% of it's own potential use cases, is circular logic without a 
 real underlying basis.
 
 But the Python 3000 plan, at least what we've heard of it so far, isn't 
 to move it to a standard library module.  It's to remove it altogether, 
 replacing it with sum and product.  Since sum and product don't cover 
 all the uses cases for reduce, this is a case of taking one function 
 that handles all the required use cases and replacing it with _two_ 
 functions that don't.  Since it's doubling the footprint of the reduce 
 functionality, arguments about avoiding pollution are red herrings.

 Four, in fact. sum(), product(), any(), and all().

I'll just chip in and say i'd quite like a flatten(), too; at the moment, 
i have one like this:

def flatten(ll):
return reduce(lambda a, l: a.extend(l), ll, [])

A builtin, which had fast special-case code for then the argument is a 
list of lists (rather than an iterable of iterables), would be nice, since 
this is a reasonably big use of reduce for me.

How would one do that as a list comp, by the way? I'm really not very good 
with them yet.

 [1] Okay, there was that guy who predicted that list comprehensions and 
 first-class functions were the next to go. That was new. But also wrong. 
 I think we can discount that.

True. Guido will only get rid of those after he's got rid of lowercase 
letters in identifiers.

tom

-- 
A military-industrial illusion of democracy
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: When someone from Britain speaks, Americans hear a British accent...

2005-07-04 Thread Nick Efford
Grant Edwards [EMAIL PROTECTED] wrote:
 I'm an American who grew up watching plenty of BBC, and I run
 into afew native Londoners whom I have hard time understanding.
 I don't ever remember having troubly understanding people
 outside the city.

But have you encountered regional dialects? - e.g. from the north
of the country, where you get both a strong accent, very different
from London speech, and the use of different words.

For example, folk in parts of the north-east will say canny
instead of careful, gannin instead of going,  bonny lass
instead of pretty girl.  The question Do you know what I mean?
expressed phonetically in Geordie (one of the north-eastern dialects)
becomes Ya knaa what ah mean, leik?


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


Re: Accepted Summer of Code proposals

2005-07-04 Thread A.M. Kuchling
On Fri, 1 Jul 2005 14:22:51 -0400, 
Terry Reedy [EMAIL PROTECTED] wrote:
 Thanks for posting this and thanks for coordinating the PSF effort. 

I did little beyond writing up that wiki page.  David Ascher 
has been the primary coordinator for the PSF.

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


Re: curses -- getxy() error

2005-07-04 Thread Peter Hansen
shablool wrote:
 Hi,
 Could someone please explain why stdscr.getxy() always raise an
 exception:

If you post the exception traceback here (the whole thing, cut and 
pasted from your terminal window), we can show you how to analyze it to 
determine for yourself exactly what the problem is.  This will help you 
in the future, even if k33rni's answer solves your immediate problem...

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


Re: math.nroot [was Re: A brief question.]

2005-07-04 Thread Tom Anderson
On Sun, 3 Jul 2005, Dennis Lee Bieber wrote:

 On Sun, 3 Jul 2005 20:53:22 +0100, Tom Anderson [EMAIL PROTECTED]
 declaimed the following in comp.lang.python:

2
 -1

 Evaluates to -1?

   But what do you expect, say

   2
 -X

 to evaluate as? (-X)^2 or -(X^2)

   I'd expect the latter...

I think you've got me there.

 I see the problem here as an assumption that -1 is an entity in its 
 own right, and not an operation of negating a 1, whereas -X is the 
 entity X being negated.

I think you're entirely correct. I'm not entirely sure that that 
assumption is wrong, but never mind.

Anyway, it looks like i should really be filing a bug report with the 
International Mathematical Union about this, rather than whingeing about 
it here.

tom

-- 
A military-industrial illusion of democracy
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: math.nroot [was Re: A brief question.]

2005-07-04 Thread Tom Anderson
On Sun, 3 Jul 2005, Tim Peters wrote:

 [Tom Anderson]
 So, is there a way of generating and testing for infinities and NaNs
 that's portable across platforms and versions of python?

 Not that I know of, and certainly no simple way.

 If not, could we perhaps have some constants in the math module for them?

 See PEP 754 for this.

Looks perfect.

 Read the manual for the precedence rules.  -x**y groups as -(x**y). 
 -1.0 is the correct answer.  If you intended (-x)**y, then you need to 
 insert parentheses to force that order.

 So i see. Any idea why that precedence order was chosen? It goes against
 conventional mathematical notation, as well as established practice in
 other languages.

 Eh?  For example, Fortran and Macsyma also give exponentiation higher 
 precedence than unary minus.  From my POV, Python's choice here was 
 thoroughly conventional.

I guess you're right. What really threw me is that in all the other 
languages i know (which is not many, i admit), -1 is a literal -1, not a 
literal 1 plus a unary minus.

 Also, would it be a good idea for (-1.0) ** 0.5 to evaluate to 1.0j? It
 seems a shame to have complex numbers in the language and then miss this
 opportunity to use them!

 It's generally true in Python that complex numbers are output only if 
 complex numbers are input or you explicitly use a function from the 
 cmath module. [...] The presumption is that a complex result is more 
 likely the result of program error than intent for most applications. 
 The relative handful of programmers who expect complex results can get 
 them easily, though.

A reasonable presumption.

I always got really wound up that the calculator i had at school had this 
behaviour too, *even in complex number mode*! Come to think of it, i don't 
think it could do roots of imaginary numbers at all. However, python is 
not a calculator.

tom

-- 
A military-industrial illusion of democracy
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: ^ in redirection (windows)

2005-07-04 Thread Bengt Richter
On 4 Jul 2005 13:07:02 GMT, Duncan Booth [EMAIL PROTECTED] wrote:

Miki Tebeka wrote:

 Can someone explain me the difference between:
 echo 1  1.txt 21
 and
 echo 1  1.txt 2^1
 
 (Windows XP cmd shell)
 
 Both produce 1.txt with the content 1.
 
 (Sadly, I don't know how to search for ^ in google).
 

The first of these joins stderr to stdout, but since there is no output to 
stderr has no visible effect.

The second should prevent special treatment of the  character, but in this 
particular case actually has no effect.

You can see the effects more clearly if you redirect a handle which 
actually does have some output:

stdout redirected to stderr, but stderr still goes to console so no visible 
effect:

C:\tempecho hi 12
hi

stdout redirected to stderr, then stderr redirected to a file, but stdout 
still points at original stderr so no visible effect:

C:\tempecho hi 12 2x.txt
hi

stderr redirected to a file, then stdout redirected to same file. Output 
goes in a file:
C:\tempecho hi 2x.txt 12

C:\temptype x.txt
hi

Same as above. Using ^ to avoid special interpretation of the  has no 
effect:
C:\tempecho hi 2x.txt 1^2

C:\temptype x.txt
hi

You'd think ^ would be mentioned in

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/redirection.mspx
but it seems not to be.

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


wxPy + Py2Exe + sys.argv[0]

2005-07-04 Thread [EMAIL PROTECTED]
Hi !

I have been finished my WMI information getter simple application, but 
the exe is not working as like the py modules before compilation.

The problem that when I started the program from CMD, the sys.argv is 
show the good path (in my machine the c:\dev\...) from Dialog1.py.
But when I compile it with Py2Exe, and try to start the exe, it has been 
not found the hwinfo.ini file what store the setup informations of the 
program.
This file is write by my hand, and I place it with Dialog1.exe (in same 
directory).

But the compiled exe is not use the good path... It use / only.

When I started it from CMD with Dialog1.exe, it hasn't been found the 
ini file:

Traceback (most recent call last):
  File Dialog1.py, line 269, in ?
  File Dialog1.py, line 201, in LoadIniFile
IOError: [Errno 2] No such file or directory: '/hwinfo.ini'

When I use full path: c:\dev\\Dialog1.exe, it have been found 
everything, and working good.
I don't understand it, because I working with sys.argv[0], with this method:

def LoadIniFile():
s=os.path.dirname(sys.argv[0])+'/hwinfo.ini'
f=open(s,'r')
l=(f.read()).split('\n')
d={}
for s in l:
if s.find('=')-1:
   sl=s.split('=')
   sl[0]=sl[0].strip().lower()
   sl[1]=sl[1].strip()
   d[sl[0]]=sl[1]
return d

So that folder is must be correct !

Why I get error ? What I can do if I want to use it as normal py ?

Thanx for help:
   ft

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


Re: map/filter/reduce/lambda opinions and background unscientificmini-survey

2005-07-04 Thread Peter Hansen
Terry Hancock wrote:
 On Sunday 03 July 2005 07:05 pm, Erik Max Francis wrote:
I personally think that map looks clearer than a list comprehension for 
a simple function call

 This on the other hand,
  [str(x) for x in sequence]
 is practically plain English:
 
 call the function str on x, for every x in sequence
 
 Other than chopping out a few words, and using the () operator instead
 of call, it's hard to imagine this being any closer to exactly what you
 would say to describe the operation. And for most of us, English comes
 easier than Computer Science jargon.

And with a better choice of names than x, that line becomes even more 
self-documenting.

[str(parrot) for parrot in sequence], for example, tells you much more 
about what is going on than str(x) does.

Exactly what, I have no idea... but it says _so_ much more. ;-)

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


missing cephes module

2005-07-04 Thread Justin
Hi All:


When I used py2exe to create executable file, "cephes" module missingerror occurred.I have installed python 2.3 and scientific and numeric python.Can anybody suggest me how to resolve the problem?

Justin
		Yahoo! Mail Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone.-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Where can I get the new version of python-mode for emacs?

2005-07-04 Thread Skip Montanaro

Marcio I have version 4.70 installed in my debian system (installed
Marcio with apt-get, so I don't know where the sources are from). After
Marcio reading the thread_ at sourceforge, I did a google search for
Marcio python emacs and found the `Emacs goodies`_ page at python.org

Marcio .. _`Emacs goodies`: http://www.python.org/emacs/

Marcio where I was redirected to the `python-mode`_ page at
Marcio SourceForge. There I could only find version 1.0alpha (4.6) (the
Marcio one said too old in the thread_)

I haven't done a release in a long while.  Guess it's about time to do that
again.  In the meantime, you can download the currently most recent version
of python-mode.el from here:


http://cvs.sourceforge.net/viewcvs.py/*checkout*/python-mode/python-mode/python-mode.el?rev=4.75

You can browse all the files in the CVS repository here:

http://cvs.sourceforge.net/viewcvs.py/python-mode/python-mode/

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


Re: curses -- getxy() error

2005-07-04 Thread [EMAIL PROTECTED]
Peter Hansen wrote:
 post the exception traceback here[...], we can show you how to analyze it to
 determine for yourself exactly what the problem is

true, remember that for the future. and that goes to everybody asking
questions here. thing is, I've done enough curses programming (in both
Python and C) to see this particular issue immediately, without the
need for a traceback. :)

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


Re: OT: ^ in redirection (windows)

2005-07-04 Thread Duncan Booth
Bengt Richter wrote:

 You'd think ^ would be mentioned in
 http://www.microsoft.com/resources/documentation/windows/xp/all/pro
 ddocs/en-us/redirection.mspx 
 but it seems not to be.
 

You mean you didn't think to look at 

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_shelloverview.mspx
 ?

(or from Help  Support centre in Windows search on 'shell' to get to the same 
page).

I think the point is that the ^ escape isn't part of the redirection syntax, 
it is only useful when you want to not redirect (or not have multiple commands 
on 
one line), so it isn't really obvious where it should be documented. That said, 
they have done a pretty good job of hiding it.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python project layout

2005-07-04 Thread Huron
 A concrete example would probably help.  What are you envisioning?

Let say you have an interface (zope.interface) IMyProduct and two 
classes
implementing the interface MyProduct1 and MyProduct2 ... 
But I think I found the answer. One file each.
Python is just more flexible than java in the sens that you dont NEED 
to do
one class = one file 

-- h

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


Re: What are the other options against Zope?

2005-07-04 Thread phil

 It's an object oriented database, with a structure that is similar to 
 files and directories in an ordinary OS.
 
 But it is a lot smarter, because the files and directories are actually 
 objects with different attributes and parameters.
 
 The methods on these objects can then be called eg. from a web browser 
 with different parameters. But you can also use other protocols than 
 http like dav, ftp etc.


Well, that's interesting.  I've never seen an explantion like
this.
Actually I think I have, and was too dumb to realize what
I was reading.

A data base with properties and methods. Cool.


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


Re: unittest: collecting tests from many modules?

2005-07-04 Thread Jorgen Grahn
On 12 Jun 2005 10:14:50 GMT, Jorgen Grahn [EMAIL PROTECTED] wrote:

[regarding module unittest]

 What's the best way of creating a test.py which
 - aggregates the tests from all the test_*.py modules?
 - doesn't require me to enumerate all the test classes in test.py
   (forcing each module to define test_foo.theSuite or someting would
   be OK though)
 - retains the ability to select tests and verbosity (-q, -v) from the
   command line?

Thanks for all the input. Three weeks later I stumble across this thread
again and notice I didn't report what I ended up with.  I ended up doing the
thing I wanted to avoid in the first place: hardcoding everything.

import unittest

import test_bibdb
import test_citefmt
import test_person
import test_refsfmt

suite = unittest.TestSuite()
suite.addTest(test_bibdb.suite())
suite.addTest(test_citefmt.suite())
suite.addTest(test_person.suite())
suite.addTest(test_refsfmt.suite())

if __name__ == __main__:
unittest.TextTestRunner(verbosity=2).run(suite)

My test modules are, after all, a fairly fixed set, and if I want to run
specific tests, or with a specific verbosity, I can execute the individual
test modules.

BR,
/Jorgen

-- 
  // Jorgen Grahn jgrahn@   Ph'nglui mglw'nafh Cthulhu
\X/algonet.se   R'lyeh wgah'nagl fhtagn!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: map/filter/reduce/lambda opinions and background unscientific mini-survey

2005-07-04 Thread George Sakkis
Tom Anderson [EMAIL PROTECTED] wrote:

 I'll just chip in and say i'd quite like a flatten(), too; at the moment,
 i have one like this:

 def flatten(ll):
   return reduce(lambda a, l: a.extend(l), ll, [])

This doesn't work; a.extend() returns None, not the extended list a:

 seq = [[1,2],[3],[],[4,[5,6]]]
 flatten(seq)
AttributeError: 'NoneType' object has no attribute 'extend'

This works for 1-level flattening:

def flatten(ll):
return reduce(lambda a, l: a.extend(l) or a, ll, [])

 flatten(seq)
[1, 2, 3, 4, [5, 6]]

And finally for recursive flattening:

def flatten(seq):
return reduce(_accum, seq, [])

def _accum(seq, x):
if isinstance(x,list):
seq.extend(flatten(x))
else:
seq.append(x)
return seq

 flatten(seq)
[1, 2, 3, 4, 5, 6]


George

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


Re: How do you program in Python?

2005-07-04 Thread bruno modulix
Roy Smith wrote:
 bruno modulix [EMAIL PROTECTED] wrote:
 
 
Try Emacs + python-mode. Emacs surely has a lot of warts, but I'm still
looking for a better and more versatile code editor/IDE - specially when
it comes to languages with REPL (- Read-Eval-Print Loop).
 
 
 When you build Python, make sure you build it with Gnu readline support.  
 Then you can just fire up an interpreter, and use emacs (or, I suppose, vi) 
 editing commands to scroll back through (and change) your input history.  
 It's not as good as a real IDE, but it's still very handy for quick 
 explorations.
 
 The next step up would be to run a real emacs, do M-X shell, then fire up a 
 Python interpreter inside that.
 
 Or, go into split screen mode in emacs, editing your python source file in 
 one window and running a shell in the other.  Edit some code in the source 
 window, and it takes about 6 keystrokes to save it, flip to the other 
 window, and re-run the file (you can get it down to a single keystroke by 
 defining a simple macro and binding it to a function key).

Err... actually, using python-mode is *way* more simple:

[ctrl+c ! to launch the REPL (this splits the frame) if it's not already
running]
[ctrl+x o to go back to the source code buffer]

then

ctrl+c ctrl+c to execute the whole buffer in the REPL
or
select a region then ctrl+c ctrl+l to execute the selected region in the
REPL

Of course, the REPL now reflect any changes made into the source code
buffer (even if changes have not been saved) !-)


-- 
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: noob question

2005-07-04 Thread Jorgen Grahn
On Sun, 26 Jun 2005 03:36:58 -0400, Chinook [EMAIL PROTECTED] wrote:
...
 Here is something I copied from somewhere (someone else might know the 
 source):

 Summary of Naming Conventions
...

 Hope it does not come out too jumbled,

It did, but it seemed so useful that I repost it with minor changes and
proper formatting:

Summary of Naming Conventions


Type Convention   Example
-
function action_with_underscores find_all
variable noun_with_underscores curr_index
constant NOUN_ALL_CAPS  ALLOWED_RNA_PAIRS
classMixedCaseNounRnaSequence
public property  MixedCaseNoun   IsPaired
private property _noun_with_leading_underscore_is_updated
public methodmixedCaseExceptFirstWordVerb stripDegenerate
private method   _verb_with_leading_underscore   _check_if_paired
really private data  __two_leading_underscores __delegator_object_ref
parameters matching property SameAsProperty __init__(data, Alphabet=None)
factory function MixedCaseInverseDict
module   lowercase_with_underscores unit_test
-

Note that calling 'IsPaired' and '_is_updated' a noun is clearly wrong.
There are probably other problems with it, too.

/Jorgen

-- 
  // Jorgen Grahn jgrahn@   Ph'nglui mglw'nafh Cthulhu
\X/algonet.se   R'lyeh wgah'nagl fhtagn!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A question for profile

2005-07-04 Thread slchen
Sorry~~
I found the problem~~
There is an error profile.pyc in the same folder.
some it execute error.

thanks a lot!

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


Re: missing cephes module

2005-07-04 Thread Robert Kern
Justin wrote:
 Hi All:
  
 When I used py2exe to create executable file, cephes module missing
  error occurred. 
 I have installed python 2.3 and scientific and numeric python. 
 Can anybody suggest me how to resolve the problem?

Did you try what I suggested the last time you posted this question here?

-- 
Robert Kern
[EMAIL PROTECTED]

In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die.
   -- Richard Harter

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


Re: Will Guido's Python Regrets ever get implemented/fixed?

2005-07-04 Thread Rocco Moretti
John Roth wrote:
 Peter Maas [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
 
 George Sakkis schrieb:

 Given that the latest 2.x python will be 2.9


 Why not 2.13 or 2.4711? Version strings are sequences of arbitrary
 integers separated by dots and not decimal numbers, or are they?
 
 
 Because Guido said (somewhere) that he didn't want to go over
 release 2.9.

It's actually (repeated) in the talk linked to earlier. The rationale is 
not touched on, though.

George Sakkis wrote:
 Given that the latest 2.x python will be 2.9 and that 3.0 may be
 released in parallel with 2.5-2.9
 (http://www.python.org/doc/essays/ppt/euro2004/euro2004.ppt), I guess
 this *someday* will be no later than 2015-16, probably sooner than
 that.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: importing pyc from memory?

2005-07-04 Thread Sybren Stuvel
Derek van Vliet enlightened us with:
 I'm trying to save compiled python code in a proprietary file format
 to cut reduce the overhead of compiling all my scripts when my app
 starts up.

Why is that faster than having the .pyc files ready on your
filesystem? And why do you want it in a proprietary file format?

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


  1   2   >