Re: Python 3! Finally!

2005-10-02 Thread Steve Bergman
Duncan Booth wrote:

>Did you download the file using Firefox? It seems to have a 'feature' that 
>when you download a file and there is already a file of the same name it 
>finds the first number in the filename and increments it.
>
>  
>
Yes, isn't that fun?  This has been a known problem with a bug filed for 
well over a year.  Perhaps closer to a year and a half.  Not that the 
bug has been simply ignored.  It has been hashed and rehashed over and 
over.  Someone proposes a solution.  Firefox devs come back and say that 
the solution will not work in some corner case on Windows.  Someone 
proposes a solution.  Firefox devs come back and say that it will 
adversely affect some Linux users.  Someone proposes a solution.  
Firefox devs come back and say that certain MacOS users could experience 
a problem with that.  Someone proposes that in the case that there is a 
filename collision, the user might simply be prompted to decide on a 
filename. Firefox devs totally reject that idea (and rather 
vehemently).  You see, that would totally freak out the end user, and 
that is *certainly* not a good solution.

So the interim solution, for over a year, has been to leave it broken 
for everyone...


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


Statement orders

2005-10-02 Thread Monu Agrawal
Hi I am making a gui based tool. When user preses a perticular button I
am running a heavy command, before this I want to say user to wait with
a image showing infront of her.
My code is like:
def loadData(self):
top=Toplevel(self.parent)
top.focus_set()
self.parent.wm_title("Loading Data...")

os.system('a heavy command')
os.system('another heavy command)
top.destroy()

Now when I apply it, it first runs the os.system commands then it shows
the top level.
I tried with putting sleep just before os.system() it didn't help.
Is some statement reordering going on, or I am missing something?

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


Re: Statement orders

2005-10-02 Thread Fredrik Lundh
Monu Agrawal wrote:

> Hi I am making a gui based tool. When user preses a perticular button I
> am running a heavy command, before this I want to say user to wait with
> a image showing infront of her.
>
> My code is like:
>
> def loadData(self):
>top=Toplevel(self.parent)
>top.focus_set()
>self.parent.wm_title("Loading Data...")

+top.update() # flush the event queue

>os.system('a heavy command')
>os.system('another heavy command)
>top.destroy()





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


Re: Python 3! Finally!

2005-10-02 Thread Steven D'Aprano
On Sun, 02 Oct 2005 02:06:26 -0500, Steve Bergman wrote:

> Someone proposes that in the case that there is a 
> filename collision, the user might simply be prompted to decide on a 
> filename. 

You mean like every single other GUI application that saves files does?

> Firefox devs totally reject that idea (and rather
> vehemently).  You see, that would totally freak out the end user, 

You mean like they freak out when it happens with IE, Word, Excel,
Pagemaker, Quark Xpress, Photoshop, Gimp, OpenOffice, Access, Corel Draw,
Outlook, Opera, and Kwrite (to mention just a few)?

> and that is *certainly* not a good solution.

Heaven's no, we can't be having with that sort of thing.

> So the interim solution, for over a year, has been to leave it broken 
> for everyone...

Because of course end users certainly won't be confused to save a file
called "Fred1" and find "Fred2" instead, oh no.

I'm surprised that they don't just add Yet Another Secret Option to
Firefox's preferences: FileCollision, with two possible values: "Do the
wrong thing" and "Ask the user".

After all, more preferences are always good, right?


-- 
Steven.

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


Python CGI Script

2005-10-02 Thread Efrat Regev
 Hello,

 I'm a data-structures course TA trying to write a python CGI script 
for automatically compiling and testing students' projects. 
Unfortunately, I've run into some questions while writing this, which I 
couldn't solve with the various (and helpful) python-CGI documentation. 
(It's possible that I'm posting to the wrong group; if so, I'd 
appreciate suggestions for the appropriate group.)


1. In my HTML page, I have the following:


...


 In the above, submission_processor.py is the python CGI script. I 
didn't write a URL in the action field, since I'm first testing 
everyting on a local machine (running FC4). The first line of 
submission_processor.py is

#!/usr/bin/python

and I've done

chmod +x submission_processor.py

 When I hit the "submit" button, my browser (Firefox on FC4) doesn't 
run the script; it asks me whether it should open 
submission_processor.py or save it to disk. I couldn't figure out why.

2. My HTML page has the option for an instructor to list the various 
submissions and scores. Obviously, this should be inaccessible to 
students. The instructor has a password for doing this, therefore. 
Suppose I place the password inside a python script, and give this 
script only +x permission for others. Is this  adequate as far as security?


 Thanks in advance for answering these questions.


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


Problems posting with urlencode

2005-10-02 Thread Joseph Chase
I have the following form :


Created
User
Auction title
Auction url
Modification rec
State


I post the form data with the following calls:

params = urllib.urlencode({"auction[user]" :user, 
"auction[auction_title]": auction_title,"auction[auction_url]": auction_url, 
"auction[modification_rec]" :recommendation, "auction[state]=": 
state,"commit":"Create"})

print "Storing"
data = urllib.urlopen(self.baseUrl,params)


When I go and view the inserted record, the record exists, but the field 
values are null.  It is my thinking that the backend needs the "id" value 
for each input value; how do I add that data to the urlencode() call?

When I utilize the above form, all is inserted and all of the field values 
appear.  What data am I not accounting for with my program; for its obvious 
that the browser is sending something to the server that my application is 
not.

Thanks. 


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


Re: Class Help

2005-10-02 Thread Fredrik Lundh
Ivan Shevanski wrote:

> To continue with my previous problems, now I'm trying out classes.  But I
> have a problem (which I bet is easily solveable) that I really don't get.
> The numerous tutorials I've looked at just confsed me.For intance:
>
> >>>class Xyz:
> ... def y(self):
> ... q = 2
> ...
> >>>Xyz.y()

what tutorial told you to write this last line?





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


Re: Problems posting with urlencode

2005-10-02 Thread Fredrik Lundh
Joseph Chase wrote:

> When I go and view the inserted record, the record exists, but the field
> values are null.  It is my thinking that the backend needs the "id" value
> for each input value; how do I add that data to the urlencode() call?

since the id isn't part of the form data set:

http://www.w3.org/TR/REC-html40/interact/forms.html#form-data-set

that's a bit unlikely.

printing the params string might help you figure out what's
missing.





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


Re: Python CGI Script

2005-10-02 Thread Steve Holden
Efrat Regev wrote:
>  Hello,
> 
>  I'm a data-structures course TA trying to write a python CGI script 
> for automatically compiling and testing students' projects. 
> Unfortunately, I've run into some questions while writing this, which I 
> couldn't solve with the various (and helpful) python-CGI documentation. 
> (It's possible that I'm posting to the wrong group; if so, I'd 
> appreciate suggestions for the appropriate group.)
> 
> 
> 1. In my HTML page, I have the following:
> 
>  enctype="multipart/form-data">
> ...
> 
> 
>  In the above, submission_processor.py is the python CGI script. I 
> didn't write a URL in the action field, since I'm first testing 
> everyting on a local machine (running FC4). The first line of 
> submission_processor.py is
> 
> #!/usr/bin/python
> 
> and I've done
> 
> chmod +x submission_processor.py
> 
>  When I hit the "submit" button, my browser (Firefox on FC4) doesn't 
> run the script; it asks me whether it should open 
> submission_processor.py or save it to disk. I couldn't figure out why.
> 
You also have to have the executable script inside a directory that is 
recognised as being a script directory (usually achieved with an Apache 
ScriptAlias directive), or have the server otherwise recognise .py files 
as executable (just setting the +x mode bit isn't enough).

In the absence of such knowledge the server just returns the content of 
the file rather than the content produced by *executing* the file.

> 2. My HTML page has the option for an instructor to list the various 
> submissions and scores. Obviously, this should be inaccessible to 
> students. The instructor has a password for doing this, therefore. 
> Suppose I place the password inside a python script, and give this 
> script only +x permission for others. Is this  adequate as far as security?
> 
That depends on whether you wanted to use HTTP security (provided 
automatically by the web server) or application security (provided by 
your code).

In the case of a script which is for general running but where some of 
the script's functionality shouldn't be generally available you are 
stuck with the latter. It's OK to have passwords in your script as long 
as you are sure that the script isn;t going to be served up as content 
like it currently is!

> 
>  Thanks in advance for answering these questions.
> 
> 
>   Efrat

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006  www.python.org/pycon/

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


Re: Problems posting with urlencode

2005-10-02 Thread Steve Holden
Fredrik Lundh wrote:
> Joseph Chase wrote:
> 
> 
>>When I go and view the inserted record, the record exists, but the field
>>values are null.  It is my thinking that the backend needs the "id" value
>>for each input value; how do I add that data to the urlencode() call?
> 
> 
> since the id isn't part of the form data set:
> 
> http://www.w3.org/TR/REC-html40/interact/forms.html#form-data-set
> 
> that's a bit unlikely.
> 
> printing the params string might help you figure out what's
> missing.
> 

If there's no chance of putting any debug statements into the processing 
script you might consider using a proxy or submitting to a local server 
to ensure that you are submitting what you think.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006  www.python.org/pycon/

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


Re: Python CGI Script

2005-10-02 Thread Ivan Herman
Efrat,

I am afraid a CGI script is never *executed* by the browser. Instead, it sends
the URL to a server, expects the server to execute the script, and display the
server's response. If you just put a file name then (it seems, I never even
tried that) Firefox uses the local file store as a 'server' in that respect.

If you want to test a CGI script on your own machine, you should run a web
server on your own machine. That server should also be set up in a way that it
recognizes a '.py' file as a CGI script to be executed by Python (not all
servers may recognize the #!  trick...).

This may look scary, but it is not that bad. Apache has a number of precompiled
binary versions that you can install on your machine; you can also use servers
like W3C's jigsaw (this relies on Java) or others. These are all free and easy
to install and, well, manageable to configure. Actually, in case you run on a
MacOS X by any chance, Apache is already installed afaik...

I hope this helps

Ivan


 Original Message 
From: Efrat Regev <[EMAIL PROTECTED]>
To:
Subject: Python CGI Script
Date: 30/9/2005 12:50

> Hello,
> 
> I'm a data-structures course TA trying to write a python CGI script
> for automatically compiling and testing students' projects.
> Unfortunately, I've run into some questions while writing this, which I
> couldn't solve with the various (and helpful) python-CGI documentation.
> (It's possible that I'm posting to the wrong group; if so, I'd
> appreciate suggestions for the appropriate group.)
> 
> 
> 1. In my HTML page, I have the following:
> 
>  enctype="multipart/form-data">
> ...
> 
> 
> In the above, submission_processor.py is the python CGI script. I
> didn't write a URL in the action field, since I'm first testing
> everyting on a local machine (running FC4). The first line of
> submission_processor.py is
> 
> #!/usr/bin/python
> 
> and I've done
> 
> chmod +x submission_processor.py
> 
> When I hit the "submit" button, my browser (Firefox on FC4) doesn't
> run the script; it asks me whether it should open
> submission_processor.py or save it to disk. I couldn't figure out why.
> 
> 2. My HTML page has the option for an instructor to list the various
> submissions and scores. Obviously, this should be inaccessible to
> students. The instructor has a password for doing this, therefore.
> Suppose I place the password inside a python script, and give this
> script only +x permission for others. Is this  adequate as far as security?
> 
> 
> Thanks in advance for answering these questions.
> 
> 
>  Efrat
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Nufox : Xul + Python

2005-10-02 Thread salvatore . didio
Thank you for testing
Indeed it is very interesting :-)

I've had some problems with my ports forwarding and no-ip.org.

Here is then the new address :

http://artyprog.dyndns.org:8080

Regards

Betwise, I live in France so the site is close when i'am at work

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


Re: Nufox : Xul + Python

2005-10-02 Thread Oliver Andrich
I would like to test it, but as soon as I try to execute an example my
browser is guided to connect to 192.168.0.40. First off it is an
non-routeable address and secondly my own too. :))) May be you have to
fix your setup another time.

Best regards,
Oliver

2 Oct 2005 03:40:50 -0700, [EMAIL PROTECTED]
<[EMAIL PROTECTED]>:
> Thank you for testing
> Indeed it is very interesting :-)
>
> I've had some problems with my ports forwarding and no-ip.org.
>
> Here is then the new address :
>
> http://artyprog.dyndns.org:8080
>
> Regards
>
> Betwise, I live in France so the site is close when i'am at work
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>


--
Oliver Andrich <[EMAIL PROTECTED]> --- http://roughbook.de/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Will python never intend to support private, protected and public?

2005-10-02 Thread Paul Rubin
[EMAIL PROTECTED] (Bengt Richter) writes:
> I decided to read this thread today, and I still don't know exactly
> what your requirements are for "private" whatevers. No one seems to
> have discussed what you could do with properties and __getattribute__
> and metaclasses and decorators, yet there are many possibilities
> that might satisfy some or maybe all your requirements. I probably
> missed something...

Well, it's a discussion of why a certain feature might be useful, not
that it's required.  Mike Meyer points out some reasons it might be
hard to do smoothly without changing Python semantics in a deep way
(i.e. Python 3.0 or later).  

The basic notion is that if x.private_var is a private instance
variable on x, then the only functions that are allowed to touch it
are bound methods on x.  Also there has to be some way to stop the
client (the "client" means code that calls methods on x) from
injecting new methods into x's class definition.

Alternatively, if x and y are objects, and the app calls x.foo(y),
then privacy means x cannot see any of y's private variables no matter
what x does (this is sort of the applet model).

Python used to have a module called rexec/Bastion that did something
like this, but required the client to be wrapped in a special
proxy-like object, and it turned out to still have hard-to-fix holes,
so it was removed.  Maybe if Python objects are organized a bit
differently in PyPy, something like Bastion can be done again.

> What "privately" seems to mean is that within a method using
> private_var, you'd still like the code to read self.private_var,
> and not be translated to self.__some_kind_of_extreme_mangling_private_var
> even if the mangling had vanishing collision probability, like a name
> built from a secure hash GUID algorithm, right?

Only if clients were somehow prevented from examining self.__dict__
to find the GUID-like name.

> Also, if an outside access to an instance said inst.private_var = 123
> that would be ok, and bind a public attribute of that name as usual
> without interfering with the methods using the bona fide self.private_var?
> Or should it be an attribute error (which would thus leak the name even
> if it didn't make access possible).

If the mangled name were really long and random, the chance of such a
collision would be negligible.  But I think extreme mangling isn't the
way to go about this.  The right way is with some version of
__getattr__ that's harder to circumvent.

> I take it that a clever subclassing trick (like a post somewhere in
> this thread showed) should not provide access, but how about the
> inspect module?  Or an expression like instance.__dict__[1] if that
> was the sneaky spelling of instance.private_var? (note that integers
> are not allowed for instance attributes, even via get/setattr. (BTW
> & OTOH, interestingly type.__setattribute__(cls, att) allows integer
> att) Where do you want to draw the line?

If it's like Java, stuff like inspect should only work through special
interfaces in the interpreter and not be available to code in the app
unless some flags were set.

> I'm not trying to be provocative, just to get the requirements defined ;-)
> 
> What if you could define a class something like
> 
> class C(object):
> # privatize factory makes callable to make the changes and clean up 
> after itself
> __metaclass__ = privatize(method_foo='private_var1 pv2', 
> method_bar='pv2')
> ...
> 
> and have method_foo access self.private_var1 and self.pv2 as
> effectively private variables, and method_bar only self.pv2 and
> everything else work as usual? Would that meet your requirements?

I'm not sure; metaclasses confuse me too much.  But I think what I'm
imagining just can't be done in the current definition of Python.
Otherwise rexec/Bastion would be a special case of it and wouldn't
have had to be removed.  It would take a language change to fix it.

> I'm not sure I could do this with just a tricky metaclass, but I am
> pretty sure if you allowed byte-code-munging decoration calls from
> the metaclass to mess with method_foo and method_bar (as specified
> in the privatize factory call args), I could.

Yeah, in the extreme, you could just implement OOP as closures instead
of class instances, like Scheme does.

> This would still leave the access door open via something like
> type(instance).__dict__['method_foo'].func_code.co_consts[1][id(instance),
> 'priv_var'] so, again, where do you want to draw the line. Starting
> and communicating with a slave debugger in another (privilaged)
> process?

Ugh, yes, I guess that would allow reaching inside closures and
getting the variables out.  But it looks CPython-specific.  Maybe with
PyPy, there could be a way to prevent that.

> But the bottom line question is, would you actually use this privacy feature?

I have a crypto library right now that implements private vars by
putting the sensitive objects in a completely separate Python
interpreter from 

Re: Nufox : Xul + Python

2005-10-02 Thread salvatore . didio
You are perfectly right ;-)
And I've been a network technician !!!

I've modified the address, thank you for testing 

Regards

Salvatore

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


Re: Nufox : Xul + Python

2005-10-02 Thread bearophileHUGS
It doesn't work yet, to me...

bearophile

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


Re: Background process for ssh port forwarding

2005-10-02 Thread Jesse Rosenthal
On Sun, 02 Oct 2005 08:44:48 +0200, Fredrik Lundh wrote:

> Jesse Rosenthal wrote:
> 
>> If I end this with 'connection.interact()', I will end up logged in to the
>> forwarding server. But what I really want is to go on and run rsync to
>> localhost port 2022, which will forward to my_server port 22. So, how can
>> I put the ssh connection I set up in hostforward() in the background?
>> I need to make sure that connection is made before I can run the rsync
>> command.
> 
> $ man ssh
> 
> ...
> 
>  -f  Requests ssh to go to background just before command execution.
>  This is useful if ssh is going to ask for passwords or
>  passphrases, but the user wants it in the background.  This
>  implies -n.  The recommended way to start X11 programs at a
>  remote site is with something like ssh -f host xterm.
> 
> ...

Thanks for the response. I had tried that, but the problem is that it
requires that I specify some command on the server (in this case, the
forwarding server) which it executes with ssh in the bg, and then exits.
But maybe I could just run "sleep 10" or something on the server to keep
the port open long enough to ssh through it? I'll give a few things like
that a try.


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


Re: how to send a SIGINT to a Python process?

2005-10-02 Thread [EMAIL PROTECTED]
AFAIK there isn't. You could browse through this
http://starship.python.net/crew/tmick/ to get an idea on how to kill on
both platforms.

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


Setting optimum gtkhtml2 widget size.

2005-10-02 Thread Sam
I'm putting gtkhtml2.View() inside a gtk.ScrolledWindow, which goes into a 
gtk.Dialog.vbox.


How do I obtain gtkhtml2.View's preferred height, and set the dialog's 
height accordingly, given a specific width?


I can do a gtk.Dialog.set_default_size() up front, specifying the width and 
height large enough for everything, then create all the widgets, and realize 
them.


But then, even after I realize everything I can't get any useful metrics 
from gtkhtml2.View().  None of the usual suspects -- get_size_request, 
get_allocation -- give anything useful.


I also tried not using a ScrolledWindow, but adding gtkhtml2 as 
gtk.Dialog.vbox's child.


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

Re: A Moronicity of Guido van Rossum

2005-10-02 Thread Lucas Raab
Xah Lee wrote:

[snip]

>(they tried, with their limited implementation of lambda and
> shun it like a plaque)

Can't say I've heard that expression before...

-- 
--
Lucas Raab
lvraab"@"earthlink.net
dotpyFE"@"gmail.com
AIM:Phoenix11890
MSN:dotpyfe "@" gmail.com
IRC:lvraab
ICQ:324767918
Yahoo:  Phoenix11890
-- 
http://mail.python.org/mailman/listinfo/python-list


python guru.. for a short conversation regarding bittorrent..

2005-10-02 Thread bruce
hi..

i'm not a python developer, but i have a few questions regarding python
(some quite basic), and bittorrent. i'm looking to talk to someone/anyone
who has experience with the infrastructure of bittorrent, not just running a
bittorrent client app...

the bittorrent mailing lists/groups haven't been responsive, so i figured
i'd try here...

if there's anyone here that i could talk with (phone) who's knowledgable
about these areas, i'd appreciate it. i'm trying to get a much better
understanding of the actual underlying app.

thanks

-bruce
[EMAIL PROTECTED]


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


Distributing programs

2005-10-02 Thread Jason
A non-python programming friend of mine has said that any programs made 
with Python must be distributed with, or an alternative link, to the 
source of the program.

Is this true?

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


Re: Distributing programs

2005-10-02 Thread Fredrik Lundh
Jason wrote:

> A non-python programming friend of mine has said that any programs made
> with Python must be distributed with, or an alternative link, to the source of
> the program.
>
> Is this true?

no.

the license is here:

http://www.python.org/doc/Copyright.html

   "Python is absolutely free, even for commercial use (including
resale). There is no GNU-like "copyleft" restriction."





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


Re: [OT] A Moronicity of Guido van Rossum

2005-10-02 Thread Matt Garrish

"Lucas Raab" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Xah Lee wrote:
>
> [snip]
>
>>(they tried, with their limited implementation of lambda and
>> shun it like a plaque)
>
> Can't say I've heard that expression before...
>

Burns: I'm afraid it's not that simple.  As punishment for your desertion, 
it's company policy to give you the plague.
Smithers: Uh, sir, that's the plaque.

Matt 


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


Re: Distributing programs

2005-10-02 Thread Jeff Schwab
Jason wrote:
> A non-python programming friend of mine has said that any programs made 
> with Python must be distributed with, or an alternative link, to the 
> source of the program.
> 
> Is this true?

Sorta, but not really.  Typically, you might distribute the source (.py) 
  files, but if you don't want to do that, you can distribute the 
compiled .pyc files instead.  Python creates these files automatically 
when your modules are imported.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Distributing programs

2005-10-02 Thread Fredrik Lundh

> the license is here:
>
> http://www.python.org/doc/Copyright.html
>
>"Python is absolutely free, even for commercial use (including
> resale). There is no GNU-like "copyleft" restriction."

except that the current license is (no longer?) linked from that page.

the current license is here:

http://www.python.org/2.4.2/license.html

more words, but the summary remains the same:

"Python is absolutely free, even for commercial use (including
resale). There is no GNU-like "copyleft" restriction."





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


IDLE dedent/unindent key bindings for non-us keybord?

2005-10-02 Thread gjohannes
Hi.

I use Idle 1.1.1 on Python 2.4.1.

The "Ctrl-[" and "Ctrl-]" key bindings for indenting do not work on
non-us keyboards where brackets are accessed by the "Alt Gr" key.

The Tab key seem to work for indenting a selected textblock on my
swedish keyboard, but Shift-tab does not dedent as you would have
expected.

If I try to redefine key bindings in "options->Configure IDLE->Keys" so
that Shift-Tab is bound to dedent, things seem to get really weird.

After creating a "Custom key set"
- the "Ok"-button does not close the options window, I have to use
"Cancel" to get out.

- Tab does not longer indent selected text, but replaces it with a tab
character instead.

- Shift->Tab does nothing.

- F5 for Run module does nothing

and so on.


What could be wrong here, and do you have any other suggestions for a
"dedent" key binding that may work on a non-us/swedish keyboard (or
maybe an alternative editor for python code).

Thanks.

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


Re: Nufox : Xul + Python

2005-10-02 Thread Andrew Gwozdziewycz
This looks very cool, and i'm sure it's in early stages of  
development (it crashed firefox 1.07 on osx). A question or two.
In the button click example, when I got there, it said I had clicked  
17 times, though I had not clicked.
 Is the application reinitialized on load?
Is it just a python cgi or is running on top of some framework like  
cherryPy?

Regards


On Oct 2, 2005, at 8:10 AM, [EMAIL PROTECTED] wrote:

> You are perfectly right ;-)
> And I've been a network technician !!!
>
> I've modified the address, thank you for testing
>
> Regards
>
> Salvatore
>
> -- 
> http://mail.python.org/mailman/listinfo/python-list
>
---
Andrew Gwozdziewycz
[EMAIL PROTECTED]
http://ihadagreatview.org
http://plasticandroid.org


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


Re: Class Help

2005-10-02 Thread Ivan Shevanski
Thanks everyone for helping me out and tolerating the noob question =D  The 
last part was confusing to me and thanks for explaining it so I get it!


-Ivan

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

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


Re: Will python never intend to support private, protected and public?

2005-10-02 Thread John Perks and Sarah Mount
> 1) Something that fixes the broken name mangling in the current
> system, but still doesn't try to defeat intentional unmangling.
> Currently, if you have a class with the same name as one of its
> superclasses, the name mangling can fail even its existing purpose of
> preventing accidental collisions.

None of what follows offers any protection against malice, but at least
"normal" use will be safe. Are there any other idioms where __dict__s
are used as dumping grounds for strange objects, in particular
superclasses of that object?

(For this to work the instance needs a __dict__; fully __slots__'d
objects won't be amenable to it)

Instead of mangling in the class name:

class C:
def __init__(self, x):
self.__x = x

One could mangle in the class itself:

class C:
def __init__(self, x):
self.__dict__[C, 'x'] = x

(and retrieve similarly). Now classes with the same name are still
regarded as distict. A variation on this is to have a single __dict__
entry for the class, which refers to another dict, so we would have
something like

def __init__(self, ...):
   privates = { }
   self.__dict__[C] = privates
   # ...

def f(self...):
privates = self.__dict__[C]
# ...

and then get or set privates[varName] as needed. (Or possibly use it
lazily via setdefault if you have a good idea of the what the defaults
should be.)

However this means non-strings end up in dir() which may cause things
like map str.upper, dir(C())) to fail. Thus instead of C as the key we
could use `id(C)`.

The only chance for collision I can see in the `id` solution is if an
object changes its __class__, then the old class is GC'd, a new one is
loaded with the same address as the old, and the __class__ is changed to
(a subclass of) this new one. Frankly __class__ reassignment is fairly
esoteric, and already has the question of how well the __dict__ from the
old type masquerades as a new one.

Other scope for collision: if the classes in question are instances of
some mad metaclass which defines == to mean something other than
identity testing (is). This would only be needed if the objects weren't
just used as types, but also something else as well (e.g. collections of
all their instances, implemented via weakrefs).

Note that this won't quite work for private data in new classes, as
their __dict__ is read-only, but I offer the following peculiar hack:

class K(object):
__dict__ = {}
# ...

Any normal accesses to K.__dict__ will reach the wrapping dictproxy
object, but K.__dict__['__dict__'] is all yours to play with. If you
start by assigning __dict__ to locals() in the class initializer, then
writes to K.__dict__['__dict__'] will be visible just through
K.__dict__. Whether that's desirable or not depends on you. (locals()
isn't what you want if you're creating truly dynamic types via
type(names, bases, dict), though.)

Paranoid/super-open-minded types might wish to replace accesses to
__dict__ here with calls to object.__getattribute__(...,'__dict__') in
case any subclasses have strange semantics (which may make perfect sense
as far as they're concerned, but still potentially be a problem for you
having to second-guess them.)

Hope this helps

John

PS Only slightly relevant: when checking out the possibilties for
private attrs on types, I ran up against dictproxies. What need did they
meet over plain dicts, why are they read-only (at the Python and CPython
level), why are they not instantiable directly (though you can always
just create a temporary type and steal its __dict__), and why is type's
__dict__ is read-only but a class's isn't? I just have down'n'dirty type
dict munging to do, and it seems retrograde that it only works with old
(and nominally less flexible) classes.


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


Re: Nufox : Xul + Python

2005-10-02 Thread Salvatore
As you said this is in early stage  0.1-alpha-alpha :-)
I'm not the author of this interesting piece of work it is Tim Stebbing
I only wanted to share Tim's work.
Don't hesitate to contact him on the nufox mailin list
It runs on top of twisted-nevow.
Indeed for now the application is not reinitialized on load, but those
are
simple examples and there is not yet 'session object'

Regards

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


forum

2005-10-02 Thread csheppard91
Forum commuication is easier, and I've just started a new forum and
would like to  invite all of you to sign up and post there.  I'm still
looking for moderators and anyone who will help out.  If you are
intersted: www.wizardsolutionsusa.com -- follow the forum link.
Remember it doesn't take but a minute of your time to sign up, so help
me out!

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


Re: output events on select

2005-10-02 Thread Piet van Oostrum
> "Tor Erik Sønvisen" <[EMAIL PROTECTED]> (TES) wrote:

>TES> When using select, what exactly will trigger an output-event? I have
>TES> a socket registered in the output-list of the select but an
>TES> output-event is never generated for that socket. I know the socket is
>TES> ready to send data, so how can I make select return with an
>TES> output-event?

It is better to talk about status than event. The select should return the
socket in the ready set for write when a write on that socket can be done
without blocking. So if it doen't return it then something is wrong. This
is on Unix systems, by the way. On Windows things might be different.
-- 
Piet van Oostrum <[EMAIL PROTECTED]>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Distributing programs

2005-10-02 Thread Leif K-Brooks
Jeff Schwab wrote:
> Sorta, but not really.  Typically, you might distribute the source (.py)
>  files, but if you don't want to do that, you can distribute the
> compiled .pyc files instead.  Python creates these files automatically
> when your modules are imported.

But remember that Python bytecode can be easily decompiled with a
publicly-available program.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Will python never intend to support private, protected and public?

2005-10-02 Thread El Pitonero
Bengt Richter wrote:
>
> I decided to read this thread today, and I still don't know exactly
> what your requirements are for "private" whatevers.

No name collision in subclassing. Notice that even if you use

self._x = 3

in a parent class, it can be overriden in a sub-sub-class accidentally.

> Or maybe, what are your real requirements?
> ;-)

No need for this type of joke.

For people coming from Java/C++ camp, (especially Java camp,) they
think they've got something good with the private class variable, and
they think the lack of an exact equivalent in Python means Python is
lesser in this regard.

The thing is, there are two sides to every coin. Features surely can be
viewed as "goodies", or they can be viewed as "handcuffs".

Python's lack of Java-style "private" surely has its drawback: name
collisions can happen. But, that's just one side. Name collisions are
allowed in many dynamic languages, where you can override the default
system behavior (in some languages, you can override/intercept the
assignment operator "=", or even the "if" statement and the "while"
loop.) Sure, in these very dynamic languages you can ACCIDENTALLY
override the default system behavior. How many Python programmers have
once upon a time done stupid things like:

list = 3

, without realizing that list() is a Python function? This type of
accidental overriding DOES happen. Similarly, in large and complicated
Python projects, name collision (even for "self._x" type of private
members) CAN happen, and I am sure it has happened for some people.

Now the question is: for average people and average project, how often
does this type of error happen? If people really cool down their heads
and don't talk emotionally, and base on their real experience
throughout the years, the truth is that this type of error just doesn't
happen that often. And even if it does happen, the error is usually
fatal enough to be detected.

OK, I have said that not having Java-style "private" has one downside
in Python. But what's the upside?

Not having "private" in Python closes one door, but opens another door.

The upside is exactly the same as the fact that you can override the
"list()" function in Python. Python is dynamic language. Like others
have pointed out, you can not even be sure about the variable content
of a class/object during runtime. In Java, you cannot override your
private members during runtime. In Python, if you have a private
variable:

self._x = 3

and you, for curiosity reasons and DURING runtime (after the program is
already up and running) want to know the exact moment the self._x
variable is accessed (say, print out the local time), or print out the
calling stack frames, you can do it. And I mean the program is running.

In Java, you would have to stop the program, re-write/re-implement
changes, re-compile, re-start the program, etc. etc.

The thing is, Python allows you to do runtime dynamic programming much
more easily than Java/C++. This type of dynamic and metaprogramming are
kind of unthinkable in the C++/Java world. Sure, these are advanced
programming features that not everybody uses, but Python leaves the
door open for those who want to take advantage of these powerful
features.

The fact that you can override Python's "list()" function can be either
viewed as pro or con. The fact that you can override member variables
can also be viewed as pro or con.

Would any Python programmer trade the benefits of a highly dynamic
language with an unessential feature like Java-style "private" data
members? My guess is not.

---

What do I say Java-style "private" is unessential?

If your Python class/object needs a real Java-style private working
namespace, you have to ask yourself: do the private variables REALLY
belong to the class?

In my opinion, the answer is: NO. Whenever you have Java-style private
variables (i.e, non-temporary variables that need to persist from one
method call to the next time the class node is accessed), those
variables/features may be better described as another object, separate
from your main class hierarchy. Why not move them into a foreign worker
class/object instead, and let that foreign worker object hold those
private names, and separate them from the main class hierarchy? (In
Microsoft's jargon: why not use "containment" instead of
"aggregation"?)

That is, the moment you need Java-style private variables, I think you
might as well create another class to hold those names and
functionalities, since they do not belong to the core functionality of
the main class hierarchy. Whatever inside the core functionality of the
main class, should perhaps be inheritable, sharable and modifiable.

If you use containment instead of aggregation, the chance for name
collision reduces dramatically. And in my opinion, it's the Pythonic
way of dealing with the "private" problem: move things that don't
belong to this object to some other object, and be happy again.

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

Re: Distributing programs

2005-10-02 Thread Steve Bergman
Leif K-Brooks wrote:

>But remember that Python bytecode can be easily decompiled with a
>publicly-available program.
>  
>
I hope it is not considered too antisocial to bring it up here, but 
there is always PyObfuscate:

http://www.lysator.liu.se/~astrand/projects/pyobfuscate/

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


Re: python guru.. for a short conversation regarding bittorrent..

2005-10-02 Thread Paul Rubin
"bruce" <[EMAIL PROTECTED]> writes:
> if there's anyone here that i could talk with (phone) who's knowledgable
> about these areas, i'd appreciate it. i'm trying to get a much better
> understanding of the actual underlying app.

There's a #bittorrent irc channel on irc.freenode.net.  Try there.
-- 
http://mail.python.org/mailman/listinfo/python-list


Question about stdin and PATHEXT on Windows XP

2005-10-02 Thread Lasse Vågsæther Karlsen
I got a loop like this:

 while True:
 line = sys.stdin.readline()
 if not line:
 break
 line = line.rstrip()
 log_message(options.channel_name, line)
 print line

this loop will read text if I execute it from a command prompt like this:

dir | python.exe log.py

however, since I've set PATHEXT to contain .PY, I tried this:

dir | log.py

which ended up with the loop just skipping.

Does anyone know how to fix this problem ? Being able to use PATHEXT 
execution (just execute python file directly) and still being able to 
grab stdin? I assume that since there is some magic involved in invoking 
python.exe here, stdin gets munged on the way.

-- 
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:[EMAIL PROTECTED]
PGP KeyID: 0x2A42A1C2
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question about stdin and PATHEXT on Windows XP

2005-10-02 Thread Lasse Vågsæther Karlsen
Lasse Vågsæther Karlsen wrote:
> I got a loop like this:


Ok, I've found some information. I don't like the answer but it doesn't 
seem to be any good way to do this without hacking it one way or the other.

If someone has a brilliant answer that isn't in google yet, please let 
me know.

-- 
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:[EMAIL PROTECTED]
PGP KeyID: 0x2A42A1C2
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: forum

2005-10-02 Thread Sam Francke
[EMAIL PROTECTED] wrote at 2-10-2005 19:00:23:

>Forum commuication is easier, and I've just started a new forum and
>would like to  invite all of you to sign up and post there.

I don't agree with you, I like news-commuication. It's more free than
forum use.

-- 
with kind regards / met vriendelijke groeten
Sam Francke
-- 
http://mail.python.org/mailman/listinfo/python-list


Virgin keyword (Was: Will python never intend to support private, protected and public?)

2005-10-02 Thread Roy Smith
"El Pitonero" <[EMAIL PROTECTED]> wrote:
> Python's lack of Java-style "private" surely has its drawback: name
> collisions can happen. But, that's just one side. Name collisions are
> allowed in many dynamic languages, where you can override the default
> system behavior (in some languages, you can override/intercept the
> assignment operator "=", or even the "if" statement and the "while"
> loop.) Sure, in these very dynamic languages you can ACCIDENTALLY
> override the default system behavior. How many Python programmers have
> once upon a time done stupid things like:
> 
> list = 3
> 
> , without realizing that list() is a Python function? This type of
> accidental overriding DOES happen. Similarly, in large and complicated
> Python projects, name collision (even for "self._x" type of private
> members) CAN happen, and I am sure it has happened for some people.

I think everybody would agree that accidentally overwriting a name because 
you didn't realize it was defined in an enclosing context is a Bad Thing.  
The classic (C++/Java) solution has been to have classes protect their 
members from outside exposure.

I wonder if a better solution would be to have the protection applied from 
the other end?  Imagine if we had a "virgin" keyword which could modify the 
assignment statement to assert that the name being assigned to was not 
currently in use.  Thus

virgin x = y

would be treated sort of as if it had been written (ignore, for the moment, 
the possible side effects of the extra eval of x)

try:
   x
except NameError:
   throw ChastityError
else:
   x = y

This would provide you protection from stomping on names by accident, but 
it would allow you to stomp all you wanted if you wanted to.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Distributing programs

2005-10-02 Thread Wouter van Ooijen (www.voti.nl)
>A non-python programming friend of mine has said that any programs made 
>with Python must be distributed with, or an alternative link, to the 
>source of the program.

Yes, and you must also include a blank sheet, signed by you in blood.

Seriously, whatever the license of Python itself is, a program you
have *written in Python* (which Iassume you are referring to) is
completely yours.


Wouter van Ooijen

-- 
http://www.voti.nl
Webshop for PICs and other electronics
http://www.voti.nl/hvu
Teacher electronics and informatics
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Statement orders

2005-10-02 Thread David Murmann
Fredrik Lundh wrote:
> Monu Agrawal wrote:
> 
>> Hi I am making a gui based tool. When user preses a perticular button I
>> am running a heavy command, before this I want to say user to wait with
>> a image showing infront of her.
>>
>> My code is like:
>>
>> def loadData(self):
>>top=Toplevel(self.parent)
>>top.focus_set()
>>self.parent.wm_title("Loading Data...")
> 
> +top.update() # flush the event queue
> 
>>os.system('a heavy command')
>>os.system('another heavy command)
>>top.destroy()
> 
> 

I had a very similar problem and adding an update call solved it, but
in some tk documentation i read that one should be careful with adding
update calls to callbacks and prefer update_idletasks. in my case the
update method is even called one time before the mainloop is entered,
yet everything seems to work fine, so exactly when is it dangerous to
call update? (or is it dangerous at all?)

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


Re: Distributing programs

2005-10-02 Thread Steve Bergman
Wouter van Ooijen (www.voti.nl) wrote:

>Yes, and you must also include a blank sheet, signed by you in blood.
>  
>
I thought you only had to do that if you were submitting a patch to 
MySQL, Qt, OpenOffice, or OpenSolaris.  ;-)

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


Re: Will python never intend to support private, protected and public?

2005-10-02 Thread Gregor Horvath
El Pitonero schrieb:
> 
> The fact that you can override Python's "list()" function can be either
> viewed as pro or con. The fact that you can override member variables
> can also be viewed as pro or con.
> 

If there is a tool like pyChecker, which can detect such pitfalls and 
warns but not forbidds - one can avoid the cons and still can use the pros.
The computer should be an assistent not a dominator of humans.

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


Re: OT: Phases of the moon [was Re: A Moronicity of Guido van Rossum]

2005-10-02 Thread Matija Papec
X-Ftn-To: Paul F. Dietz 

"Paul F. Dietz" <[EMAIL PROTECTED]> wrote:
>> As a similar example: I've been told by various women independently,
>> that "there are more babies born near a full moon."
>
>That's also a myth.

Perhaps not, consider deamon or vampire babies.
























:)


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


mod_python works as standalone, does not as service (Windows XP)

2005-10-02 Thread tt
My mod_python 3.1.4 installation works when Apache 2.0.54 is run in
standalone mode (apache -k standalone) but refuses to operate when run
as a service (apache -k restart).

Logs yield the usual and well-known "make_obcallback: could not import
mod_python.apache" error. I have tried PYTHONHOME, LoadFile
python24.dll (2.4.2) with no result.

I have read *all* threads about make_obcallback that google found.
What's even weirder I had this module working yesterday but had to make
apache cleanup (fresh installation) and now this is completely stuck. I
remember that last time I just had to reinstall Apache over existing
mod_python files to get it working but this time it just pointless.

I thank everyone who understand differences between standalone and
service modes of Apache better than I do.

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


Re: Statement orders

2005-10-02 Thread jepler
Here's one case where it's bad to call update.

def perform_longrunning_calculation():
time.sleep(1)
app.update()
time.sleep(1)

suppose you kick this off with a keybinding, such as:
app.bind("c", lambda e: perform_longrunning_calculation())
the calculation takes 2 seconds, and after 1 second update() is called,
possibly to make sure that the user interface is repainted.

But imagine that in the first second, "c" has been pressed.  That event will
be handled, and perform_longrunning_calculation will be entered *again*,
recursively.  The nesting looks something like this:
  app's mainloop
handling keypress
  perform_longrunning_calculation()
app.update()
  handling keypress
perform_longrunning_calculation()
by calling update_idletasks instead of update, the keypress event is not
handled, so it's impossible to enter perform_longrunning_calculation a
second time.

Jeff


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

Re: Will python never intend to support private, protected and public?

2005-10-02 Thread Paul Rubin
Mike Meyer <[EMAIL PROTECTED]> writes:
> > Yes, the point is that it's something that you can check for by
> > examining the class in question without having to examine any other
> > classes.
> 
> That's a pretty restrictive convention to follow.

What convention?  It just makes it possible to write code with some
specific invariants if there's a need to do so.

> For instance, I might want an error dialog to be a private variable
> of a class representing a window - after all, I don't want anyone
> else writing to it, or using it in any way. Except, of course, for
> any GUI framework routines I have to pass it to in order to use
> it. This problem crops up for every utility routine in every library
> I might want to use. Opening files by name, concatenatting strings
> (or are we going to have a convention that implicit invocation of
> functions with the operator syntax don't count, and another one that
> you don't overload operators with destructive functions, and so on), etc.

I just don't understand your point here.  Yes, you can do all those
things and leak any variable.  However, if you want to NOT leak some
particular variable, "private" lets you code in a way that lets you
easily confirm that you didn't leak it.

> So it turns out that getting the behavior you desire involves
> following a lot of conventions.

That improves on the current situation.  Right now the behavior is
impossible to obtain in Python no matter how many conventions you
follow, unless you follow them through a whole program of arbitrary
size instead of just in the class that you're trying to protect a
variable in.  And when you do it through that much code, it becomes
extremely hard to confirm by inspection that they're followed.  That's
why we have things like the principle of least privilege.

> File scope isn't good enough for python.
> 
> import madhouse
> madhouse.len = my_len_breaker

Ugh, yeah.  IIRC, rexec dealt with this using a special import hook
that stopped you from importing.  For an unrestricted client, maybe
there would have to be some special import that restores the builtins.

> In other words, by adding private to python, you're making it so that
> bugs involving overwriting a private attribute will involve only the
> owning classes code so long as everyone follows the conventions that
> exist about the use of such variables.

Not everyone, just the author of the class that uses the private
variable.  That's the point.

> > I don't see how pylint could know which instances to flag,
> 
> I was thinking it would flag any use of such a variable where the
> target variable wasn't "self". That may be a stronger constraint than
> you wanted - but that's good, right?

Shrug.  That might be of some limited usefulness, but all it tries to
do is prevent accidents.  And it does nothing about setattr/getattr.
-- 
http://mail.python.org/mailman/listinfo/python-list


mod_python works as standalone, does not as service (Windows XP)

2005-10-02 Thread Tau
My mod_python 3.1.4 installation works when Apache 2.0.54 is run in
standalone mode (apache -k standalone) but refuses to operate when run
as a service (apache -k restart).

Logs yield the usual and well-known "make_obcallback: could not import
mod_python.apache" error. I have tried PYTHONHOME, LoadFile
python24.dll (2.4.2) with no result.

I have read *all* threads about make_obcallback that google found.
What's even weirder I had this module working yesterday but had to make
apache cleanup (fresh installation) and now this is completely stuck. I
remember that last time I just had to reinstall Apache over existing
mod_python files to get it working but this time it just pointless.

I thank everyone who understand differences between standalone and
service modes of Apache better than I do.

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


Re: A Moronicity of Guido van Rossum

2005-10-02 Thread Michael
Xah Lee wrote:

> as i have hinted
> ( http://xahlee.org/perl-python/list_comprehension.html ), the
> so-called List Comprehension is just a irregular syntax to facilitate
> generating lists. The name is a terrible jargon, and the means is also
> quite fucked up. The proper name should be something like
> ListGenerator, and the proper means should be the plain function.

List comprehensions get their name (AFAICT) very clearly from set
comprehensions in mathematics. As a result anyone who has ever seen
a set comprehension in maths goes "oooh, I see". They're not the same, but
IMO they're close enough to warrant that name.

> i'm running a project that will code Table in Perl and Python and Java.
> You can read about the spec and source code here:
> http://xahlee.org/tree/Table.html
> (note: the Python version there isn't complete)

I just took a look at your python version. I'd agree it's incomplete. Indeed
it doesn't implement what you say it does. You seem to have re-invented
"apply" since you simply (badly) pass a set of arguments provided by the
user to a function provided by the user.

The description of the code you are pointing at bears absolutely no
resemblance whatsoever to the functionality you describe.

And you criticise the way other people name & describe their code,
when you can't show the skills you criticise in others? I know naming and
documentation are not easy skills, and if people take a *civil* tone in
suggested improvements, criticism (and suggestions) can be helpful.

However, I'd suggest /finishing/ your glass house /before/ you start
throwing stones, or else you'll never be able to smash it up the
neighbourhood properly.


Michael.

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


Re: RELEASED Python 2.4.2 (final)

2005-10-02 Thread Martin v. Löwis
Bugs wrote:
> - I had an old ActiveState python24.dll in \windows\system32 which I
> deleted.  That must've been left over from a 2.4.1 ActiveState
> installation which I had installed then uninstalled sometime ago.
> 
> - I then uninstalled Python 2.4.2 and re-installed it for "all" users.
> After that everything seemed to work properly.

That is somewhat mysterious...

> I'm not sure where the Python 2.4.2 installation put it's python24.dll?

It depends on whether this is a "for all" installation, or a "just for
me" installation. In the "for all" installation, it goes to
\windows\system32. In the "just for me" installation, it goes to
c:\python24 (ie. the directory where python.exe is). The rationale
is that a non-admin user might not have enough permissions to
write to system32.

> Please let me know if you need additional details.

It would be good if you could recall what mode the original 2.4.2
installation had. If it was "just for me", then you might have
installed the 2.4.2 version of python24.dll into the python directory.
Still, it is then puzzling why it would have used the version in
system32, as the application's (i.e. python.exe) directory should
be searched first.

For the record, please also report what operating system you
were using.

The other theory is that the 2.4.2 installer failed to overwrite
the ActivePython version. This should not have happened, though,
since the installer should have noticed that the 2.4.2 version
is newer than the 2.4.1 one (and indeed, in a test installation,
it did so correctly).

It is probably too late to recreate all details, so we should
just watch whether it happens again.

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


Re: Statement orders

2005-10-02 Thread David Murmann
[EMAIL PROTECTED] wrote:
> Here's one case where it's bad to call update.
> 
>   def perform_longrunning_calculation():
>   time.sleep(1)
>   app.update()
>   time.sleep(1)
> 

would it be advisable to guard against this with something like this?

def perform_longrunning_calculation():
 if not app.busy:
 app.busy = 1
 time.sleep(1)
 app.update()
 time.sleep(1)
 app.busy = 0

or does this have flaws i'm not seeing?

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


Parrot & Python ?

2005-10-02 Thread Do Re Mi chel La Si Do
Hi !

On the site of Amber :  http://xamber.org/index.html
We can to view the sentence : "Parrot version of Python"
Question :  what is "Parrot version of Python" ?

@-salutations

Michel Claveau










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


Program help

2005-10-02 Thread FX
can anybody write a code for a program that reads from a
/location/file & according to file contents, it execute script. e.g. if
file contains "mp" it runs media player.
I hope the code is small .. plz help me out!

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


struct.unpack

2005-10-02 Thread g.franzkowiak
Hello Everybody,

I've read a pipe and store it in a object.
My next step was the separation from 4 bytes with
obj = string.join(list(dataObject)[:4]  ==> '\x16 \x00 \x00 \x00'
and the converting  by
value = struct.unpack('I', obj) generated the error
"unpack str size does not match format"

Unfortunately is len(obj) 7, but integer lengt 4.
Why 7 ?

Any ideas ?

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


Re: Program help

2005-10-02 Thread Jeff Schwab
FX wrote:
> can anybody write a code for a program that reads from a
> /location/file & according to file contents, it execute script. e.g. if
> file contains "mp" it runs media player.
> I hope the code is small .. plz help me out!

You might be interested in the FileInfo class, defined and thoroughly 
explained in _Dive Into Python_.

http://diveintopython.org/object_oriented_framework/index.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Will python never intend to support private, protected and public?

2005-10-02 Thread Mike Meyer
Paul Rubin  writes:
> Mike Meyer <[EMAIL PROTECTED]> writes:
>> > Yes, the point is that it's something that you can check for by
>> > examining the class in question without having to examine any other
>> > classes.
>> 
>> That's a pretty restrictive convention to follow.
>
> What convention?  It just makes it possible to write code with some
> specific invariants if there's a need to do so.

That you don't pass private variables to a function unless it's a
buitin. Python is *not* a strict OO language, and uses utility
functions for lots of things. To make private work the way you have to
change the library to use a strict OO approach, probably including
providing a real hierarchy instead of just duck typing.

>> So it turns out that getting the behavior you desire involves
>> following a lot of conventions.
>
> That improves on the current situation.  Right now the behavior is
> impossible to obtain in Python no matter how many conventions you
> follow, unless you follow them through a whole program of arbitrary
> size instead of just in the class that you're trying to protect a
> variable in. 

Just adding private doesn't change this significantly - it just makes
the compiler enforce one of the large number of conventions you have
to follow.

>> In other words, by adding private to python, you're making it so that
>> bugs involving overwriting a private attribute will involve only the
>> owning classes code so long as everyone follows the conventions that
>> exist about the use of such variables.
> Not everyone, just the author of the class that uses the private
> variable.  That's the point.

Except that, with Python as it exists today with a private keyword
added, it's *still* everyone. The only convention breaking the private
keyword would allow the compiler to catch is a reference to
foo.private. It wouldn't catch overriding things in __builtins__ or
overriding builtins in a module, or things poking at the variable
through __dict__, or - well, there are probably lots of things that
need to be dealt with.

>> > I don't see how pylint could know which instances to flag,
>> I was thinking it would flag any use of such a variable where the
>> target variable wasn't "self". That may be a stronger constraint than
>> you wanted - but that's good, right?
> Shrug.  That might be of some limited usefulness, but all it tries to
> do is prevent accidents.  And it does nothing about setattr/getattr.

Preventing accidents is all "private" does - without fundamental
changes to the implementation of the language. You have to catch every
mechanism that can be used to find a reference to an attribute, like
references to __dict__ and to the class variable.

  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: struct.unpack

2005-10-02 Thread Fredrik Lundh
"g.franzkowiak" wrote:

> I've read a pipe and store it in a object.
> My next step was the separation from 4 bytes with
> obj = string.join(list(dataObject)[:4] ==> '\x16 \x00 \x00 \x00'
> and the converting  by
> value = struct.unpack('I', obj) generated the error
> "unpack str size does not match format"
>
> Unfortunately is len(obj) 7, but integer lengt 4.
> Why 7 ?

because string.join inserts a space between the bytes, by default (as
your example shows)

if you really need that join(list) thing (it's not clear how you read it, but
I find it a bit hard to believe that you've managed to read it into some-
thing that's supported by list but not unpack), you can do

obj = string.join(list(dataObject)[:4], "")

or

obj = "".join(list(dataObject[:4]))

or some variation thereof.





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


Re: A Moronicity of Guido van Rossum

2005-10-02 Thread Fredrik Lundh
"Michael" wrote:

> List comprehensions get their name (AFAICT) very clearly from set
> comprehensions in mathematics. As a result anyone who has ever seen
> a set comprehension in maths goes "oooh, I see". They're not the same, but
> IMO they're close enough to warrant that name.

fwiw, they've also been around for ages:

http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?list+comprehension

(the name goes back to the early eighties, the construct is older than that)





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


Re: Will python never intend to support private, protected and public?

2005-10-02 Thread Mike Meyer
Paul Rubin  writes:
> Well, it's a discussion of why a certain feature might be useful, not
> that it's required.  Mike Meyer points out some reasons it might be
> hard to do smoothly without changing Python semantics in a deep way
> (i.e. Python 3.0 or later).  

Actually, I think that the semantic changes required to make private
do what you want are deep enough that the resulting language wouldn't
be Python any longer. It has deep implications from the interpeter
implementation all the way out to the design of the standard library,
all of which would have to be reworked to make private do "the right
thing."

Not that I think that private is a bad idea. If I'm not writing
python, then I'm probably writing Eiffel. Eiffel has facilities for
protecting features, though the design is more consistent than the
mishmash one gets in C++/Java. Nuts - in Eiffel, you can't write
"instance.attribute = value"; assignment to an attribute has to be
done in a method of the owning instance.

Which brings me to my point. Rather than trying to bandage Python to
do what you want - and what, based on this thread, a lot of other
people *don't* want - you should be building a system from the ground
up to support the kind of B&D environment you want.

Of course, you do realize that in practice you can *never* get what
you want. It assumes that the infrastructure is all bug-free, which
may not be the case.

For example, I once had a system that took a kernel panic trying to
boot an OS upgrade. It had been running the previous versionn of the
OS for most of a year with no problems. Other basically identical
systems ran the upgraded OS just fine. I finally wound up stepping
through the code one instruction at a time, to find that the
subroutine invocation instruction on this machine was setting a bit in
a register that it wasn't supposed to touch, but only in kernel
mode. An internal OS API change meant it only showed up in the
upgraded OS.

The infamous Pentium floating point bug shows that this case isn't
restricted to failing hardware.

 http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Program help

2005-10-02 Thread Mike Meyer
"FX" <[EMAIL PROTECTED]> writes:

> can anybody write a code for a program that reads from a
> /location/file & according to file contents, it execute script. e.g. if
> file contains "mp" it runs media player.
> I hope the code is small .. plz help me out!

open http://www.mired.org/downloads/ > will use the extension to
figure out what to do. It's relatively small.

 http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


"no variable or argument declarations are necessary."

2005-10-02 Thread James A.Donald
I am contemplating getting into Python, which is used by engineers I
admire - google and Bram Cohen, but was horrified to read

"no variable or argument declarations are necessary."

Surely that means that if I misspell a variable name, my program will
mysteriously fail to work with no error message.

If you don't declare variables, you can inadvertently re-use an
variable used in an enclosing context when you don't intend to, or
inadvertently reference a new variable (a typo) when you intended to
reference an existing variable.

What can one do to swiftly detect this type of bug?


--
http://www.jim.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Statement orders

2005-10-02 Thread jepler
> would it be advisable to guard against this with something like this?
> 
> def perform_longrunning_calculation():
>  if not app.busy:
>  app.busy = 1
[...]
By using that kind of construct, instead of using update_idletasks(), 
you force all code to be aware of and manage the app.busy flag.

Another difference is that with the original code changed to use
update_idletasks(), perform_longrunning_calculation *will* be called
twice, the second time after the first one completes.  With your code,
it will be called once if the second keypress comes within one second, and
twice if called after one second is up. (though a second update before setting
busy back to false will make it be called only once)

So in also depends on what you want your application to do in these cases.

Jeff


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

Re: "no variable or argument declarations are necessary."

2005-10-02 Thread D H
James A. Donald wrote:
> I am contemplating getting into Python, which is used by engineers I
> admire - google and Bram Cohen, but was horrified to read
> 
> "no variable or argument declarations are necessary."
> 
> Surely that means that if I misspell a variable name, my program will
> mysteriously fail to work with no error message.
> 
> If you don't declare variables, you can inadvertently re-use an
> variable used in an enclosing context when you don't intend to, or
> inadvertently reference a new variable (a typo) when you intended to
> reference an existing variable.
> 
> What can one do to swiftly detect this type of bug?

It's a fundamental part of python, as well as many other scripting 
languages.
If you're not comfortable with it, you might try a language that forces 
you to declare every variable first like java or C++.
Otherwise, in python, I'd recommend using variable names that you can 
easily spell.  Also do plenty of testing of your code.  It's never been 
an issue for me, although it would be nicer if python were 
case-insensitive, but that is never going to happen.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "no variable or argument declarations are necessary."

2005-10-02 Thread Will McGugan
James A. Donald wrote:
> I am contemplating getting into Python, which is used by engineers I
> admire - google and Bram Cohen, but was horrified to read
> 
> "no variable or argument declarations are necessary."
> 
> Surely that means that if I misspell a variable name, my program will
> mysteriously fail to work with no error message.
> 
> If you don't declare variables, you can inadvertently re-use an
> variable used in an enclosing context when you don't intend to, or
> inadvertently reference a new variable (a typo) when you intended to
> reference an existing variable.
> 
> What can one do to swiftly detect this type of bug?

A variable has to be assigned to before it is used, otherwise a 
NameError exception is thrown..

 >>> a + 1
Traceback (most recent call last):
   File "", line 1, in ?
NameError: name 'a' is not defined
 >>> a = 1
 >>> a + 1
2

Typos in variable names are easily discovered unless the typo happens to 
exist in the current context.

Will McGugan
-- 
http://www.willmcgugan.com
"".join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in 
"jvyy*jvyyzpthtna^pbz")
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "no variable or argument declarations are necessary."

2005-10-02 Thread Jean-François Doyon
Wow, never even occured ot me someone would have a problem with this!

But, this might help:

http://www.logilab.org/projects/pylint

In more detail:

 > Surely that means that if I misspell a variable name, my program will
 > mysteriously fail to work with no error message.

No, the error message will be pretty clear actually :) You are 
attempting to use a variable that doesn't exist!  This would be the same 
type of message you would get from a compiled language, just at a 
different point in time (runtime vs. compile time).

 > If you don't declare variables, you can inadvertently re-use an
 > variable used in an enclosing context when you don't intend to,

Possible, though good design should always keep anysuch situation at 
bay.  Python is OO, hence scoping should rarely be a problem ... globals 
are mostly evil, so the context at any given time should be the method, 
you'd need a fairly big and complex method to start loosing track of 
what you called what ... Also, a good naming convention should keep this 
at bay.

Also, because things are interpreted, you don't (normally) need to put 
extensive forthought into things as you do with compiled languages.  You 
can run things quickyl and easily on demand, a misnamed variable will be 
clearly indicated and easily solved in a matter of minutes.

Using a smart IDE might also help prevent such problems before they occur?

Hope you enjoy python :)

J.F.

James A. Donald wrote:
> I am contemplating getting into Python, which is used by engineers I
> admire - google and Bram Cohen, but was horrified to read
> 
> "no variable or argument declarations are necessary."
> 
> Surely that means that if I misspell a variable name, my program will
> mysteriously fail to work with no error message.
> 
> If you don't declare variables, you can inadvertently re-use an
> variable used in an enclosing context when you don't intend to, or
> inadvertently reference a new variable (a typo) when you intended to
> reference an existing variable.
> 
> What can one do to swiftly detect this type of bug?
> 
> 
> --
> http://www.jim.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Automating, Building, Testing and Deploying to Production Server

2005-10-02 Thread yoda
Hi Guys,
I've been used to deploying code to the production server by checking
out of subversion and manually sorting out any kinks. (yes, I know, it
sounds primitive)

I realize I'm losing so much time I could spend more productively. I'd
therefore like to know the different approaches you guys employ to
deploy builds from your staging servers (or laptops:) to the production
server in an automated repeatable safe manner.

How do you automate the process?
What tools do you use and how?
What documentation is available for the various tools?
What is the best, easiest, most automated, method that provides robust
versioning and easy rollback?

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


Python for search engine development

2005-10-02 Thread corebump
hi everybody,
i planinng develop a search engine and i think using the python. Python
performance is enough this project? 

Best Regards

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


Re: struct.unpack

2005-10-02 Thread g.franzkowiak
Fredrik Lundh schrieb:
> "g.franzkowiak" wrote:
> 
> 
>>I've read a pipe and store it in a object.
>>My next step was the separation from 4 bytes with
>>obj = string.join(list(dataObject)[:4] ==> '\x16 \x00 \x00 \x00'
>>and the converting  by
>>value = struct.unpack('I', obj) generated the error
>>"unpack str size does not match format"
>>
>>Unfortunately is len(obj) 7, but integer lengt 4.
>>Why 7 ?
> 
> 
> because string.join inserts a space between the bytes, by default (as
> your example shows)
> 
> if you really need that join(list) thing (it's not clear how you read it, but
> I find it a bit hard to believe that you've managed to read it into some-
> thing that's supported by list but not unpack), you can do
> 
> obj = string.join(list(dataObject)[:4], "")
> 
> or
> 
> obj = "".join(list(dataObject[:4]))
> 
> or some variation thereof.
> 
> 
> 
> 
> 

I've also found the problem with som tests.
The best of this was:
tmpList = list(dataObject)[:4])
obj = tmpList[0]+tmpList[1]+tmpList[2]+tmpList[3].

But your suggestions are much better and new for me - both.

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


Re: Parrot & Python ?

2005-10-02 Thread D H
Do Re Mi chel La Si Do wrote:
> Hi !
> 
> On the site of Amber :  http://xamber.org/index.html
> We can to view the sentence : "Parrot version of Python"
> Question :  what is "Parrot version of Python" ?
> 

Parrot is a virtual machine runtime, like the java vm or .NET CLR.
http://www.parrotcode.org/
People are working on making various scripting languages run on top of 
the parrot vm, like the Amber language you found, and python 
http://pirate.tangentcode.com/ and Lua 
http://members.home.nl/joeijoei/parrot/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python for search engine development

2005-10-02 Thread [EMAIL PROTECTED]
Well, Google applies some Python in their implementation, see
http://www-db.stanford.edu/~backrub/google.html

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


Re: what does 0 mean in MyApp(0)

2005-10-02 Thread Peter Hansen
Alex wrote:
> Thanks for the replies. It seems that I have three options
> 1. app=MyApp()
> 2. app=MyApp(0)
> 3. app=MyApp('myfile.txt')

I just want to emphasize the part of vincent's reply in which he points 
out that using the keyword arguments makes this more readable.

If more examples and actual code would just use the darned "redirect=" 
keyword argument, you probably wouldn't have had to ask the question.

I remember when I had the same question and spent more time than I 
should have had to digging out the answer.  Now I try to make sure that 
all my wx.Apps are initialized with redirect=False or whatever else I 
need to make clear to a reader what I'm doing.  For some widely used and 
understood methods and constructors, using positional arguments might be 
adequate.  For ones like wx.App where everyone initializes them but 
nobody seems to know what the arguments are doing (sometimes they seem 
to be handed down from earlier generations), keyword arguments are a 
real blessing.

The world needs more keyword arguments.  Use them everywhere!  ;-)

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


Python based unacceptable language filter

2005-10-02 Thread David Pratt
Hi.  Is anyone aware of any python based unacceptable language filter 
code to scan and detect bad language in text from uploads etc.

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


Re: "no variable or argument declarations are necessary."

2005-10-02 Thread [EMAIL PROTECTED]
The easiest way to avoid this problem (besides watching for NameError
exceptions) is to use an editor that has automatic name completion.
Eric3 is a good example. So, even though in theory it could be an
issue, I rarely run into this in practice. 

-Don

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


Re: struct.unpack

2005-10-02 Thread Peter Otten
g.franzkowiak wrote:

> tmpList = list(dataObject)[:4])
> obj = tmpList[0]+tmpList[1]+tmpList[2]+tmpList[3].

Have you tried just

obj = dataObject[:4]

without the intermediate list? If that failed, can you tell us the type of
the dataObject? E. g.

>>> print type(dataObject)


Peter

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


Re: A Moronicity of Guido van Rossum

2005-10-02 Thread Michael
Fredrik Lundh wrote:
...
> fwiw, they've also been around for ages:
> 
> http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?list+comprehension
> 
> (the name goes back to the early eighties, the construct is older than
> that)

Ahh... Fair enough. I hadn't come across it as a programming construct until
I hit Python. I'd seen the (presumable) precursor of set comprehension it in
maths & formal methods before though.

To help Xah along, this shows a //more nearly// correct version of his table
function (his doesn't do anything like the spec). It works correctly for
tables of the form:

table("i", ("i",3))
table("i,j", ("i",3), ("j",3))
table("math.cos(i+j)", ("i",3), ("j",-3,3))

It doesn't produce quite the right structure when you have more than
2 iteration rules). 

Problems with this implementation:
   * mkrange() is not passed along the existing context.
 This means tables of the form:
table("i,j", ("i",3), ("j",1,"i"))

 Won't work. This would require changing the mkRange function such
 that it's passed the most currently built environment. This is a
 relatively trivial change, which I'll leave for Xah.

   * The structure is incorrect for more than 2 iteration rules. I think
 I'm missing a simple/obvious trick in my mkTable._extend_table
 function.
 I'm not really fussed though. (It's clearly something dumb :)

   * It's not really clear which list nests which. It's possible the lists
 are nested the wrong way round.

I'm fairly certain that the evalTable code will work fine when the mkTable
code creates the right structure.

I'll leave that to Xah to fix. It's somewhat further along than his
original attempt though. (actually matches his spec for 1 or 2 iteration
rules).

def mkRange(listspec):
if len(listspec)==2:
return xrange(1,listspec[1]+1)
elif len(listspec)==3:
return xrange(listspec[1],listspec[2]+1)
return []

def mkTable(ignore, *listspecs):
def _extend_table(listspecs, result):
if len(listspecs) == 0:
return result
else:
listspec = listspecs[-1]
listspecs = listspecs[:-1]
r2 = []
for R_ in result:
 for R in R_: # SMELLY
inner_result = []
for i in mkRange(listspec):
inner_env2 = dict(R[1])
inner_env2[listspec[0]] = i
inner_result.append( (ignore, inner_env2) )
r2.append(inner_result)
result = _extend_table(listspecs, r2)
return result
return _extend_table(listspecs, 
 [[(ignore,dict(globals()))]]) # SMELLY

def evalTable(table):
if len(table) ==0:
return table
else:
result = []
for evallist in table:
inner_result = []
for eval_args in evallist:
  try:
r = eval(*eval_args)
inner_result.append(r)
  except TypeError:
inner_result.append(evalTable(eval_args))
result.append(inner_result)
return result

def table(ignore, *listspecs):
abstract_table = mkTable(ignore, *listspecs)
return evalTable(abstract_table)

Example:

>>> import math
>>> table("math.cos(i+j)", ("i",3), ("j",-3,3))
[[-0.41614683654714241, 0.54030230586813977, 1.0], [0.54030230586813977,
1.0, 0.54030230586813977], [1.0, 0.54030230586813977,
-0.41614683654714241], [0.54030230586813977, -0.41614683654714241,
-0.98999249660044542], [-0.41614683654714241, -0.98999249660044542,
-0.65364362086361194], [-0.98999249660044542, -0.65364362086361194,
0.28366218546322625], [-0.65364362086361194, 0.28366218546322625,
0.96017028665036597]]

Regards,


Michael.

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


Re: Will python never intend to support private, protected and public?

2005-10-02 Thread Steven D'Aprano
On Sun, 02 Oct 2005 12:05:53 -0700, Paul Rubin wrote:

> I just don't understand your point here.  Yes, you can do all those
> things and leak any variable.  However, if you want to NOT leak some
> particular variable, "private" lets you code in a way that lets you
> easily confirm that you didn't leak it.

I think folks are missing an important point here.

The philosophy of dynamic languages like Python is that the class designer
shouldn't be the only one who decides whether or not a particular variable
should be private or public. The designer can *suggest*, but not force.
The class user is free to ignore that suggestion.

The class designer is assumed to know their class best, and therefore be
in a position to know what variables are dangerous or inconvenient to leak
and which are not. But the class user is the person who knows their own
needs best, and therefore best to know whether their needs are such that
they are willing to take that risk. Why should the class designer get a
monopoly on deciding what the class user can or cannot do?

If you believe that the class designer should have the privilege of
prohibiting certain uses of the class, you will vote for private
variables. If you believe that the class users should have more freedom,
you will vote against them.

"Truly" private variables have an advantage of making the class designer's
life somewhat easier -- not much, but a little. But that advantage comes
at the cost of making the class user's life somewhat harder -- not much,
but a little -- by restricting what they can do. Your private variable may
be just what they need to solve some problem you never even thought of.

Python cannot be all things to all people, although it can be many things.
There are always trade-offs to be made. Java makes the trade-off one way,
Python the other.


-- 
Steven.

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


Re: Program help

2005-10-02 Thread Steven D'Aprano
On Sun, 02 Oct 2005 12:57:29 -0700, FX wrote:

> can anybody write a code for a program that reads from a
> /location/file & according to file contents, it execute script. e.g. if
> file contains "mp" it runs media player.
> I hope the code is small .. plz help me out!

There are lots of people who can do that. Are you asking them to do it for
free, or are you looking to hire a Python developer to design, build and
test your program?

-- 
Steven.

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


Re: Python for search engine development

2005-10-02 Thread Mike Meyer
"corebump" <[EMAIL PROTECTED]> writes:

> hi everybody,
> i planinng develop a search engine and i think using the python. Python
> performance is enough this project? 

If you're going to do the heavy lifting in Python, maybe. It depends
on what you're going to search, and the performance requirements for a
search.

On the other hand, if you use a Python wrapper around a full-text
search facility, so that python finds documents, takes queries and
formats results for the user, it should be just fine.

  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Automating, Building, Testing and Deploying to Production Server

2005-10-02 Thread Mike Meyer
"yoda" <[EMAIL PROTECTED]> writes:

> Hi Guys,
> I've been used to deploying code to the production server by checking
> out of subversion and manually sorting out any kinks. (yes, I know, it
> sounds primitive)

Actually, it sounds like your test/development environment is
primitive.  There shouldn't be any "kinks" to sort out by the time you
check things out on the production server.

> How do you automate the process?

I do what you do - except I use perforce instead of svn, and automate
things. There's a development branch, a test branch, and a production
branch for each project. Developers can check things into the
development branch, and integrate from development to test. QA folks
can integrate from test to production. There are daemon processes
running on the test and production servers that do "p4 sync" ("svn up"
to you) once a minute, thus automatically installing new code on the
appropriate server. The QA folks "sort out the kinks" on the test
server, so that the production server doesn't suffer outages from the
development process.

> What tools do you use and how?

Perforce and the python wrapper for same. And of course Python.

> What documentation is available for the various tools?

Bundled with the tools, and on their web sites for perforce and the
wrapper. Lots for Python, all over the place.

> What is the best, easiest, most automated, method that provides robust
> versioning and easy rollback?

The perforce web site has some white papers on "best practices". I
read those - especially the one on web server software - then
implemented what I described above.

   http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python guru.. for a short conversation regarding bittorrent..

2005-10-02 Thread billie
If it can helps you "ABC" is a (good) bittorent client written in py.


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


Re: Python for search engine development

2005-10-02 Thread gene tani
http://groups.google.com/group/comp.lang.python/browse_thread/thread/6e6dc84e68e25039/1436d0b3466e262a?q=lucene&rnum=1#1436d0b3466e262a

Mike Meyer wrote:
> "corebump" <[EMAIL PROTECTED]> writes:
>
> > hi everybody,
> > i planinng develop a search engine and i think using the python. Python
> > performance is enough this project?
>
> If you're going to do the heavy lifting in Python, maybe. It depends
> on what you're going to search, and the performance requirements for a
> search.
>
> On the other hand, if you use a Python wrapper around a full-text
> search facility, so that python finds documents, takes queries and
> formats results for the user, it should be just fine.
>
>  --
> Mike Meyer <[EMAIL PROTECTED]>
> http://www.mired.org/home/mwm/
> Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

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


Re: "no variable or argument declarations are necessary."

2005-10-02 Thread James A.Donald
James A. Donald:
>  > Surely that means that if I misspell a variable name, my program will
>  > mysteriously fail to work with no error message.

On Sun, 02 Oct 2005 17:11:13 -0400, Jean-François Doyon 
> No, the error message will be pretty clear actually :)

Now why, I wonder,  does this loop never end :-)
egold = 0
while egold < 10:
ego1d = egold+1


--
http://www.jim.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Automating, Building, Testing and Deploying to Production Server

2005-10-02 Thread Paul Rubin
"yoda" <[EMAIL PROTECTED]> writes:
> I realize I'm losing so much time I could spend more productively. I'd
> therefore like to know the different approaches you guys employ to
> deploy builds from your staging servers (or laptops:) to the production
> server in an automated repeatable safe manner.

This is really a wide-ranging question and clpy maybe is not the best
place for it.  Basically every installation does it differently
depending on its requirements.  You could google some phrases like
"continuous integration" and "configuration management" to see some
approaches.  The general outline is:

1) QA dept. has a server configured as identically as possible to the
   production server.

2) Engineering releases a sw version by making a source control
   branch.  QA checks out the branch and tests it against pre-agreed
   release criteria.  If there's differences of opinion about criteria,
   QA manager and engineering manager meet to resolve differences.

3) when QA manager and engineering manager agree to release, code is
   pushed out to production server (same process as release to QA:
   someone logs onto the production server and does an svn update or
   whatever).  How that's done depends on how the server works.  I
   worked at one serious web site which worked as follows.  We had a
   primary server and hot backup (secondary) server, so we did pushes
   by taking the backup server offline, checking out the new build on
   the backup server and running some sanity tests, then launching the
   service on the backup server and taking down the primary, so there
   would be an automatic failover to the backup which was now running
   the new code.  We'd then upgrade the primary the same way, and fail
   over again if desired.  Smaller sites with no hot secondary will
   typically go briefly offline for version upgrade.  Larger sites
   with multiple primaries could have a more gradual process where
   primaries are upgraded one by one, or whatever.

4) Some high availability services (e.g. telecom) need hot upgrade
   (code replacement without stopping the application or interrupting
   connections).  This needs to be built into the app architecture at
   a deep level and I don't think it's what you were asking, but some
   languages like Erlang make provisions for it.

Generally, a release cycle for an online service isn't that much
different than that for a shrink-wrapped software package.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "no variable or argument declarations are necessary."

2005-10-02 Thread Michael
James A. Donald wrote:
> On Sun, 02 Oct 2005 17:11:13 -0400, Jean-François Doyon
> James A. Donald:
>>  > Surely that means that if I misspell a variable name, my program will
>>  > mysteriously fail to work with no error message.
>> No, the error message will be pretty clear actually :)
> Now why, I wonder,  does this loop never end :-)
> egold = 0
> while egold < 10:
>ego1d = egold+1

I know (hope! :-) that's a tongue-in-cheek question, however the answer as
to why that's not a problem is more to do with development habits rather
than language enforcement. (yes with bad habits that can and will happen)

Much python development is test-driven. Either formally using testing
frameworks (I'm partial to unittest, but others like other ones), or
informally using a combination of iterative development and the
interactive shell. Or a mix of the two.

With a formal test framework you would have noticed the bug above
almost instantly - because your test would never finish (Which would
presumably count as a failure for the test that exercises that code).

Whilst that might seem odd, what you're actually doing with type
declarations is saying "if names other than these are used, a bug
exists" and "certain operations on these names are valid". (as well
as a bunch of stuff that may or may not relate to memory allocation
etc)

With test driven development you are specifically testing the functionality
you want to exist *does* exist. TDD also provides a few tricks that can
help you get around writers block, and also catch bugs like above easily and
more importantly early.

Bruce Eckel (author of a fair few interesting C++ & Java books :-) has a
couple of interesting essays on this topic which I think also take this
idea a lot further than is probably suitable for here:

   * Strong Typing vs. Strong Testing:
 http://www.mindview.net/WebLog/log-0025
   * How to Argue about Typing
 http://www.mindview.net/WebLog/log-0052

For what it's worth, if you've not come across test driven development
before then I'd highly recommend Kent Beck's "Test Driven Development: By
Example". You'll either love it or hate it. IMO, it's invaluable though!
I suppose though the difference between static types based testing and
test driven development is that static types only really help you find
bugs (in terms of aiding development), whereas TDD actually helps you
write your code. (Hopefully with less bugs!)

Best Regards,


Michael.

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

Re: forum

2005-10-02 Thread [EMAIL PROTECTED]
is there any forum writen by python like vbb...phped

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


Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-02 Thread Michael
Rocco Moretti wrote:

> That is, what would happen with the following constructs:
> 
> A if B else C if D else F
> A if B if C else D else F

The correct answer should be the person who wrote it would get told off
for writing code that a person reading would have no idea what the code
was doing (without understanding the precedence).

Whilst it's good to have clear understandable, well defined rules for
these things, that's no excuse for having unreadable code that other
people can't read and understand without having to remember obscure
rules.

Personally, I'd hope that any code-linting tools would flag such expressions
as potentially bad because they're not clear. (Whereas bracketed expressions
instantly help here).

Best Regards,


Michael

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


Re: Will python never intend to support private, protected and public?

2005-10-02 Thread Paul Rubin
Mike Meyer <[EMAIL PROTECTED]> writes:
> > What convention?  It just makes it possible to write code with some
> > specific invariants if there's a need to do so.
> 
> That you don't pass private variables to a function unless it's a builtin.

No, I don't see that as "convention", it's just something that you do
if you want to make sure that all the references are local or
builtins.  It's like saying that if you if you want to be sure that x
is always positive, then don't execute statements like "x = -3".  I
wouldn't call something like that a "convention".

In C, one can easily crash an application by derefencing a null
pointer, or break type safety by freeing something twice or setting an
array element with an out-of-range index.  In Python, those failures
are supposed to be impossible.  Not "inconvenient", but impossible.
We usually think of that as a good thing, not a symptom of bondage and
discipline.  But (not even bothering with private instance variables
or builtins), if I say

   def g():
 for i in (1,2,3,4,5):
   yield i
   x = g()

maybe I'd like to be sure that x never yields negative numbers.
CPython happens to have some features that stop me from guaranteeing
that invariant.  A CPython script that makes x yield negative 3 is
contorted but not impossible.  Whether the existence of those hooks is
a good thing or not, I don't see them as a fundamental characteristic
of Python.  Python without those hooks would still be Python.  And I
don't see why wanting to be able to guarantee that impossibility is
somehow more B&D than wanting to guarantee the impossibility of null
pointer dereferences.

> Except that, with Python as it exists today with a private keyword
> added, it's *still* everyone.  The only convention breaking the private
> keyword would allow the compiler to catch is a reference to
> foo.private. 

Well, it would be done at runtime by __getattr__ or the like.

> It wouldn't catch overriding things in __builtins__ or
> overriding builtins in a module, or things poking at the variable
> through __dict__, or - well, there are probably lots of things that
> need to be dealt with.

Yes, but I see all of those as implementation artifacts, not anything
fundamental.

> Preventing accidents is all "private" does - without fundamental
> changes to the implementation of the language. You have to catch every
> mechanism that can be used to find a reference to an attribute, like
> references to __dict__ and to the class variable.

The Python stdlib for a long time had a module called Bastion that
attempted to do exactly that, so you can't say that the desire is
un-Pythonic.  Bastion was only removed because implementation issues
kept it from working properly.  Those issues probably can't be
resolved in the 2.x series but as the language evolves, maybe
something can be done to bring it back.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Info] PEP 308 accepted - new conditional expressions

2005-10-02 Thread Michael
Paul Rubin wrote:

> I'm not
> sure what Guido saw in the "A if C else B" syntax but it's not a big deal.

Maybe Guido's done some perl programming on the side? When I've been doing
perl programming I've quite liked the  if (...); construct, however, on
occasion it's been desirable to have an else there. By having an else there
it means you don't need the ?: syntax and can just have one syntax.

On the flipside, people with different mother tongues often have a different
way of using language. (eg lots of non-native english speakers speaking
better english than those with english as their mother tongue :-) And
sometimes that different way can be better ?

Direct translation of german grammatical form for example - resulting in
something looking like yoda speak... Personally I like this form :)

Regards,


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


Re: what does 0 mean in MyApp(0)

2005-10-02 Thread MrJean1
See the documentation for the __init__() method here

  

Btw, this is wxPython 2.6, AFAIK.

/Jean Brouwers

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


Re: Python based unacceptable language filter

2005-10-02 Thread Nigel Rowe
David Pratt wrote:

> Hi.  Is anyone aware of any python based unacceptable language filter
> code to scan and detect bad language in text from uploads etc.
> 
> Many thanks.
> David

You might be able to adapt languagetool. 
http://www.danielnaber.de/languagetool/features.html

Later versions have been ported to Java, but the old python version of
languagetool is at http://tkltrans.sourceforge.net/#r03

His thesis paper is at
http://www.danielnaber.de/languagetool/download/style_and_grammar_checker.pdf

Mind you, given the poor language skills of many native english speakers
(not to mention those for whom english is a second language) relying on
automated filters to enforce 'good' language seems a trifle extreme.  This
post for example would probably not pass.

Cheers,
Nigel

PS. For the humour impaired, this g*d d*mm post was a f*cking joke, OK! :-)

Mind you, the links are real.

-- 
Nigel Rowe
A pox upon the spammers that make me write my address like..
rho (snail) swiftdsl (stop) com (stop) au
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "no variable or argument declarations are necessary."

2005-10-02 Thread George Sakkis
"Michael" <[EMAIL PROTECTED]> wrote:

> James A. Donald wrote:
> > On Sun, 02 Oct 2005 17:11:13 -0400, Jean-Francois Doyon
> > James A. Donald:
> >>  > Surely that means that if I misspell a variable name, my program will
> >>  > mysteriously fail to work with no error message.
> >> No, the error message will be pretty clear actually :)
> > Now why, I wonder,  does this loop never end :-)
> > egold = 0
> > while egold < 10:
> >ego1d = egold+1
>
> I know (hope! :-) that's a tongue-in-cheek question, however the answer as
> to why that's not a problem is more to do with development habits rather
> than language enforcement. (yes with bad habits that can and will happen)
>
> [snipped description of test-driven development culture]

As an aside, more to the point of the specific erroneous example is the lack of 
the standard python
idiom for iteration:

for egold in xrange(10):
pass

Learning and using standard idioms is an essential part of learning a language; 
python is no
exception to this.

George


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


Re: Will python never intend to support private, protected and public?

2005-10-02 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes:
> The philosophy of dynamic languages like Python is that the class designer
> shouldn't be the only one who decides whether or not a particular variable
> should be private or public.

I don't see that as part of the philosophy of dynamic languages.  For
example, the Python language spec describes a way to reach the private
variables of class instances (through name mangling) but not a way to
get at the private variables of closures or generators (though you can
still do that in CPython through some implementation-specific hacks).

I don't think those implementation hacks are a deep philosophical
consequence of anything, and Python would still be Python without
them.  I don't see why generator designers should be any different
from class designers in your logic.  Why is it so important for
freedom-loving programmers to be able to mess with the private
variables of instances but not of generators?  How are they different?
(Answer: They are not different.  Both are unimportant.)

> The class designer is assumed to know their class best, and therefore be
> in a position to know what variables are dangerous or inconvenient to leak
> and which are not. But the class user is the person who knows their own
> needs best, and therefore best to know whether their needs are such that
> they are willing to take that risk.

Why do you think the designer and user are necessarily not the same
person?  Maybe an app writer wants to create some fault tolerance by
implementing privilege separation inside an application.  I mentioned
in another post that I wrote a crypto class that does exactly that, by
putting the crypto variables in a separate Python interpreter from the
client, and communicating by RPC over sockets.  I'm both the designer
and the user, and I wanted to protect the data in some of the classes
I wrote from code from possible misbehavior of other classes that I
wrote.  With private variables, I could do that in a single process
with reasonable security and much less overhead.

> Why should the class designer get a monopoly on deciding what the
> class user can or cannot do?

Um, because the designer wrote the code?  If the designer chose an
algorithm that's not to the user's liking, the user's only way to fix
it is by modifying the code (and thereby becoming a co-designer).
What's special about instance variables, that they should all be
accessible from elsewhere in the program without modifying the code?

> If you believe that the class designer should have the privilege of
> prohibiting certain uses of the class,

Not the class, just instances of the class in a running program.  The
user can always repurpose the class by modifying the code and making
new instances of the modified class.

> you will vote for private variables. If you believe that the class
> users should have more freedom, you will vote against them.

You're assuming some kind of conflict between the designer and the
user.  If the app is such that a conflict actually exists (e.g. the
user is a possibly-hostile applet), then letting the designer enforce
security is essential.  If no conflict exists, then the designer and
user (who might be the same person) can work out something to their
satisfaction.

> "Truly" private variables have an advantage of making the class
> designer's life somewhat easier -- not much, but a little. But that
> advantage comes at the cost of making the class user's life somewhat
> harder -- not much, but a little -- by restricting what they can
> do. Your private variable may be just what they need to solve some
> problem you never even thought of.

The right way to extend or override class method behavior is by
subclassing or changing the implementation.  This notion of reaching
into the private variables of running instances is a violation of type
safety and a silly hack.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Will python never intend to support private, protected and public?

2005-10-02 Thread Paul Rubin
Mike Meyer <[EMAIL PROTECTED]> writes:
> Actually, I think that the semantic changes required to make private
> do what you want are deep enough that the resulting language
> wouldn't be Python any longer. It has deep implications from the
> interpeter implementation all the way out to the design of the
> standard library, all of which would have to be reworked to make
> private do "the right thing."

Nah, I think Python could withstand those changes and still be Python.

> Which brings me to my point. Rather than trying to bandage Python to
> do what you want - and what, based on this thread, a lot of other
> people *don't* want - you should be building a system from the ground
> up to support the kind of B&D environment you want.

Heh, that goes against the principle that Python is supposed to be
good for everything.  For example, there was a partly-written web
browser called Grail written in Python, that used Python instead of
Javascript for web scripting.  I believe it depended on rexec/Bastion
to stop scripts from taking over the browser.  Wanting to write a
browser that way is perfectly reasonable.  But lack of a secure rexec
makes that approach impossible.  Maybe it's not feasible to implement
rexec in Python 2.x.  But I don't see anything B&D-ish about hoping
that as Python evolves, it becomes possible to bring back rexec.

> Of course, you do realize that in practice you can *never* get what
> you want. It assumes that the infrastructure is all bug-free, which
> may not be the case.

Yes, of course, you need to be careful at every level.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Will python never intend to support private, protected and public?

2005-10-02 Thread Paul Rubin
Mike Meyer <[EMAIL PROTECTED]> writes:
> >> Compile-time restrictions don't matter for squat - you need
> >> serious restrictions on what the program can do at runtime.
> >
> > You need both.
> 
> Yup. Any language besides Java even *try* to provide both for a
> production environment? 

Yes.  Python tried.  It had a module called rexec for that purpose.
I keep mentioning that, and you keep ignoring it.  Rexec was around
for a long time, and was removed for technical reasons with some
reluctance.  There is nothing un-Pythonic about the idea.
-- 
http://mail.python.org/mailman/listinfo/python-list


Unicode charmap decoders slow

2005-10-02 Thread Tony Nelson
Is there a faster way to decode from charmaps to utf-8 than unicode()?

I'm writing a small card-file program.  As a test, I use a 53 MB MBox 
file, in mac-roman encoding.  My program reads and parses the file into 
messages in about 3..5 seconds, but takes about 13.5 seconds to iterate 
over the cards and convert them to utf-8:

for i in xrange(len(cards)):
u = unicode(cards[i], encoding)
cards[i] = u.encode('utf-_8')

The time is nearly all in the unicode() call.  It's not so much how much 
time it takes, but that it takes 4 times as long as the real work, just 
to do table lookups.

Looking at the source (which, if I have it right, is 
PyUnicode_DecodeCharmap() in unicodeobject.c), I think it is doing a 
dictionary lookup for each character.  I would have thought that it 
would make and cache a LUT the size of the charmap (and hook the 
relevent dictionary stuff to delete the cached LUT if the dictionary is 
changed).

I thought of using U"".translate(), but the unicode version is defined 
to be slow.  Is there some similar approach?  I'm almost (but not quite) 
ready to try it in Pyrex.

I'm new to Python.  I didn't google anything relevent on python.org or 
in groups.

TonyN.:'[EMAIL PROTECTED]
  '  
-- 
http://mail.python.org/mailman/listinfo/python-list


gtk.TextView.move_mark_onscreen() broken?

2005-10-02 Thread Tony Nelson
Is gtk.TextView.move_mark_onscreen() broken?  Perhaps only in Python's 
gtk module, in Python 2.3, gtk 2.4.14?  I'm asking here because I'm 
using gtk from Python and don't want to write a C program to verify my 
issue.  I've also tried gtk.TextView.scroll_to_mark() and 
gtk.TextView.place_cursor_onscreen(), and none of them want to do 
anything.  The rest of my program works, so I'm not a complete gtk bazo.

TonyN.:'[EMAIL PROTECTED]
  '  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Will python never intend to support private, protected and public?

2005-10-02 Thread Mike Meyer
Paul Rubin  writes:

> Mike Meyer <[EMAIL PROTECTED]> writes:
>> > What convention?  It just makes it possible to write code with some
>> > specific invariants if there's a need to do so.
>> That you don't pass private variables to a function unless it's a builtin.
> No, I don't see that as "convention", it's just something that you do
> if you want to make sure that all the references are local or
> builtins.

Semantics...

> It's like saying that if you if you want to be sure that x
> is always positive, then don't execute statements like "x = -3".  I
> wouldn't call something like that a "convention".

Right - that's not a convention. That behavior would be a convention
if you did somehing like prefixing the variable name with a "p" to
indicate that you don't do that.

> maybe I'd like to be sure that x never yields negative numbers.
> CPython happens to have some features that stop me from guaranteeing
> that invariant.

I'd say CPython was missing the features that you need to guarantee
that. Missing quite a *lot* of features, in fact. But Python has never
been about keeping people from writing bad code - it's about helping
people write good code.

>> It wouldn't catch overriding things in __builtins__ or
>> overriding builtins in a module, or things poking at the variable
>> through __dict__, or - well, there are probably lots of things that
>> need to be dealt with.
> Yes, but I see all of those as implementation artifacts, not anything
> fundamental.

Right - those aren't fundamental. It's things like Python allowing
programmers to use whatever style is appropriate to the problem at
hand, rather than insisting on an OO style. Once you get outside the
OO style, "private" attributes becomes problematic.

>> Preventing accidents is all "private" does - without fundamental
>> changes to the implementation of the language. You have to catch every
>> mechanism that can be used to find a reference to an attribute, like
>> references to __dict__ and to the class variable.
>
> The Python stdlib for a long time had a module called Bastion that
> attempted to do exactly that, so you can't say that the desire is
> un-Pythonic.

Of course I can say it's unpythonic. I might even be right: just
because the standard library does something doesn't mean that
something is automatically pythonic. But I haven't said that "private"
is unpythonic. I will say that the things you need to program
effectively with private variables - like having to inherit all your
utility functions - is unpythonic.

> Bastion was only removed because implementation issues
> kept it from working properly.  Those issues probably can't bbe
> resolved in the 2.x series but as the language evolves, maybe
> something can be done to bring it back.

Pretty much every attempt to restrict what other programmers do in
Python has failed - for "implementation issues". I think that's a good
sign that this kind of thing isn't going to work without some serious
work on the interpreter.

   http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Will python never intend to support private, protected and public?

2005-10-02 Thread Mike Meyer
Paul Rubin  writes:
> Mike Meyer <[EMAIL PROTECTED]> writes:
>> >> Compile-time restrictions don't matter for squat - you need
>> >> serious restrictions on what the program can do at runtime.
>> > You need both.
>> Yup. Any language besides Java even *try* to provide both for a
>> production environment? 
> Yes.  Python tried.  It had a module called rexec for that purpose.
> I keep mentioning that, and you keep ignoring it.  Rexec was around
> for a long time, and was removed for technical reasons with some
> reluctance.  There is nothing un-Pythonic about the idea.

If you've mentioned it before, it wasn't to me. Or maybe my news
server dropped it. 

Rexec was removed because it didn't work. Just like bastion and every
other attempt to create a "safe" environment in Python. Any security
wonk worth his pay will tell you that you don't add security to
something after the fact if you want good security. You design it in
from the beginning.

Of course, what rexec tried to do and what "private" do are orthogonal
issues.

  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   >