Re: ZODB memory problems (was: processing a Very Large file)

2005-05-22 Thread Steve M
 class ExtendedTupleTable(Persistent):
def __init__(self):
self.interning = ObjectInterning()

# This Set stores all generated ExtendedTuple objects.
self.ets = Set() # et(s): ExtendedTuple object(s)
# This dictionary stores a mapping of elements to Sets of
# ExtendedTuples.
# eg: self.el2ets[3] = Set([(1,2,3), (3,4,5), (1,3,9)])
# self.el2ets[4] = Set([(3,4,5), (2,4,9)])
self.el2ets = {}  # el: element of an ExtendedTuple object

###

Note: I might be wrong. I say this here instead of qualifying every
assertion below. Thank you.

If you want more fine-grained swapping-out to disk, you might want to
look at the classes provided by the BTrees modules that come with ZODB.
Built-in container classes like set and dictionary are effectively
opaque to ZODB - they have to be loaded into memory or out to disk as
one whole unit, container and contents. This is true for the Persistent
versions of the containers as well - these are special mostly because
they automatically detect when they are modified.

In order to have some contents of a container pickled out to disk and
others available in memory, you should use BTrees:

>>> root = get_zodb_root_container()
>>> from BTrees import IOBTree
>>> root['el2ets'] = el2ets = IOBTree.IOBTree()
>>> transaction.commit()
>>> el2ets[3] = Set([(1,2,3), (3,4,5), (1,3,9)])
>>> transaction.commit()

IOBTree means that its designed to have integer keys and arbitrary
object values. OOBTree means you can use arbitrary objects (e.g.
tuples) as keys. I read that you should avoid using instances of
subclasses of Persistent as keys in BTrees unless you are very careful
implementing __cmp__(); instead confine your keys to objects
constructed from immutable python types, e.g., strings, tuples, tuples
of strings, ...

If you break down the persistent chunks into small enough pieces and
use the transaction commit and abort appropriately (that takes some
experimenting - e.g., on a read-only loop through every element of a
large BTree, I was running out of memory until I called
transaction.abort() every loop), you should max out your memory usage
at some reasonable amount (determined by cache size) no matter how big
your BTree grows.

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


GridCellEditor

2005-05-22 Thread gralex
Hi,all!

How i can manually start CellEditor in wxGrid for spicified Cell in grid in 
my programm:

mygrid.SetGridCursor(2,3)
mygrid.MakeCellVisible(2,3)
# starting editing... ??
mygrid.ShowCellEditControl() don't working...

help me, please... 


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


Re: Is Python suitable for a huge, enterprise size app?

2005-05-22 Thread Paul Rubin
Dave Brueck <[EMAIL PROTECTED]> writes:
> >>m2crypto (plus some patches to make asynchronous SSL do what we needed).
> > That seems to be a nice piece of code, but it's still at version
> > 0.13;
> 
> Version numbers are fairly relative, though. In another project we're
> using some proprietary, closed source libraries (unrelated to crypto)
> that are version 3 and they seem buggier and less stable than m2crypto.

Yeah, OpenSSL itself is something like 0.97, which however does sound
closer to a final release than 0.13 of anything.

> Having said that - I think we probably *would* use it for production
> financial transactions - but that's more a matter of closed vs. open
> source than Python vs not.

That makes some sense; once you have the code in-house and the
expertise to evaluate it and maintain it, it's at least no worse than
something you wrote yourself.  If you just downloaded it and plopped
it into your application with your eyes closed, that might be asking
for trouble.

> > There's also been some traffic on the
> > python-crypto list about Zope encountering memory leaks with it.
> 
> Ok... so? I mean, if there's a memory leak, and it's hurting us, we
> have options: ...

I just mean the memory leak is a symptom that the software isn't yet
completely debugged.

> Memory leaks aren't exactly unique to Python - according to
> bugs.sun.com, there are currently 382 *open* bugs related to memory
> leaks in the JDK alone. 

Are any of those memory leaks in JSSE?  It's one thing to have a
problem in some noncritical GUI widget, another to have it in the
crypto code.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Self-modifying Code

2005-05-22 Thread Steven D'Aprano
On Thu, 19 May 2005 21:49:46 +0200, Do Re Mi chel La Si Do wrote:

> Hi, you, also !
> 
> A view, with a little difference :
> 
> 
> def titi(par):
> if par>222:
> return par*2
> else:
> return par*10
> 
> print titi(123)
> print titi(1234)
> 
> #now, change the function, "on instant"
> txt="""def titi(par):
> if par>222:
> return str(par)*2
> else:
> return str(par)*5
> """
> exec(txt,globals(),globals())
> 
> print titi(123)
> print titi(1234)


Self-modifying code is almost always a TERRIBLE idea. Using exec is
dangerous unless you can control what is being executed. Using exec on
code a user supplies is a huge security hole. 

Self-modifying code is one of those ideas that seems cute when you first
learn about it, but in practice is a bad idea. It makes debugging your
code much more difficult. It makes comprehending how your code works
harder. Generally, you should avoid it, and shun code that modifies itself.

Having said that, here is a good example of self-modifying code:

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

The RingBuffer class dynamically modifies itself once it is full so that
its behaviour changes.


-- 
Steven 



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


Re: Python Polymorphism

2005-05-22 Thread Joal Heagney
Fredrik Lundh wrote:
> (I do find this new "I'm going to nitpick on single sentences, no matter
> what context they appears in" trend a bit boring, frankly.  if you think
> that a statement may be misinterpreted, add a clarification or a footnote.
> don't assume that you're the only one who know how things work).

Agree. It also seems to be part of a general trend of increased 
flaming/bickering in comp.lang.python over the last half-decade.

When I started frequenting the python newsgroup a couple of years ago, I 
noticed the big difference between it and other newsgroups was a 
willingness to help others to learn and an awareness that "We were all 
once beginners."

Yes, I know the (present) argument behind that is:
"Why should I have to explain the same things 1000x over to people who 
can't use Google or read the tutorials.", but back in 1999-2000, the 
solution the community had informally settled on, was for people to help 
those just below them in experience/proficiency. (Including politely 
pointing others to Google or the Tutorials.)

The "elites" helped the "powerusers".
The "powerusers" helped the "medium-term users."
The "medium-term users" helped the "year-long users" and
The "year-long users" helped the "newbies".

Rather than condescendingly blast someone for asking a "newbie" 
question, nearly everyone but the "year-long users" would just ignore 
the question, knowing that the "newbies" would get help from someone who 
may have only learnt the solution one or two months ago. As a result, 
new users were quickly brought into the group and up to speed, and they 
often had the desire to now help others who encountered the same problem.

"Gee, _fred_ really helped me out there, without making me feel like a 
complete idjit. Oh, somebody is asking the same problem. Rather than 
waste _fred_'s time repeating himself, I know enough that I can cover 
this question."

So in the interest of restoring the pleasantness and cooperation I 
experienced when I first joined, I ask that people do the following:

"If you're sick of answering newbie questions, and don't think you can 
do so politely, for the sake of the community, DON'T!"

You're not that necessary.

Joal Heagney

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


Re: Is Python suitable for a huge, enterprise size app?

2005-05-22 Thread Joal Heagney
Peter Hansen wrote:
> Maurice LING wrote:
> 
>> It makes big difference (legally) to if the codes are there and 
>> someone sees it, to if the codes are locked in some packaged or zipped 
>> form and someone reverse-engineer it. It is legally as different as if 
>> you drop money on the ground and I pick it up, to pick-pocketing you 
>> and take the money.
>>
>> Nobody seems to be able to understand this simple logic.
> 
> 
> So you're saying that reverse engineering Java bytecode is illegal, 
> while doing the same with Python bytecode is not?  Or something like 
> that?  (And you're a lawyer, right?  Because if you're not, and you're 
> not citing your sources, why is it we should put any value in these 
> comments about what is (legally) true?)
> 
> -Peter

I think he's saying that if you distributed your python code as 
byte-compiled module.pyc or module.pyo form, rather than ascii-text 
module.py form, it would be harder for a reverse-engineer to say "But I 
was JUST looking at it!". Especially when the lawyers are involved.

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


A newbie metaclass question

2005-05-22 Thread could ildg
When I try to learn metaclass of python by article at this place:
http://www.python.org/2.2/descrintro.html#metaclasses,
I changed the autosuper example a little as below:

class autosuper(type):
def __init__(cls,name,bases,dict):
super(autosuper,cls).__init__(name,bases,dict)
setattr(cls,"_%s__super" % name, super(cls))
print "in metaclass: ", super(cls)

class A:
__metaclass__ = autosuper
def meth(self):
print "in class A: ", self.__super

a=A()
a.meth() 

The result is as below:
in metaclass:  , NULL>
in class A:  , >

The 2 line are not the same. Why? Is this because that instance a has not
been created when the __init__ of the metaclass is called? If the cls in the
__init__ method is not an instance of A, what is it?

The metaclass of python is kinda difficult for me. Thanks for your help.
-- 
http://mail.python.org/mailman/listinfo/python-list


install python 2.4.1

2005-05-22 Thread [EMAIL PROTECTED]
hi,

I use python 2.4 and
I would like to install python 2.4.1. Is it necessary to uninstall the
first version or just install 2.4.1?

Does it effect pydef (eclipse editor) or komodo ide ?

pujo

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


Re: install python 2.4.1

2005-05-22 Thread vincent wehren

<[EMAIL PROTECTED]> schrieb im Newsbeitrag 
news:[EMAIL PROTECTED]
| hi,
|
| I use python 2.4 and
| I would like to install python 2.4.1. Is it necessary to uninstall the
| first version or just install 2.4.1?

What platform? If you're on Windows and are using the msi-Installer, 
uninstalling is recommended.
It will also work without uninstalling, but IIRC, Windows Installer will 
zealously inspect the file version
of each individual file down the Python24 tree to detect necessary disk 
space and so forth, which can take quite some time.


|
| Does it effect pydef (eclipse editor) or komodo ide ?

Don't know..

--
Vincent Wehren

|
|
| pujo
| 


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


Re: install python 2.4.1

2005-05-22 Thread [EMAIL PROTECTED]
I use win xp pro.
I wonder about this new version of python because I use Nummeric, pyro,
 combine with komodo and pydev ide in my python 2.4.
If there is compatibility isue with the new version, it is better for
me not to install the new version.

Sincerely Yours,
pujo

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


Newbie python design question

2005-05-22 Thread Michael
Hi,
I'm trying to write a script to parse a .cpp file and begin to create a
'translational unit'.
To do this i need to:

Go through the file and remove all 'C' comments as
/* Comment 1*/
(can be on multiple lines)

Go through and remove all 'C++' comments, anything between // and '\n' char.

The start at the top, and work the way through, with the following valid
terms:

#include 
#include "filename"
- copy the contents of filename to this point in the file and continue.

#define X Y
-Store the term X,Y in DefineDictionary, then later if X is encountered,
substitute Y.

namespace n
{

};
-a  namespace, can contain classes, functions and sub-namespaces

class c
{


};
-a class.


If i were to process this in C++, i would create some form of statemachine,
similar to a regex engine... I would just like some ideas on the easiest way
to implment this in python!!

Regards

Mike


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


Re: Newbie python design question

2005-05-22 Thread Philippe C. Martin
Hi,

I C I usually use switch for my FSMs, in Python however I usually use if +
elif 

Your question makes me realize it would be trivial to use a dictionnary in
case the FSM had too many states, the key being the state and the item the
method to handle the state.

Regards,

Philippe






Michael wrote:

> Hi,
> I'm trying to write a script to parse a .cpp file and begin to create a
> 'translational unit'.
> To do this i need to:
> 
> Go through the file and remove all 'C' comments as
> /* Comment 1*/
> (can be on multiple lines)
> 
> Go through and remove all 'C++' comments, anything between // and '\n'
> char.
> 
> The start at the top, and work the way through, with the following valid
> terms:
> 
> #include 
> #include "filename"
> - copy the contents of filename to this point in the file and
> continue.
> 
> #define X Y
> -Store the term X,Y in DefineDictionary, then later if X is
> encountered,
> substitute Y.
> 
> namespace n
> {
> 
> };
> -a  namespace, can contain classes, functions and sub-namespaces
> 
> class c
> {
> 
> 
> };
> -a class.
> 
> 
> If i were to process this in C++, i would create some form of
> statemachine, similar to a regex engine... I would just like some ideas on
> the easiest way to implment this in python!!
> 
> Regards
> 
> Mike

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


Re: passing arguments

2005-05-22 Thread Philippe C. Martin
Hi,

look at sys.argv

Regards,

Philippe


Jeff Elkins wrote:

> I'm sure this is obvious, but how the heck do pass an argument(s) to a
> python script from the command line?
> 
> Thanks,
> 
> Jeff Elkins

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


Re: python24.zip

2005-05-22 Thread Steve Holden
Robin Becker wrote:
> Dieter Maurer wrote:
[...]
> 
> I think this was my intention, but also I think I have some concern over
> having two possible locations for the standard library. It seems non pythonic
> and liable to cause confusion if some package should manage to install
> python24.zip while I believe that python24\lib is being used.
> 
> 
>>I recently analysed excessive import times and
>>saw thousands of costly and unneccesary filesystem operations due to:
>>
>>  *  long "sys.path", especially containing non-existing objects
>>
>> Although non-existent, about 5 filesystem operations are
>> tried on them for any module not yet located.
>>
>>  *  a severe weakness in Python's import hook treatment
>>
>> When there is an importer "i" for a path "p" and
>> this importer cannot find module "m", then "p" is
>> treated as a directory and 5 file system operations
>> are tried to locate "p/m". Of course, all of them fail
>> when "p" happens to be a zip archive.
>>
>>
>>Dieter
> 
> 
> I suppose that's a reason for eliminating duplicates and non-existent entries.
> 
There are some aspects of Python's initialization that are IMHO a bit 
too filesystem-dependent. I mentioned one in

 
http://sourceforge.net/tracker/index.php?func=detail&aid=1116520&group_id=5470&atid=105470

but I'd appreciate further support. Ideally there should be some means 
for hooked import mechanisms to provide answers that are currently 
sought from the filestore.

regards
  Steve
-- 
Steve Holden+1 703 861 4237  +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/

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


Re: Python Polymorphism

2005-05-22 Thread Scott David Daniels
Joal Heagney wrote:
> ... "If you're sick of answering newbie questions, and don't 
> think you can do so politely, for the sake of the community,
> DON'T!"  You're not that necessary.

+1 QOTW (or at least FAQ)
--Scott David Daniels
[EMAIL PROTECTED]

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


Reverse engineer Object Oriented Python code

2005-05-22 Thread Aggarwal, Vikas (OFT)
Hi all,
 I want to try reverese engineering a Server written in Python. 
Its is all object oriented stuff with some use of Design patterns.

Umbrello in Linux has no support for python.
I am not sure if Rational Rose can do this for me (Linux Eval version).
Does any one know UML tool which can reverse engineer python classes into 
 UML and give me class diagrams etc.

-vikas

This e-mail, including any attachments, may be confidential, privileged or 
otherwise legally protected. It is intended only for the addressee. If you 
received this e-mail in error or from someone who was not authorized to send it 
to you, do not disseminate, copy or otherwise use this e-mail or its 
attachments.  Please notify the sender immediately by reply e-mail and delete 
the e-mail from your system.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A newbie metaclass question

2005-05-22 Thread Michele Simionato
There are many resources for metaclasses on the Net.
There was a Wiki page on www.python.org about them,
but I don't find it now. So, I will refer you to the links
I have handy:

http://www-106.ibm.com/developerworks/linux/library/l-pymeta.html
http://www-128.ibm.com/developerworks/linux/library/l-pymeta2/index.html
http://www.reportlab.org/~andy/accu2005/pyuk2005_simionato_wondersofpython.zip
 
 Michele Simionato

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


Re: Parsing XML - Newbie help

2005-05-22 Thread Dan M
Hi

rh0dium wrote:
> I am relatively new to python and certainly new to XML parsing.  

Me too. However there are plenty of good docs/tutorials available to 
help with both XML and using it in Python.

For XML you may wish to look at http://www.w3schools.com/. It has a very 
accessible set of tutorials on XML and related technologies, which I 
find make it very quick to get up and running. For what you are trying 
to do you may wish to look at XPath, or ideally XQuery although I'm not 
sure there is an XQuery implementation in Python.

For Python and XML there is Mark Pilgrim's excellent chapter on Parsing 
XML with xml.dom.minidom 
(http://diveintopython.org/xml_processing/index.html).

The is also the PyXML project at Sourceforge 
(http://pyxml.sourceforge.net/). A list of useful links is maintained 
there (http://pyxml.sourceforge.net/topics/).

You may also wish to investigate resources at the Python XML SIG page 
(http://www.python.org/sigs/xml-sig/).

These are just some of the sources of information I am using. Hope this 
helps.

Cheers

Dan

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


I want to ask you the most important question of your life. The question is: Are you saved? It is not a question of how good you are, nor if you are a church member, but are you saved? Are you sure you will go to Heaven when you die? The reason some people don't know for sure if they are going to Heaven when they die is because they just don't know. The good news is that you can know for sure you are going to Heaven. May 22, 2005 12:10:55 pm

2005-05-22 Thread RLG101144

THE MOST IMPORTANT QUESTION OF YOUR LIFE


This is the most important question of your life.


The question is: Are you saved?


It is not a question of how good you are, nor if you
are a church member, but are you saved?


Are you sure you will go to Heaven when you die?


The reason some people don't know for sure if they are
going to Heaven when they die is because they just
don't know.


The good news is that you can know for sure that you
are going to Heaven.


The Holy Bible describes Heaven as a beautiful place
with no death, sorrow, sickness or pain.


God tells us in the Holy Bible how simple it is to be
saved so that we can live forever with Him in Heaven.


"For if you confess with your mouth Jesus is Lord and
believe in your heart that God raised Him from the
dead, you will be saved." (Romans 10:9)


Over 2000 years ago God came from Heaven to earth in
the person of Jesus Christ to shed His blood and die
 on a cross to pay our sin debt in full.


Jesus Christ was born in Israel supernaturally to a
virgin Jewish woman named Mary and lived a sinless
life for thirty-three years.


At the age of thirty-three Jesus was scourged and
had a crown of thorns pressed onto His head then
Jesus was crucified.


Three days after Jesus died on a cross and was placed
in a grave He rose from the dead as He said would
happen before He died.


If someone tells you that they are going to die
and then three days later come back to life and it
actually happens then this person must be the real deal.


Jesus Christ is the only person that ever lived a
perfect sinless life.


This is why Jesus is able to cover our sins(misdeeds)
with His own blood because Jesus is sinless.


The Holy Bible says, "In Him(Jesus) we have redemption
through His blood, the forgiveness of sins..."
(Ephesians 1:7)


If you would like God to forgive you of your past,
present and future sins just ask Jesus Christ to be
your Lord and Saviour.


It doesn't matter how old you are or how many bad
things that you have done in your life including
lying and stealing all the way up to murder.


Just pray the prayer below with your mouth and mean it
from your heart and God will hear you and save you.


Dear Jesus Christ, I want to be saved so that I can
have a home in Heaven with You when I die. I agree
with You that I am a sinner. I believe that You love
me and want to save me. I believe that You bled and
died on the cross to pay the penalty for my sins and
that You rose from the dead. Please forgive my sins
and come into my heart and be my Lord and Saviour.
Thanks Lord Jesus Christ for forgiving me and saving
me through Your merciful grace. Amen.


Welcome to the family of God if you just allowed God
to save you.


Now you are a real Christian and you can know for sure
that you will live in Heaven forever when this life
comes to an end.


As a child of God we are to avoid sin(wrongdoing), but
if you do sin the Holy Bible says, "My dear children,
I write this to you so that you will not sin. But if
anybody does sin, we have one who speaks to the Father
in our defense Jesus Christ, the Righteous One."


Those of you that have not yet decided to place your
trust in the Lord Jesus Christ may never get another
chance to do so because you do not know when you will die.


Jesus said, "I am the way, the truth and the life: no one
can come to the Father(God)(in Heaven), but by me."
(John 14:6)


This means that if you die without trusting in Jesus Christ
as your Lord and Saviour you will die in your sins and be
forever separated from the love of God in a place called Hell.


The Holy Bible descibes Hell as a place of eternal
torment, suffering, pain and agony for all those who
have rejected Jesus Christ.


The good news is that you can avoid Hell by allowing
Jesus Christ to save you today. Only then will you
have true peace in your life knowing that no matter
what happens you are on your way to Heaven.


Praise the Lord!
Servant of the Lord Jesus Christ
Ronald L. Grossi


* Show this to your family and friends so they can also be saved.
* This message may get deleted so you may want to print a copy.
* Just press the [Ctrl][P] keys on your keyboard to print this page.


[Please Visit These Excellent Websites]

Free Video
http://fathersloveletter.com/fllpreviewlarge.html

Free Jesus Videos
http://www.jesusvideo.org/videos/index.php

Free Movie: To Hell and Back
http://www.tbn.org/index.php/8/1.html

Other Languages
http://www.godssimpleplan.org/gsps.html

The Passion Of The Christ
http://www.thepassionofthechrist.com

Beware Of Cults
http://www.carm.org/cults/cult_list.htm

About Hell
http://www.equip.org/free/DH198.htm

Is Jesus God?
http://www.powertochange.com/questions/qna2.html

Free Online Bible 
http://www.biblegateway.com

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


Re: A newbie metaclass question

2005-05-22 Thread Peter Otten
could ildg wrote:

> When I try to learn metaclass of python by article at this place:
> http://www.python.org/2.2/descrintro.html#metaclasses,
> I changed the autosuper example a little as below:
> 
> class autosuper(type):
> def __init__(cls,name,bases,dict):
> super(autosuper,cls).__init__(name,bases,dict)
> setattr(cls,"_%s__super" % name, super(cls))
> print "in metaclass: ", super(cls)
> 
> class A:
> __metaclass__ = autosuper
> def meth(self):
> print "in class A: ", self.__super
> 
> a=A()
> a.meth()
> 
> The result is as below:
> in metaclass:  , NULL>
> in class A:  , >
> 
> The 2 line are not the same. Why? 

This particular difference has more to do with the descriptor protocol than
your custom metaclass. Instead of returning a class attribute unaltered, if
present, its __get__() method is called. E. g.:

>>> class A(object):
... pass
...
>>> class Descr(object):
... def __get__(self, *args):
... print "args:", args
... return 42
...
>>> A.attr = Descr()
>>> A.attr
args: (None, )
42
>>> A().attr
args: (<__main__.A object at 0x402ad62c>, )
42

And now let's make sure:

>>> hasattr(super(A), "__get__")
True

a 'super' object has a __get__() method, and is therefore free to give you
back whatever it chooses to. (It can detect whether it's called by an
instance or a class by checking its first argument).

You might have found some hints in the text you quote, but a detailed
explanation is here:

http://users.rcn.com/python/download/Descriptor.htm

> The metaclass of python is kinda difficult for me.

IIRC you were about to learn the OO basics just a few days ago. In that
situation I would put metaclasses _very_ low on my list of priorities. 

Peter

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


Re: SQL Query via python

2005-05-22 Thread Steve Holden
Jeff Elkins wrote:
> I'm attempting to pass an SQL query via the console:
> 
> $ ./getbd month 05
> 
> The arguments get seem to passed correctly (via print statements) and then:
> 
> cursor.execute ("""
>  SELECT name, month, day ,category, city FROM bday
>  WHERE %s = %s
>""",(arg1,arg2))
> 
> No results. However, if I hardcode the WHERE argument with a field name:
> 
>  cursor.execute ("""
>  SELECT name, month, day ,category, city FROM bday
>  WHERE month = %s
>""",(arg2))
> 
> It works.
> 
Because here you aren't trying to parameterize the name of a database 
object.

> How can I code the left side of the WHERE clause so I can pass an arbitrary 
> field name to search on?
> 
> 
You might have to construct the SQL statement to include the names of 
tables and columns. It's still better to use parameterization for data 
substitutions, though, because then you don't have to perform any quoting.
-- 
Steve Holden+1 703 861 4237  +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/

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


Re: Running a python program during idle time only

2005-05-22 Thread Cousin Stanley
| 
| I'm wondering if anyone knows of a way that I could make so that
| the program will run at full speed only runs after the computer
| has been idle for a while.

   Perhaps looking at some ScreenSaver code could be useful 

   I've never considered how this is done myself,
   but ScreeSavers seem to know that a user hasn't
   done anything for a while 


-- 
Stanley C. Kitching
Human Being
Phoenix, Arizona

== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ 
Newsgroups
= East and West-Coast Server Farms - Total Privacy via Encryption =
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [ZODB-Dev] ZODB memory problems (was: processing a Very Large file)

2005-05-22 Thread Jeremy Hylton
On 5/21/05, DJTB <[EMAIL PROTECTED]> wrote:
> [posted to comp.lang.python, mailed to [EMAIL PROTECTED]

[Following up to both places.]

> I'm having problems storing large amounts of objects in a ZODB.
> After committing changes to the database, elements are not cleared from
> memory. Since the number of objects I'd like to store in the ZODB is too
> large to fit in RAM, my program gets killed with signal 11 or signal 9...

The problem here is a common one with a first attempt at using ZODB. 
The problem is that ZODB manages memory at the granularity of
first-class persistent objects --  that is, instances of classes that
inherit from Persistent.  ZODB can move such objects in and out of
memory at transaction boundaries, which allows your application to use
many more objects than it has physical memory for.

It looks like your application has a single persistent instance -- the
root ExtendedTupleTable -- so there's no way for ZODB to manage the
memory.  That object and everything reachable from it must be in
memory at all times.

You need to re-structure the program so that is has more first-class
persistent objects.  If, for example, the ExtendedTuple objects
inherited from Persistent, then they could reside on disk except when
you are manipulating them.

The ObjectInterning instance is another source of problem, because
it's a dictionary that has an entry for every object you touch.  The
various other dictionaries in your program will also be memory hogs in
they have very many entries.  The typical way to structure a ZODB
program is to use one of the BTrees implementation types instead of a
dictionary, because the BTree does not keep all its keys and values in
memory at one time.  (Its internal organization is a large collection
of first-class persistent objects representing the BTree buckets and
internal tree nodes.)

You must use some care with BTrees, because the data structure
maintains a total ordering on the keys.  (And a dictionary does not.) 
  The ZODB/ZEO programming guide has a good section on BTrees here:
http://www.zope.org/Wikis/ZODB/guide/node6.html

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


Re: first release of PyPy

2005-05-22 Thread ionel
this is interesting 
anyway i'm to lazy to read so i'll just ask:
can PyPy at the current state of develepment help me improve my python programs? (speed)-- ionel.
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Parsing XML - Newbie help

2005-05-22 Thread Fredrik Lundh
"rh0dium" wrote:

> I am relatively new to python and certainly new to XML parsing.  Can
> some show me how to get the product text out of this?

didn't you ask the same question a few days ago?  did you read the
replies to that post?

assuming that your sample is correct, you need to process the almost-
but-not-quite-XML file before passing it to an XML processor.  here's an
ElementTree-based example that does that:

# see http://effbot.org/zone/element-index.htm
from elementtree import ElementTree as ET

data = open(...).read() # or os.popen(...).read()

# strip off bogus XML declaration
import re
m = re.match("<\?xml[^>]+>", data)
if m:
data = data[m.end():]

# wrap notes in container element
data = "" + data + ""

tree = ET.XML(data)

processors = []
for elem in tree.findall(".//node"):
if elem.get("class") == "processor":
processors.append(elem.findtext("product"))
print len(processors)
print processors

given your example, this prints:

2
['AMD Opteron(tm) Processor 250', 'AMD Opteron(tm) Processor 250']





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


Re: first release of PyPy

2005-05-22 Thread holger krekel
On Sun, May 22, 2005 at 19:18 +0200, ionel wrote:
> this is interesting 
> anyway i'm to lazy to read so i'll just ask:
> can PyPy at the current state of develepment help me improve my python 
> programs? (speed)

no, it can't at this stage.  You might check out Psyco, 
the specializing compiler for Python: http://psyco.sf.net

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


Re: EpyDoc problem

2005-05-22 Thread Kenneth Pronovici
> >EpyDoc is hosted in Sourceforge. This alone may answer your question
> >about a bug-tracker:
> >
> >http://sourceforge.net/tracker/?atid=405618&group_id=32455&func=browse
> >  
> >
> Well, I wrote to the bug tracker some days ago but no answer so far.

I am the maintainer of the Debian epydoc package.  Lately, I have also
found it difficult to contact epydoc's author, Edward Loper.  I'm
currently not sure whether my mail is getting spam-filtered or whether
something else has happened and he's not available any more.  Maybe
someone on the list knows what's going on?

I think your best bet is to file the bug (which you have done) and wait
for a reply, keeping in mind that it might be a while before someone has
time to deal with your bug.  Most people writing free software are
volunteers, after all. 

KEN

-- 
Kenneth J. Pronovici <[EMAIL PROTECTED]>
http://www.cedar-solutions.com/


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

blabla

2005-05-22 Thread Noud Aldenhoven
Python rulz and sorry for this spam...
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: [ZODB-Dev] ZODB memory problems (was: processing a Very Largefile)

2005-05-22 Thread Tim Peters
[Jeremy Hylton]
> ...
> The ObjectInterning instance is another source of problem, because it's
> a dictionary that has an entry for every object you touch.

Some vital context was missing in this post.  Originally, on c.l.py, DJTB
wasn't using ZODB at all.  In effect, he had about 5000 lists each
containing about 5000 "not small" integers, so Python created about 5000**2
= 25 million integer objects to hold them all, consuming 100s of megabytes
of RAM.  However, due to the semantics of the application, there were only
about 5000 _distinct_ integers.  What became the `ObjectInterning` class
here started as a suggestion to keep a dict of the distinct integers,
effectively "intern"ing them.  That cut the memory use by a factor of
thousands.

This has all gotten generalized and micro-optimized to the point that I
can't follow the code anymore.  Regardless, the same basic trick won't work
with ZODB (or via any other way of storing the data to disk and reading it
up again later):  if we write the same "not small" integer object out
100 times, then read them all back in, Python will again create 100
distinct integer objects to hold them.  Object identity doesn't survive for
"second class" persistent objects, and interning needs to be applied again
_every_ time one is created.

[DJTB]
> ... The only thing I can't change is that ExtendedTuple inherits
> from tuple

Let me suggest that you may be jumping in at the deep ends of too many pools
at once here.

> class ExtendedTuple(tuple):
>
>def __init__(self, els):
>tuple.__init__(self,els)

That line doesn't accomplish anything:  tuples are immutable, and by the
time __init__ is called the tuple contents are already set forever.  You
should probably be overriding tuple.__new__ instead.

> ...
>def __hash__(self):
>return hash(tuple(self))

This method isn't needed.  If you leave it out, the base class
tuple.__hash__ will get called directly, and will compute the same result.

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


Re: A newbie metaclass question

2005-05-22 Thread Steven Bethard
could ildg wrote:
> When I try to learn metaclass of python by article at this place:
> http://www.python.org/2.2/descrintro.html#metaclasses,
> I changed the autosuper example a little as below:
> 
> class autosuper(type):
> def __init__(cls,name,bases,dict):
> super(autosuper,cls).__init__(name,bases,dict)
> setattr(cls,"_%s__super" % name, super(cls))
> print "in metaclass: ", super(cls)
> 
> class A:
> __metaclass__ = autosuper
> def meth(self):
> print "in class A: ", self.__super
> 
> a=A()
> a.meth() 
> 
> The result is as below:
> in metaclass:  , NULL>
> in class A:  , >

The reason for this is that the super object is a descriptor.  This 
means that
 self.__super
actually calls something like:
 type(self).__super.__get__(self)
So the difference in the two is that the "in metaclass" print references 
the unbound super object, and the "in class A" print references the 
bound super object.

A very simple demonstration of this:

py> class C(object):
... pass
...
py> C.sup = super(C)
py> C.sup
, NULL>
py> C().sup
, >
py> C.sup.__get__(C())
, >

Note that we get the "NULL" output when we ask the *class* for the "sup" 
object.  We get the "C object" output when we ask an *instance* for the 
"sup" object.  The example using __get__ is basically just the explicit 
version of the one that doesn't use __get__.

HTH,

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


Re: python24.zip

2005-05-22 Thread Dieter Maurer
"Martin v. Löwis" <[EMAIL PROTECTED]> writes on Sat, 21 May 2005 23:53:31 +0200:
> Dieter Maurer wrote:
> ...
> > The question was:
> > 
> >"should python start up with **non-existent** objects on the path".
> > 
> > I think there is no reason why path needs to contain an object
> > which does not exist (at the time the interpreter starts).
> 
> There is. When the interpreter starts, it doesn't know what object
> do or do not exist. So it must put python24.zip on the path
> just in case.

Really?

Is the interpreter unable to call "C" functions ("stat" for example)
to determine whether an object exists before it puts it on "path".

> Yes, but the interpreter cannot know in advance whether
> python24.zip will be there when it starts.

Thus, it checks dynamically when it starts.

> > I recently analysed excessive import times and
> > saw thousands of costly and unneccesary filesystem operations due to:
> 
> Hmm. In my Python 2.4 installation, I only get 154 open calls, and
> 63 stat calls on an empty Python file. So somebody must have messed
> with sys.path really badly if you saw thoughsands of file operations
> (although I wonder what operating system you use so that failing
> open operations are costly; most operating systems should do them
> very efficiently).

The application was Zope importing about 2.500 modules
from 2 zip files "zope.zip" and "python24.zip".
This resulted in about 12.500 opens -- about 4 times more
than would be expected -- about 10.000 of them failing opens.


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


Re: python24.zip

2005-05-22 Thread Dieter Maurer
Steve Holden <[EMAIL PROTECTED]> writes on Sun, 22 May 2005 09:14:43 -0400:
> ...
> There are some aspects of Python's initialization that are IMHO a bit
> too filesystem-dependent. I mentioned one in
> 
> 
>  
> http://sourceforge.net/tracker/index.php?func=detail&aid=1116520&group_id=5470&atid=105470
> 
> 
> but I'd appreciate further support. Ideally there should be some means
> for hooked import mechanisms to provide answers that are currently
> sought from the filestore.

There are such hooks. See e.g. the "meta_path" hooks as
described by PEP 302.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: I want to ask you the most important question of your life. The question is: Are you saved? It is not a question of how good you are, nor if you are a church member, but are you saved? Are you sure you will go to Heaven when you die? The reason some people don't know for sure if they are going to Heaven when they die is because they just don't know. The good news is that you can know for sure you are going to Heaven. May 22, 2005 12:10:55 pm

2005-05-22 Thread Mark McIntyre
On 22 May 2005 09:10:25 -0700, in comp.lang.c , [EMAIL PROTECTED]
wrote:
>
>This is the most important question of your life.
>
>The question is:  Are you saved?

Actually the question is: why are you spamming? Its the work of Satan,
surely you know that, being as how you seem to be somewhat religiously
inclined. 

BTW, abuse reports filed with [EMAIL PROTECTED] amongst other
places.

-- 
Mark McIntyre
CLC FAQ 
CLC readme: 

== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ 
Newsgroups
= East and West-Coast Server Farms - Total Privacy via Encryption =
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: I want to ask you the most important question of your life. The question is: Are you saved? It is not a question of how good you are, nor if you are a church member, but are you saved? Are you sure you will go to Heaven when you die? The reason some people don't know for sure if they are going to Heaven when they die is because they just don't know. The good news is that you can know for sure you are going to Heaven. May 22, 2005 12:10:55 pm

2005-05-22 Thread FatKat
[EMAIL PROTECTED] WILL NOT BE SAVED BY FATHERSONHOLYGHOST


[EMAIL PROTECTED] WILL NOT BE SAVED BY GOD PLUTONIUM


IN FACT


[EMAIL PROTECTED]  WILL NOT BE SAVED AT ALL


THIS IS NOT SPAM.


YOU DO NOT HAVE TECHNOLOGY TO RECIVE CONCIOUS MESSAGING


YOU ARE RECEIVING THIS MESSAGE FROM EARTH YEAR 2019 A.D./0011 A.S. IN
ORDER TO PREVENT FURTHER SPAM MESSAGING BY [EMAIL PROTECTED]

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


Re: python24.zip

2005-05-22 Thread "Martin v. Löwis"
Dieter Maurer wrote:
> Really?
> 
> Is the interpreter unable to call "C" functions ("stat" for example)
> to determine whether an object exists before it puts it on "path".

What do you mean, "unable to"? It just doesn't.

Could it? Perhaps, if somebody wrote a patch.
Would the patch be accepted? Perhaps, if it didn't break something
else.

In the past, there was a silent guarantee that you could add
items to sys.path, and only later create the directories behind
these items. I don't know whether people rely on this guarantee.

> The application was Zope importing about 2.500 modules
> from 2 zip files "zope.zip" and "python24.zip".
> This resulted in about 12.500 opens -- about 4 times more
> than would be expected -- about 10.000 of them failing opens.

I see. Out of curiosity: how much startup time was saved
when sys.path was explicitly stripped to only contain these
two zip files?

I would expect that importing 2500 modules takes *way*
more time than doing 10.000 failed opens.

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


Re: install python 2.4.1

2005-05-22 Thread "Martin v. Löwis"
[EMAIL PROTECTED] wrote:
> I use win xp pro.
> I wonder about this new version of python because I use Nummeric, pyro,
>  combine with komodo and pydev ide in my python 2.4.
> If there is compatibility isue with the new version, it is better for
> me not to install the new version.

Installing 2.4.1 should not cause problems. 2.4.x is designed to be
compatible with 2.4, so all applications should continue to run.
The only exception would be an application that relies on the presence
of a bug that was fixed.

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


firebird and unicode

2005-05-22 Thread flupke
Hi,

i'm developing an app that uses wxPython and Firebird via kinterbasdb on 
Win XP SP2. On insert of a record i get this error:
(kinterbasdb.InterfaceError)
(0, "Type mismatch: Input parameter for field named [name n
ot known at this stage of query execution] must be a string, rather than 
a .")

Python, wxPython are all unicode enabled. The firebird database is 
created with the UNICODE_FSS charset and opened as such in kinterbasdb's 
connect function (charset=UNICODE). The GUI's charset is made with 
wxGlade and there i specified UTF-8 for the encoding.

I'm out of ideas as to why i get this error message.

Any ideas?

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


Re: How to receive events (eg. user mouse clicks) from IE

2005-05-22 Thread cal_2pac
> This might make a good candidate for the Cookbook (or there's
> a collection of IE automation examples at win32com.de)
> so anybody else trying to do something similar knows some of the
pitfalls.

This thread has been very valuable for me and has provided
clarifications which I could not get after hours of surfing web
/reading python on win32 / python developer handbook and so on.

Here are more questions that I am encountering
a) the code above will return a click event from an anchor element.
However, I need to identify which anchor element was clicked on.
Similarly, if a user clicks on one cell in HTML table - I need to
determine its identity.
One possible solution to this will be to look at the onClick event
provided by HTML_DocumentEvents and as desribed in msdn library
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/mshtml/reference/events/events.asp

The problem is that msdn documentation says that in order to identify
the element that was clicked - one has to query on IHTMLWindow2::event
property on iHTMLWindow2 interface to get IEventOBj interface and then
from there - use query interfce to get to the id of the element.

How do I do this in python? ie. I have this code
class Doc_Events(doc_mod.HTMLDocumentEvents):
def Ononclick(self):
print 'onClick fired '
and I see onClick being trapped.
Now I need to go and get a reference to the iHTMLWindow2 interface. For
this I need to get a reference to doc_mod (as far as I can see). How do
I get that in the OnonClick method above.

b) You had mentioned PumpWaitingMessages in the previous posting. I
first encountered this on newsgroup postings. None of the standard
books (python on win32 / python developer) seem to explain this in
detail although this seems to be commonly used. Though I understand
this now - my problem is that there seems to be a lack of cohesive
explanation on how python ties up with COM (despite a good chapter 12
on python win32 book). How does a newbie get more info on coding?
Essentially (a) is also a generic question which can be included in a
standard text. If nothing of this sort exists - maybe I will think of
jotting down the notes and posting on a public website.

Roger Upole wrote:
> Reducing the sleep time in the loop also seems to speed things up.
> I'm guessing due to giving both event loops more resources, but
> I can't prove it conclusively.
>
> This might make a good candidate for the Cookbook (or there's
> a collection of IE automation examples at win32com.de)
> so anybody else trying to do something similar knows some of the
pitfalls.
>
>Roger
>
> "J Correia" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > "Roger Upole" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >> There does appear to be some sort of conflict between the two
event
> >> hooks.  I wasn't seeing it before since IE was getting google from
my
> >> browser cache and it was coming up almost instantaneously.  As
soon
> >> as I switched the URL to a page that loads slowly, I got the same
> >> result.
> >>
> >>Adding win32gui.PumpWaitingMessages() to the wait loop
> >> seems to allow both event hooks to run without blocking each
other.
> >>
> >>  Roger
> >
> > I added that line to the wait loop and while it does indeed speed
it
> > up dramatically (in 10 tests: min = 13 sec; max = 33, ave ~ 20
secs)
> > it's still nowhere near the 1-2 secs it takes without hooking the
> > IE events.  I also can't explain the wide differences between min
> > and max times since they seem to occur randomly
> > (e.g. min occurred on 7th run, max on 4th).
> >
> > I assume that that response time won't be adequate for the original
> > poster's needs, due to the slowdown in browsing for his users.
> >
> > Jose
> >
> >
> >
> >
> >
>
>
>
>
> == Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet
News==
> http://www.newsfeeds.com The #1 Newsgroup Service in the World!
>100,000 Newsgroups
> ---= East/West-Coast Server Farms - Total Privacy via Encryption =---

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


Re: passing arguments

2005-05-22 Thread Steve Holden
Steven Bethard wrote:
> James Stroud wrote:
> 
>>import sys
>>
>>try:
>>  arg1 = sys.argv[1]
>>except IndexError:
>>  print "This script takes an argument, you boob!"
>>  sys.exit(1)
> 
> 
> Also possible, to guarantee that exactly one argument was given:
> 
> try:
>arg1, = sys.argv
> except ValueError:
>print "This script takes an argument, you boob!"
>sys.exit(1)
> 
Aren't we forgetting argv[0] here, or am I overlooking something (like, 
you chopped it off without telling me?)?

Surely this would give an unpacking error if command-line arguments 
*were* present.

> If you want to get, say, 3 arguments, just change that line to:
> 
>arg1, arg2, arg3 = sys.argv
> 
Similarly. Or are you just calling sys.argv[0] arg1 to confuse me? ;-)
> 
>>OR, way better: See the optparse module.
> 
> 
> Definitely.  Though depending on what kind of arguments your script 
> takes, you still may need to deal with the args that optparse returns.
> 
Anyway it's always good to know about the underlying mechanisms.

regards
  Steve
-- 
Steve Holden+1 703 861 4237  +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/

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


Re: python24.zip

2005-05-22 Thread Steve Holden
Dieter Maurer wrote:
> Steve Holden <[EMAIL PROTECTED]> writes on Sun, 22 May 2005 09:14:43 -0400:
> 
>>...
>>There are some aspects of Python's initialization that are IMHO a bit
>>too filesystem-dependent. I mentioned one in
>>
>>
>> http://sourceforge.net/tracker/index.php?func=detail&aid=1116520&group_id=5470&atid=105470
>>
>>
>>but I'd appreciate further support. Ideally there should be some means
>>for hooked import mechanisms to provide answers that are currently
>>sought from the filestore.
> 
> 
> There are such hooks. See e.g. the "meta_path" hooks as
> described by PEP 302.

Indeed I have written PEP 302-based code to import from a relational 
database, but I still don't believe there's any satisfactory way to have 
[such a hooked import mechanism] be a first-class component of an 
architecture that specifically requires an os.py to exist in the file 
store during initialization.

I wasn't asking for an import hook mechanism (since I already knew these 
to exist), but for a way to allow such mechanisms to be the sole import 
support for certain implementations.

regards
  Steve
-- 
Steve Holden+1 703 861 4237  +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/

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


libpython2.3.a Linux

2005-05-22 Thread David
Hello,

I'm trying to build a python module in the form of an .so file but I keep 
getting the following message :

/usr/bin/ld cannot find -llibpython2.3

I have all the necessary files in /usr/local/src/Python-2.3.5

with libpython2.3.a and libpython2.3.so files

g++ -I /usr/local/src/Python-2.3.5/Include -L /usr/local/src/Python-2.3.5 -
shared -fPIC -l libpython2.3 -o file.so

Running on Fedora Core 3 - 1.7.0

made the following steps in compiling and installing Python :

./configure
make
make install
make libpython2.3.so

Compiling on windows 2k is fine.

Thanks for any input.

David



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


Send all packets (socket programming)

2005-05-22 Thread Tomas Christiansen
Is there a way to make shure that all packets has been sent before issuing 
a Shutdown and/or Close on a (TCP) Socket?

The problem is that "the other end" interprets a reset-flag (RST) on an IP-
packet as an indication of an error. Instead the finish-flag (FIN) must be 
set, in order to close the connection non-errornously. That can be achieved 
by using socket.shutdown(SHUT_RDWR) followed by socket.close().

BUT if all data has not been sent, sometimes shutdown(SHUT_RDWR) followed 
by close(), sets RST, and the other end thinks that something went wrong 
(the other end is some unknown TCP/IP printer) and goes to an error-state.

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


Re: Self-modifying Code

2005-05-22 Thread Do Re Mi chel La Si Do
Hi !


I often use the auto-modification of code, to allow the users to adapt 
software to the evolution of their needs.

When this technique is controlled, and framed well, it presents only few 
problems.

AMHA, to speak about danger, it is the result of a lack of practice and 
tests. It is a little the same debate as: dynamic language versus static 
language.


@-salutations

Michel Claveau




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


Re: passing arguments

2005-05-22 Thread Steve Holden
Dennis Lee Bieber wrote:
> On Sun, 22 May 2005 16:12:06 -0400, Steve Holden <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
> 
> 
> 
>>Aren't we forgetting argv[0] here, or am I overlooking something (like, 
>>you chopped it off without telling me?)?
>>
> 
>   argv[0] is often just the invocation name of the program/script
> itself, not really an argument to the function of the program.
> 
And you think I don't know this? I was questioning the correctness of 
the assertions of the post to which I was replying. Whether it's a real 
argument or not in undoubtedly occupies an entry in sys.argv.

> script1.py
> -=-=-=-=-=-=-=-=-
> import sys
> 
> for x in range(len(sys.argv)):
> print "Argument %s is %s" % (x, sys.argv[x])
> -=-=-=-=-=-=-=-=-
> 
> (watch out for line wrapping)
> 
> E:\UserData\Dennis Lee Bieber\My Documents>script1.py "These are the"
> Voyages
> Argument 0 is E:\UserData\Dennis Lee Bieber\My Documents\Script1.py
> Argument 1 is These are the
> Argument 2 is Voyages
> 
> E:\UserData\Dennis Lee Bieber\My Documents>python script1.py "quoted
> arg" regular args
> Argument 0 is script1.py
> Argument 1 is quoted arg
> Argument 2 is regular
> Argument 3 is args
> 
> E:\UserData\Dennis Lee Bieber\My Documents>
> 
> 
So?

regards
  Steve
-- 
Steve Holden+1 703 861 4237  +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/

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


trouble with copy/deepcopy

2005-05-22 Thread Alexander Zatvornitskiy
Привет Mike!

17 мая 2005 в 16:38, Mike Meyer в своем письме к Alexander Zatvornitskiy писал:
 MM> Actually, it is shared - but only for reference. If you assign to it,
 MM> you'll create an instance variable of the same name. As Peter
 MM> explained, if you remove the instance variable, the class variable
 MM> becomes visible again. Try this:
 py>> class C:
 MM> ...   q = []
 MM> ...
 py>> c1 = C()
 py>> c2 = C()
 py>> c3 = C()
 py>> c1.q.append(1)
 py>> c2.q.append(2)
 py>> c3.q.append(3)
 py>> c1.q, c2.q, c3.q
 MM> ([1, 2, 3], [1, 2, 3], [1, 2, 3])
 py>>

It's true. Surpise!
Hence, every "non-static in c++-meaning" variable must be initialized in
constructor. It seems strange for me.

Thank you for explanation!

Alexander, [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: passing arguments

2005-05-22 Thread Steven Bethard
Steve Holden wrote:
> Steven Bethard wrote:
>>
>> Also possible, to guarantee that exactly one argument was given:
>>
>> try:
>>arg1, = sys.argv
>> except ValueError:
>>print "This script takes an argument, you boob!"
>>sys.exit(1)
>>
> Aren't we forgetting argv[0] here

Oops.  Yup.  Change all "sys.argv" to "sys.argv[1:]".  Sorry, I never 
use sys.argv directly anymore; I always get my argv through optparse, 
which kindly strips off sys.argv[0].  Good catch, thanks!

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


Re: Parsing XML - Newbie help

2005-05-22 Thread rh0dium

Fredrik Lundh wrote:

> didn't you ask the same question a few days ago?  did you read the
> replies to that post?

Yes I did but the XML was malformed.. Actually it still is but you
helped me figure out a way to correct it - Thanks

Here is what I have so far.  Now I want to find a child of a child ( I
think that's how you state it ?? )  Below is a piece of the XML which I
am trying to parse..  In short I want to figure out all of the memory
in a system.  I can look at  the "size" of all "bank:?"'s and add them
up. I am having trouble getting to the children of the "System Memory"

inp = open("xml.test1")
data = inp.read()
inp.close()
# strip off bogus XML declaration
import re
m = re.match("<\?xml[^>]+>", data)
if m:
data = data[m.end():]
# Apparently ampersands are common in lshw.. Get rid of them..
data = data.replace('&ersand;', '')
# wrap notes in container element
data = "" + data + ""

tree = ET.XML(data)

 for elem in tree.findall(".//node"):
if elem.get("class") == "memory":
if elem.findtext("description") == "System Memory":
print "Found system memory bank"

Ok so up to here I am ok.  I find ( If you want the full xml let me
know) two blocks of system memory.  It MUST be "System Memory" only.
Now how do I get a list of all of the children "nodes" of this.  They
are named bank:N  ( i.e bank:0, bank:1 etc [see below] ).  For each one
of those there may ( or may not ) have some memory stuck in it.  I can
tell if there is memory because a size is given.  I want to a list of
all of the sizes.  From there I can say you have sum(memory) in
len(memory) banks of total banks.

Here is what I tried - but I was clearly messing up..

for mem in elem.findall("./node/node")
if elem.get("class") == "memory":
print "Entering Memory Class"
if elem.findtext("size"):
print "Found size",
elem.findtext("size"):

And the XML which goes with that..

   
  System Memory
  27
  System board or motherboard
  
 DIMM DDR Synchronous [empty]
 JEDEC ID:
 0
 DIMM3B
  
  
 DIMM DDR Synchronous [empty]
 JEDEC ID:
 1
 DIMM3A
  
  
 DIMM DDR Synchronous 400 MHz (2.5
ns)
 M3 12L2920BG0-CCC
 JEDEC ID:CE 00 00 00 00 00 00 00
 2
 96000241
 DIMM1B
 1073741824
 64
 4
  
  
 DIMM DDR Synchronous 400 MHz (2.5
ns)
 M3 12L2920BG0-CCC
 JEDEC ID:CE 00 00 00 00 00 00 00
 3
 4A000741
 DIMM1A
 1073741824
 64
 4
  
   
   
  System Memory
  28
  System board or motherboard
  
 DIMM DDR Synchronous [empty]
 JEDEC ID:
 0
 DIMM4B
  
  
 DIMM DDR Synchronous [empty]
 JEDEC ID:
 1
 DIMM4A
  
  
 DIMM DDR Synchronous 400 MHz (2.5
ns)
 M3 12L2920BG0-CCC
 JEDEC ID:CE 00 00 00 00 00 00 00
 2
 9541
 DIMM2B
 1073741824
 64
 4
  
  
 DIMM DDR Synchronous 400 MHz (2.5
ns)
 M3 12L2920BG0-CCC
 JEDEC ID:CE 00 00 00 00 00 00 00
 3
 58000E41
 DIMM2A
 1073741824
 64
 4
  
   
   
  Flash Memory
  29
  System board or motherboard
  1048576
  
 Chip FLASH Non-volatile
 0
 SYSTEM ROM
 1048576
 4
  
   
   
  b
   
   
  c
   
   
  Memory controller
  CK804 Memory Controller
  nVidia Corporation
  0
  [EMAIL PROTECTED]:00.0
  a3
  32
  6600
  
 bus mastering
 PCI capabilities
listing
  
   


Thanks so much.  PS - XML can be a real PITA when the data you throw at
it is not "correct".  I actually had started working with sgmllib after
I saw a similar thread.  However I ran into the same problem ( child of
child..)

Thanks again.

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


GREAT VIDEO! >> http://www.tbn.org/films/videos/To_Hell_And_Back.ram << Just click link to view the free video.......... May 22, 2005 7:37:11 pm

2005-05-22 Thread AOLfan250129
GREAT VIDEO! >> http://www.tbn.org/films/videos/To_Hell_And_Back.ram <<
Just click link to view the free video.. May 22, 2005 7:37:12 pm

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


store data for search using python

2005-05-22 Thread Thomas Thomas
Hi all,

I have files & text associated with that files as data. what will be the best 
way to store them(like xml..), So that i can search in the text and get a 
list of files as result from a python application..

what kind of factors do i have to take into account if 
my prime concern is effective search.

Another suggestion was btree.. any more tips on that

regards
Thomas


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


Re: How come print cannot be assigned to a variable?

2005-05-22 Thread John Doe
[EMAIL PROTECTED] wrote:
> Hi all,
> In Python, some functions can be assigned to variables like this:
> length=len
> Why is it that print cannot be assigned to a variable like this? (A
> syntax error is declared.)
> 
>   Thanks,
> 
>  Vaibhav
> 

print can't be assigned to variables since it's not a funcion, it's part
of the syntax of the language, like `for', `while', etc. and it can't be
assigned to variables, just as those can't be assigned.
If you need a function that prints stuff, consider these two examples:
[snip]
PrintFunc = lambda x: print x
[snip]
Or, a somewhat better solution:
[snip]
import sys
PrintFunc = sys.write
[snip]
-- 
http://mail.python.org/mailman/listinfo/python-list


Content violation

2005-05-22 Thread NAV2_SMTP_Gateway
Content violation found in email message.

From: python-list@python.org
To: [EMAIL PROTECTED]

File(s): your_document.pif

Matching filename: *.pif


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


Re: firebird and unicode

2005-05-22 Thread flupke
flupke wrote:
> Hi,
> 
> i'm developing an app that uses wxPython and Firebird via kinterbasdb on 
> Win XP SP2. On insert of a record i get this error:
> (kinterbasdb.InterfaceError)
> (0, "Type mismatch: Input parameter for field named [name n
> ot known at this stage of query execution] must be a string, rather than 
> a .")
> 
> Python, wxPython are all unicode enabled. The firebird database is 
> created with the UNICODE_FSS charset and opened as such in kinterbasdb's 
> connect function (charset=UNICODE). The GUI's charset is made with 
> wxGlade and there i specified UTF-8 for the encoding.
> 
> I'm out of ideas as to why i get this error message.
> 
> Any ideas?
> 
> Thanks
> Benedict

If looked around a bit and it seems i have to do a 
kinterbasdb.init(type_conv=100). But this gives another error:

File "C:\Python24\lib\site-packages\kinterbasdb\__init__.py", line 343, 
in init
 fakeFunc.func_code = realFunc.func_code
ValueError: Date() requires a code object with 0 free vars, not 1

I installd the mx Data time module and the fixedpoint module but that 
doesn't help. I still get the same error.
Does anybody know what's wrong?

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


Re: SSL (HTTPS) with 2.4

2005-05-22 Thread Bloke
Andrew and John,

Any chance of you sending me your code to have a look at?

Rob

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


Re: Python on a public library computer

2005-05-22 Thread alex23
> Maybe, but in this case I can run only IE, word, excel and
powerpoint.
> Do you think there is a rational reason for that?

Yes. It's easier to support. As someone who has worked at administering
small & large scale networks, you want that job to be as easy as
possible...

In this case, it sounds like the library is providing computers for two
purposes: access to Office tools and to the internet. Given the
"everything not forbidden is permissable" attitude of most people,
unless the use is restricted to only those two activities people
legitimately wanting access will tend to end up waiting for others who
have co-opted the services for their own personal end.

> On the other hand one might look at public libraries as places suited
> to inspire people and showing them how one is to treat the users of a
> public service.

By _secretly_ commandeering public resources for your own private use
outside of the scope of their intended usage, you plan on showing how
the public is responsible enough to do anything they want with those
resources?

At the end of the day, some staff member is left with having to clean
up whatever is done to those public terminals. I think the motivation
here has less to do with "selling out" the European Constitution and
more to do with someone just wanting to get home from their job with
the minimum of hassle.

-alex23

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


Re: GREAT VIDEO! >> http://www.tbn.org/films/videos/To_Hell_And_Back.ram << Just click link to view the free video.......... May 22, 2005 7:37:11 pm

2005-05-22 Thread mgayoub
No.

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


profile python in embed system

2005-05-22 Thread kyo guan
HI :

I want to test my system's performance. My system has a python embed. 
How can I test the proformance like the
python module "profile" or "hotshot" . I can't use the module "profile" because 
my system are base callback, so I can't run my
system
like this:  profile.run("  ").  The system call the python like this : " 
mypython.on_xxx_callback ". but there are too many
callback.
and I want to get the total profile of the hope python script. How can I do? 

Thank you :)


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


Re: How to detect a double's significant digits

2005-05-22 Thread AnswerGuy
James Stroud wrote:
> Significant digits are an accounting concept. As such, it is up to
the
> accountant to keep track of these as only she knows the precision of
her
> measurements.
>
> Koan for the day:

> What are the significant digits of 0.1?

> Hint:

> >>> `0.1`

> James

> On Thursday 05 May 2005 10:37 am, so sayeth mrstephengross:
>> Hi all... How can I find out the number of significant digits (to
the
>> right of the decimal place, that is) in a double? At least, I
*think*
>> that's what I'm asking for. For instance:

>> 0.103 --> 3
>> 0.0103 --> 4
>> 0.00103 --> 5
>> 0.000103 --> 6
>> 0.103 --> 7

 Since "significant digits" is a representation concept rather
 than a mathematical one I'd be inclined to convert the value
 to a string, split on the decimal point and return the length
 of that.

 A naive approach:

def sigdigits(x):
   return len( ("%s" % float(x)).split('.')[1])


 ... but this gives bogus results for integers (saying that they
 have "one" significant digit when, by your definition they have
 zero.

 I suppose you have to amend your definition to handle numbers
 larger than 1 and I have to do something different than just
 coercing into a float().

def sigdigits(x):
   assert float(x) == x  # raise an exception if we can't float it
   ret = 0
   strep = float(x)
   (whole, fraction) = strep.split('.')
   if int(fraction) > 0:
   ret += len(fraction)
   if int(whole) > 0:
   ret += len(whole)

 ... I think that should do it.  We could explicitly trim leading zeros
 from the whole number part and trailing zeros from the fractional
part.
 However I think the string representation (in Python's built-ins)
 guarantees us that there will be no leading or trailing zeros unless
 the part we're looking at is numerically equivalent to zero.

JimD

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


Re: libpython2.3.a Linux

2005-05-22 Thread Artie Gold
David wrote:
> Hello,
> 
> I'm trying to build a python module in the form of an .so file but I keep 
> getting the following message :
> 
> /usr/bin/ld cannot find -llibpython2.3
> 
> I have all the necessary files in /usr/local/src/Python-2.3.5
> 
> with libpython2.3.a and libpython2.3.so files
> 
> g++ -I /usr/local/src/Python-2.3.5/Include -L /usr/local/src/Python-2.3.5 -
> shared -fPIC -l libpython2.3 -o file.so

Close:

g++ -I/usr/local/src/Python-2.3.5/Include -L/usr/local/src/Python-2.3.5 
   -shared -fPIC -lpython2.3 -o file.so

Please read the man page (or equivalent documentation) for the correct 
way to use options in g++.
> 
> Running on Fedora Core 3 - 1.7.0
> 
> made the following steps in compiling and installing Python :
> 
> ./configure
> make
> make install
> make libpython2.3.so
> 
> Compiling on windows 2k is fine.
> 
> Thanks for any input.
> 
> David
> 
> 
> 
HTH,
--ag

-- 
Artie Gold -- Austin, Texas
http://it-matters.blogspot.com (new post 12/5)
http://www.cafepress.com/goldsays
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How come print cannot be assigned to a variable?

2005-05-22 Thread Steven Bethard
John Doe wrote:
> If you need a function that prints stuff, consider these two examples:
> [snip]
> PrintFunc = lambda x: print x

py> printfunc = lambda x: print x
Traceback (  File "", line 1
 printfunc = lambda x: print x
   ^
SyntaxError: invalid syntax

See Inappropriate use of Lambda on the Python Wiki[1].  This is also a 
horrible idea as it means you can only print a single item:

py> print 1, 2, 3
1 2 3
py> def write(x):
... print x
...
py> write(1, 2, 3)
Traceback (most recent call last):
   File "", line 1, in ?
TypeError: write() takes exactly 1 argument (3 given)
py> def write(*args):
... print args
...
py> write(1, 2, 3)
(1, 2, 3)

The print statement has special spacing behavior.  You could perhaps 
approximate it with something like:

py> def write(*args):
... for arg in args:
... print arg,
... print
...
py> write(1, 2, 3)
1 2 3

But why go to all this effort?

STeVe

[1] http://wiki.python.org/moin/DubiousPython
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Running a python program during idle time only

2005-05-22 Thread Terry Hancock
On Friday 20 May 2005 08:06 pm, los wrote:
> I'm wondering if anyone knows of a way that I could make so that the
> program will run at full speed only runs after the computer has been
> idle for a while.  I've looked at the "nice" command but that's not
> exactly what I want.

You need to define what "idle" means:  Screensavers do this in more
than one way, but typically, "idle" means "no user input has occured",
in which case you are looking for the time since the last input signal
from keyboard or mouse (not sure how to do this off the top of my
head, but that's the "screensaver" approach).

This is much less meaningful on a multiuser / multiple terminal
machine, of course.  And it's really nonsense on a machine that is
also acting as a server. That's why "nice" seems like a more logical
solution for these types of machines.

Someone's already mentioned checking the load average, which 
sounds like a good idea for your application.


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

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


Re: Reverse engineer Object Oriented Python code

2005-05-22 Thread Terry Hancock
On Sunday 22 May 2005 09:02 am, Aggarwal, Vikas (OFT) wrote:
>  I want to try reverese engineering a Server written in Python. 
> Its is all object oriented stuff with some use of Design patterns.
> 
> Umbrello in Linux has no support for python.
> I am not sure if Rational Rose can do this for me (Linux Eval version).
> Does any one know UML tool which can reverse engineer python classes into 
>  UML and give me class diagrams etc.

Well, I had some success with this, once.  I'm pretty sure I was using
"happydoc" to do it. Try googling for that.  It can create a dia file with
UML formatting, IIRC.  If it wasn't that, it had to be "pydoc", which is
also quite useful.

I wouldn't call this "reverse engineering" by the way, but rather 
"self documentation".

Cheers,
Terry

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

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


Re: How to receive events (eg. user mouse clicks) from IE

2005-05-22 Thread Roger Upole
<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
...
> The problem is that msdn documentation says that in order to identify
> the element that was clicked - one has to query on IHTMLWindow2::event
> property on iHTMLWindow2 interface to get IEventOBj interface and then
> from there - use query interfce to get to the id of the element.
>
> How do I do this in python? ie. I have this code
> class Doc_Events(doc_mod.HTMLDocumentEvents):
>def Ononclick(self):
>print 'onClick fired '
> and I see onClick being trapped.
> Now I need to go and get a reference to the iHTMLWindow2 interface. For
> this I need to get a reference to doc_mod (as far as I can see). How do
> I get that in the OnonClick method above.

To get the IHTMLWindow2, you can just use self.parentWindow
inside the event hander, and then get the event from it.  And then
the event's srcElement should be what you need.

class Doc_Events(doc_mod.HTMLDocumentEvents):
def Ononclick(self):
print 'onclick'
ev=self.parentWindow.event
src=ev.srcElement
print 'tagName:',src.tagName,'name:',src.getAttribute('name')

For clicking on google's input field, this yields
tagName: INPUT name: q

>
> b) You had mentioned PumpWaitingMessages in the previous posting. I
> first encountered this on newsgroup postings. None of the standard
> books (python on win32 / python developer) seem to explain this in
> detail although this seems to be commonly used. Though I understand
> this now - my problem is that there seems to be a lack of cohesive
> explanation on how python ties up with COM (despite a good chapter 12

PumpWaitingMessages is just a way to ensure that normal message processing
(window messages, events, dde, etc) happens while python code is running.
Normally you don't need it, but every once in a while you hit a situation 
where
blocking occurs.

For how exactly python interacts with COM, the source is your best bet.

Roger





== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 
Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: problem uploading ZIP file tp PyPI

2005-05-22 Thread richard
John Machin wrote:
> I presume you mean a bug report. Done.

Thankyou.


> I wrote:
>> He wrote:
>>> I wrote:
 The code is being too paranoid
>>> 
>>> Which code (distutils or PyPI server) is being paranoid about what???
>>
>> The PyPI server code, which attempts to make sure people aren't uploading
>> pr0n.
> So zip implies pr0n but exe doesn't ???

Not sure what your point is here. Are you implying that PyPI is doing
something wrong W.R.T. exe files? If you are, what are you basing that
statement on? And what would you do differently?


Richard

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


RE: problem uploading ZIP file tp PyPI

2005-05-22 Thread richard
Tony Meyer wrote:

> setup.py sdist --format=zip

 Try without the --format arg. The code is being too paranoid.
>>> 
>>> Result: (A) produces a zip file with only minor differences
>>> (presumably a timestamp):
>> 
>> Oh, so even without --format, a ZIP source dist file is
>> produced anyway? If this is the case, please file a bug against PyPI.
> 
> How is this a bug?  sdist is meant to produce a zip file on Windows if
> --format isn't used.  If "upload" overrides this for some reason, then the
> documentation should say so (and, IMO, it would be a mistake for that to
> be the case).

"bug against PyPI". Where did I say bug against distutils?


 Richard

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


Re: problem uploading ZIP file tp PyPI

2005-05-22 Thread richard
John Machin wrote:
> FYI, there are a few unreconstructed diehards out here who neither run
> on a *x platform nor run bleeding-edge Python straight out of last
> night's CVS.

I think you need to pull your head in, mate.

The bug you discovered in PyPI is plain and simple a bug in its attempts to
discover whether an uploaded ZIP file was generated by distutils.

It's a bug. It will get fixed.

Get over your damn platform paranoia.


Richard

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


Re: GridCellEditor

2005-05-22 Thread david . g . morgenthaler
On Sun, 22 May 2005 10:29:50 +0300, "gralex" <[EMAIL PROTECTED]> wrote:

>Hi,all!
>
>How i can manually start CellEditor in wxGrid for spicified Cell in grid in 
>my programm:
>
>mygrid.SetGridCursor(2,3)
>mygrid.MakeCellVisible(2,3)
># starting editing... ??
>mygrid.ShowCellEditControl() don't working...
>
>help me, please... 
>
Try:
mygrid..EnableCellEditControl(True)
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: problem uploading ZIP file tp PyPI

2005-05-22 Thread richard
richard wrote:
> "bug against PyPI". Where did I say bug against distutils?

Apologies for the dupe response.

The bug has now been fixed.


Richard

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


Binding the names in a module in a class instance

2005-05-22 Thread Jacob H
Hello all,

I would like to be able to take a module full of class instances,
functions, etc and bind all its names to a separate container class in
a different module. I have come up with the following way to do it..

(module "globals")

class Container:
pass
container = Container()

(module "all_the_stuff")

...define a bunch of stuff...

(module "main")

exec open("all_the_stuff.py").read() in globals.container.__dict__

I feel uneasy about this method. I foresee bad namespace clashes.
What's a better way? :)

Thanks in advance,
Jacob

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


Re: GridCellEditor

2005-05-22 Thread gralex

>
>>Hi,all!
>>
>>How i can manually start CellEditor in wxGrid for spicified Cell in grid 
>>in
>>my programm:
>>
>>mygrid.SetGridCursor(2,3)
>>mygrid.MakeCellVisible(2,3)
>># starting editing... ??
>>mygrid.ShowCellEditControl() don't working...
>>
>>help me, please...
>>
> Try:
> mygrid..EnableCellEditControl(True)

Thanks you.
It's working... 


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


Re: how to config a comserver in a customize dll?

2005-05-22 Thread Tim Roberts
"ÒÊÃÉɽÈË" <[EMAIL PROTECTED]> wrote:

>When i use the below code to create a comserver on Windows OS£¬i find that
>the com was configed in the file
>python23com.dll,why? if i want to config it in my customize dll,how should i
>do? 

Python is not a compiled language.  It does not produce DLLs.  The real
executable code for a Python COM server is always contained in
python23com.dll.  The registry will tell the interpreter that is called by
python23com.dll where it can find your script.

>class TestPythonCom:
>_public_methods_ = [ 'SplitString' ]
>_reg_progid_ = "TestPythonCom.Application"
># NEVER copy the following ID
># Use "print pythoncom.CreateGuid()" to make a new one.
>_reg_clsid_ = "{93D78ABA-1F6C-4B1C-97C7-C3700511415A}"
>
>def SplitString(self, val):
>return val

-- 
- Tim Roberts, [EMAIL PROTECTED]
  Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: first release of PyPy

2005-05-22 Thread Ville Vainio
> "Christian" == Christian Tismer <[EMAIL PROTECTED]> writes:

>> PyPy is written in python, if it can be compiled then the programs
>> can
>> be as well.

Christian> Well, this is not really true. PyPy is written in
Christian> RPython, a sub-language of Python that is implicitly
Christian> defined by "simple and static enough to be compilable".

Could it be possible to tag some modules in application code as
RPython-compatible, making it possible to implement the speed critical
parts in RPython?

-- 
Ville Vainio   http://tinyurl.com/2prnb
-- 
http://mail.python.org/mailman/listinfo/python-list