Re: super, decorators and gettattribute

2008-01-12 Thread Mike Meyer
On Sat, 12 Jan 2008 10:45:25 -0800 (PST) Richard Szopa <[EMAIL PROTECTED]> wrote: > Hello all, > > I am playing around w/ Python's object system and decorators and I > decided to write (as an exercise) a decorator that (if applied to a > method) would call the superclass' method of the same name

Re: where do my python files go in linux?

2008-01-12 Thread Mike Meyer
On Sat, 12 Jan 2008 16:13:08 +0100 "Jorgen Bodde" <[EMAIL PROTECTED]> wrote: > > Normally you'd split up the bulk of the code into a module which gets > > installed into site-packages and a piece of stand-alone front-end code which > > imports the module and executes whatever you need to do and get

Re: Import and execfile()

2008-01-12 Thread Mike Meyer
On Fri, 11 Jan 2008 20:55:07 -0800 (PST) George Sakkis <[EMAIL PROTECTED]> wrote: > On Jan 11, 5:24 pm, Mike Meyer <[EMAIL PROTECTED]> > wrote: > > On Fri, 11 Jan 2008 14:05:11 -0800 (PST) George Sakkis <[EMAIL PROTECTED]> > > wrote: > > > I mainta

Re: Newbie Q: modifying SQL statements

2008-01-11 Thread Mike Meyer
On Fri, 11 Jan 2008 18:11:41 -0500 "Faber J. Fedor" <[EMAIL PROTECTED]> wrote: > On 10/01/08 22:53 -0500, Mike Meyer wrote: > > Personally, I think it would be more pythonic to not try and use two > > different APIs to walk the list of jobs (... One Way To Do

Re: encrypting python modules

2008-01-11 Thread Mike Meyer
On Sat, 12 Jan 2008 09:47:26 +1100 Ben Finney <[EMAIL PROTECTED]> wrote: > Paul Sijben <[EMAIL PROTECTED]> writes: > > I know that I can not stop a dedicated hacker deconstructing my code. > A direct consequence of this is that you can not stop *anyone* from > deconstructing your code if it's in t

Re: for loop without variable

2008-01-11 Thread Mike Meyer
On Fri, 11 Jan 2008 22:18:22 GMT Neil Hodgson <[EMAIL PROTECTED]> wrote: > Marty: > > I recently faced a similar issue doing something like this: > > data_out = [] > > for i in range(len(data_in)): > > data_out.append([]) > > Another way to write this is > data_out = [[]] * le

Re: Import and execfile()

2008-01-11 Thread Mike Meyer
On Fri, 11 Jan 2008 14:05:11 -0800 (PST) George Sakkis <[EMAIL PROTECTED]> wrote: > I maintain a few configuration files in Python syntax (mainly nested > dicts of ints and strings) and use execfile() to read them back to > Python. This has been working great; it combines the convenience of > pic

Re: Python Frontend/GUI for C Program

2008-01-11 Thread Mike Meyer
On Fri, 11 Jan 2008 08:12:48 -0800 (PST) [EMAIL PROTECTED] wrote: > I have a C program that works very well. However, being C it has no > GUI. What does C have to do with it not having a GUI? I've written more C programs with a GUI than Python ones - and the C experience was generally better. Of c

Re: improving performance of python webserver running python scripts in cgi-bin

2008-01-11 Thread Mike Meyer
On Thu, 10 Jan 2008 23:17:28 -0800 (PST) Dale <[EMAIL PROTECTED]> wrote: > I am using a simple python webserver (see code below) to serve up > python scripts located in my cgi-bin directory. > > import BaseHTTPServer > import CGIHTTPServer > class Handler(CGIHTTPServer.CGIHTTPRequestHandler): >

Re: How to POST call and retrieve result page

2008-01-11 Thread Mike Meyer
On Fri, 11 Jan 2008 14:44:19 +0530 "suyash jape" <[EMAIL PROTECTED]> wrote: > Hi all > i want to access a web page through python script, fillup the necessary > fields, > and press submit button (which does POST call) and retrieve the result page > and retrieve some values from it. > > Here is th

Re: Magic function

2008-01-11 Thread Mike Meyer
On Fri, 11 Jan 2008 08:29:18 -0800 (PST) [EMAIL PROTECTED] wrote: > Hi all, > > I'm part of a small team writing a Python package for a scientific > computing project. The idea is to make it easy to use for relatively > inexperienced programmers. As part of that aim, we're using what we're > call

Re: Learning Python via a little word frequency program

2008-01-11 Thread Mike Meyer
On 11 Jan 2008 03:50:53 -0800 Paul Rubin <"http://phr.cx"@NOSPAM.invalid> wrote: > rent <[EMAIL PROTECTED]> writes: > > keys = freq.keys() > > keys.sort(key = freq.get, reverse = True) > > for k in keys: > > print "%-10s: %d" % (k, freq[k]) > > I prefer (untested): > > def snd((x,y)): ret

Re: for loop without variable

2008-01-10 Thread Mike Meyer
On Fri, 11 Jan 2008 01:48:43 -0500 Marty <[EMAIL PROTECTED]> wrote: > Mike Meyer wrote: > >> This caused me to wonder why Python does not have a "foreach" statement > >> (and > >> also why has it not come up in this thread)? I realize the topic ha

Re: for loop without variable

2008-01-10 Thread Mike Meyer
On Thu, 10 Jan 2008 22:36:56 -0500 Marty <[EMAIL PROTECTED]> wrote: > I recently faced a similar issue doing something like this: > > data_out = [] > for i in range(len(data_in)): > data_out.append([]) More succinctly: data_out = [] for _ in data_in: data_out.append([]) Or, a

Re: Newbie Q: modifying SQL statements

2008-01-10 Thread Mike Meyer
On Thu, 10 Jan 2008 20:32:06 -0500 "Faber J. Fedor" <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm in the process of learning Python by writing a job queue program. > Nothing fancy, mind you, just read from a table, shell out to a program, > write back to the table. > > I'm working off of the tuto

Re: Detecting OS platform in Python

2008-01-10 Thread Mike Meyer
On Thu, 10 Jan 2008 18:37:59 -0800 (PST) Devraj <[EMAIL PROTECTED]> wrote: > Hi everyone, > > My Python program needs reliably detect which Operating System its > being run on, infact it even needs to know which distribution of say > Linux its running on. The reason being its a GTK application th

Re: XML+Logs to Latex. XSLT?

2008-01-10 Thread Mike Meyer
On Thu, 10 Jan 2008 22:32:50 +0100 Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > Yes. For sure. I though XSLT was something like XML not other > > "language" and that Python will have any library that uses XSLT to do > > transformation... > XSLT is definitely a language (it's turing complete, after

Re: for loop without variable

2008-01-10 Thread Mike Meyer
On Thu, 10 Jan 2008 08:42:16 +0100 Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > Mike Meyer <[EMAIL PROTECTED]> writes: > > It sounds to me like your counter variable actually has meaning, > It depends how the code is written. In the example such as: > > for

Re: What is "lambda x=x : ... " ?

2008-01-10 Thread Mike Meyer
On Thu, 10 Jan 2008 19:59:23 +0100 Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Mike Meyer wrote: > >> What does "y=y" and "c=c" mean in the lambda function? > > > > Older versions of python didn't make variables in an outer scope > > vi

Re: What is "lambda x=x : ... " ?

2008-01-10 Thread Mike Meyer
On Thu, 10 Jan 2008 10:25:27 -0800 (PST) "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I'm reading this page: > http://www.ps.uni-sb.de/~duchier/python/continuations.html > and I've found a strange usage of lambda: > > > Now, CPS would transform the baz function above in

Re: for loop without variable

2008-01-09 Thread Mike Meyer
On Wed, 9 Jan 2008 18:49:36 -0800 (PST) erik gartz <[EMAIL PROTECTED]> wrote: > The loop performs some actions with web services. The particular > iteration I'm on isn't important to me. It is only important that I > attempt the web services that number of times. If I succeed I > obviously break ou

Re: Python too slow?

2008-01-09 Thread Mike Meyer
On Wed, 9 Jan 2008 15:45:41 -0800 (PST) "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Okay I profiled the code and here is the output: > > http://heightened.files.wordpress.com/2008/01/output.txt > > It seems that the function it spends the longest on is the red_points > function that he use

Re: problem of converting a list to dict

2008-01-09 Thread Mike Meyer
On Wed, 9 Jan 2008 14:34:26 -0600 "Reedick, Andrew" <[EMAIL PROTECTED]> wrote: > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:python- > > [EMAIL PROTECTED] On Behalf Of John Machin > > Sent: Wednesday, January 09, 2008 3:02 PM > > To: python-list@python.org > > Subject: Re: pro

Re: Another dumb scope question for a closure.

2008-01-09 Thread Mike Meyer
On Wed, 9 Jan 2008 13:47:30 -0500 (EST) "Steven W. Orr" <[EMAIL PROTECTED]> wrote: > So sorry because I know I'm doing something wrong. > > 574 > cat c2.py > #! /usr/local/bin/python2.4 > > def inc(jj): > def dummy(): > jj = jj + 1 > return jj > return dummy > > h =

urllib2.urlopen broken?

2007-06-06 Thread Mike Meyer
In 2.5.1 (and 2.[45], but not 2.3): -- Mike Meyer <[EMAIL PROTECTED]> http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib2.urlopen broken?

2007-06-06 Thread Mike Meyer
In <[EMAIL PROTECTED]>, Mike Meyer <[EMAIL PROTECTED]> typed: > In 2.5.1 (and 2.[45], but not 2.3): Sigh. Sorry 'bout that. Since I started it, the breakage is: Python 2.5.1 (r251:54863, May 15 2007, 15:31:37) [GCC 3.4.6 [FreeBSD] 20060305] on freebsd6 Type "help&qu

Re: Is 'everything' a refrence or isn't it?

2006-01-15 Thread Mike Meyer
Bryan Olson <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> Bryan Olson <[EMAIL PROTECTED]> writes: >>>Mike Meyer wrote: >>>>Bryan Olson <[EMAIL PROTECTED]> writes: >>>>>Mike Meyer wrote: >>>>>>Bryan Olson wr

Re: Is 'everything' a refrence or isn't it?

2006-01-15 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Sun, 15 Jan 2006 03:11:27 -0500, Mike Meyer wrote: >> Steven D'Aprano <[EMAIL PROTECTED]> writes: >>> On Sat, 14 Jan 2006 23:26:40 -0500, Mike Meyer wrote: >>>>> I have no problem with that. So

Re: Is 'everything' a refrence or isn't it?

2006-01-15 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Sat, 14 Jan 2006 23:26:40 -0500, Mike Meyer wrote: >>> I have no problem with that. Some objects are mutable and can change >>> their value >> If the object *is* the value, how can it change to be a different

Re: Is 'everything' a refrence or isn't it?

2006-01-15 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Sat, 14 Jan 2006 23:21:14 -0500, Mike Meyer wrote: >> So those properties of object() are all identical because they're >> really properties of object. If you define an object() by those >> properties, you have

Re: More than you ever wanted to know about objects

2006-01-14 Thread Mike Meyer
Steve Holden <[EMAIL PROTECTED]> writes: > I just wish Mike Meyer and Steven D'Aprano were close enough that you > could bang their heads together. We might be. But the results would probably be catastrophic for the surrounding area. http://www.m

Re: More than you ever wanted to know about objects

2006-01-14 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > Steve Holden <[EMAIL PROTECTED]> wrote: >... >> > 3. If two objects are equal with "==", does that >> > mean their values are the same? >> Almost universally, yes, although if you know enough about how the >> interpreter works "under the hood" you

Re: Is 'everything' a refrence or isn't it?

2006-01-14 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Sat, 14 Jan 2006 18:26:41 -0500, Mike Meyer wrote: >> If two objects ARE the same value, then they should be the same >> object. > You are assuming that values are unique, and that therefore is X "is" (in &g

Re: Is 'everything' a refrence or isn't it?

2006-01-14 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > Likewise instances of object() have a rich, object-oriented structure -- > dir(object()) returns a list with twelve items -- but every instance is > identical. That's because all the things in dir(object()) are also in dir(object): >>> dir(object) ==

Re: Is 'everything' a refrence or isn't it?

2006-01-14 Thread Mike Meyer
Bryan Olson <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> Bryan Olson <[EMAIL PROTECTED]> writes: >>>Mike Meyer wrote: >>>>Bryan Olson writes: >>>>>[EMAIL PROTECTED] wrote: >>>>>>The reason is that I am still try

Re: Why keep identity-based equality comparison?

2006-01-14 Thread Mike Meyer
Noam Raphael <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> Noam Raphael <[EMAIL PROTECTED]> writes: >>>>>Also note that using the current behaviour, you can't easily >>>>>treat objects that do define a meaningful value comparison, by &g

Re: Is 'everything' a refrence or isn't it?

2006-01-14 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: distance_in_feet = 5 weight_in_milligrams = 5 distance_in_feet == weight_in_milligrams > True > Since when is a distance comparable to a weight, let alone equal? The latest (and most impressive to date) to fix this is frink: http://futureb

Re: New Python.org website ?

2006-01-14 Thread Mike Meyer
Martin Maney <[EMAIL PROTECTED]> writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: >> >> http://beta.python.org >> In particular, creating a good-looking design that remains readable in >> all possible browser configurations is impossible. Getting one that i

Re: Is 'everything' a refrence or isn't it?

2006-01-14 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > object instances are like electrons (note for pedants: in classical > physics, not QED): they are all exactly the same, distinguishable only by > their position in time and space (or memory location). Except all electrons aren't exactly the same - beca

Re: Is 'everything' a refrence or isn't it?

2006-01-14 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Sat, 14 Jan 2006 14:14:01 +, Antoon Pardon wrote: >> On 2006-01-14, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >>> On Thu, 12 Jan 2006 16:11:53 -0800, rurpy wrote: It would help if you or someone would answer these five questions (with

Re: Is 'everything' a refrence or isn't it?

2006-01-14 Thread Mike Meyer
Paul Rubin <http://[EMAIL PROTECTED]> writes: > Mike Meyer <[EMAIL PROTECTED]> writes: >> > Whether the '==' operation conforms to your idea of what equality >> > means is unclear. >> Care to say what it does mean, then? > I'd say a==b doesn

On Numbers

2006-01-14 Thread Mike Meyer
In the discussion of equality, the issue that decimal('3.0') == 3.0 is False came up as a reason for changing the behavior of ==. The problem with this is that the proposed change doesn't really fix anything, it just gives different wrong behavior. The correct fix would seem to be fixing python's h

Re: Is 'everything' a refrence or isn't it?

2006-01-14 Thread Mike Meyer
"Donn Cave" <[EMAIL PROTECTED]> writes: > |> 3. If two objects are equal with "==", does that > |> mean their values are the same? > Yes. > | >>> 3.0 == 3 > | True > Evidently the value of 3.0 is the same as the value of 3. And they do. They are two different representations of the same value. M

Re: Is 'everything' a refrence or isn't it?

2006-01-14 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Sat, 14 Jan 2006 04:22:53 +, Donn Cave wrote: >> |> 2. What is the value of object()? >> [ I assume you mean, the object returned by object(). ] >> It doesn't really have a value. I can't think of any kind of >> computation that could use this o

Re: Is 'everything' a refrence or isn't it?

2006-01-14 Thread Mike Meyer
Bryan Olson <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> Bryan Olson writes: >>>[EMAIL PROTECTED] wrote: >>> >>>>The reason is that I am still trying to figure out >>>>what a value is myself. Do all objects have values? >>>Ye

Re: Why keep identity-based equality comparison?

2006-01-14 Thread Mike Meyer
Noam Raphael <[EMAIL PROTECTED]> writes: >>>Also note that using the current behaviour, you can't easily >>>treat objects that do define a meaningful value comparison, by >>>identity. >> Yes you can. Just use the "is" operator. > Sorry, I wasn't clear enough. In "treating" I meant how containers >

Re: Marshal Obj is String or Binary?

2006-01-14 Thread Mike Meyer
"Giovanni Bajo" <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] wrote: >> Try... > for i in bytes: print ord(i) >> or > len(bytes) >> What you see isn't always what you have. Your database is capable of >> storing \ x 0 0 characters, but your string contains a single byte of >> value zero.

Re: PDA Implementations

2006-01-14 Thread Mike Meyer
"gregarican" <[EMAIL PROTECTED]> writes: > I am in the process of creating an app that runs on various PDA > platforms. Currently I have it running on ARM Linux (Sharp Zaurus) and > am starting to port it over to ARM Windows Mobile (Dell Axim). Using > Python has made the task particularly easier

Re: Freezing

2006-01-14 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Mike Meyer: >>Actually, I like the "len" model, which would be a new builtin that uses the >>__freeze__ method.< > Well, I presume this is a matter of personal tastes and consistency > too. This time I appreciate the freeze() too, bu

Re: Why keep identity-based equality comparison?

2006-01-14 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: >> If you >> want to argue that the builtin sets should do that, you can - but >> that's unrelated to the question of how the comparison operators >> behave for the rest of the bulitin types. > What I argue is that there is no single order for a specific ty

Re: how do "real" python programmers work?

2006-01-14 Thread Mike Meyer
Tom Anderson <[EMAIL PROTECTED]> writes: > On Thu, 12 Jan 2006, Mike Meyer wrote: >> well, we need a term for development environment built out of Unix >> tools > Disintegrated development environment? Differentiated development > environment? How about just a de

Re: how do "real" python programmers work?

2006-01-14 Thread Mike Meyer
Roy Smith <[EMAIL PROTECTED]> writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: >> we need a term for development environment built out of Unix tools > We already have one. The term is "emacs". So people using a development environment built aroun

Re: Reading from input file.

2006-01-13 Thread Mike Meyer
"Sheldon" <[EMAIL PROTECTED]> writes: > So Mike if you can do better then do it then! There are many ways do > solve a problem, perhaps you have not learned that yet. At first this > guy didn't know what to do, so he had to begin somewhere. Now you can > take him much further, I am sure but the jou

Re: Help with super()

2006-01-13 Thread Mike Meyer
David Hirschfield <[EMAIL PROTECTED]> writes: > I'm having trouble with the new descriptor-based mechanisms like > super() and property() stemming, most likely, from my lack of > knowledge about how they work. > > Here's an example that's giving me trouble, I know it won't work, but > it illustrate

Re: how do "real" python programmers work?

2006-01-13 Thread Mike Meyer
"bblais" <[EMAIL PROTECTED]> writes: > In Python, there seems to be a couple ways of doing things. I could > write it in one window, and from a Unix shell call >python myscript.py > and be like C++, but then I lose the interactiveness which makes > prototyping easier.

Re: Is 'everything' a refrence or isn't it?

2006-01-13 Thread Mike Meyer
Bryan Olson <[EMAIL PROTECTED]> writes: > [EMAIL PROTECTED] wrote: >> The reason is that I am still trying to figure out >> what a value is myself. Do all objects have values? > Yes. Can you justify this, other than by quoting the manual whose problems caused this question to be raised in the fir

Re: Why is there no post-pre increment operator in python

2006-01-12 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Anyone has any idea on why is there no post/pre increment operators in > python ? For lots of good reasons. > Although the statement: > ++j > works but does nothing So does --j. They both parse as a value with two unary operators applied to it in succession: +(+(j)

Re: Conditionals stored as text to translate to real compares

2006-01-12 Thread Mike Meyer
"Randall Parker" <[EMAIL PROTECTED]> writes: > if OperatorType == ">": ># then do a greater than compare here. >BoolVal = TestVal > TargetVal > elif OperatorType == ">=": ># then do a greater or equal to here. >BoolVal = TestVal >= TargetVal > and so on. > > It would seem a lot eas

Re: How to remove subset from a file efficiently?

2006-01-12 Thread Mike Meyer
"fynali" <[EMAIL PROTECTED]> writes: > Hi all, > > I have two files: Others have pointed out the Python solution - use a set instead of a list for membership testing. I want to point out a better Unix solution ('cause I probably wouldn't have written a Python program to do this): > Objective: to

Re: Freezing

2006-01-12 Thread Mike Meyer
Xavier Morel <[EMAIL PROTECTED]> writes: >[EMAIL PROTECTED] wrote: >> Dicts and sets require immutable keys, like tuples or frozensets, but >> to me they look like a duplication. So the idea is to remove tuples and >> frozensets (and replace the few other uses of tuples with lists, like >> the % in

Re: Link List in Python

2006-01-12 Thread Mike Meyer
"sri2097" <[EMAIL PROTECTED]> writes: > Hi all, I have written a Link list implementation in Python (Although > it's not needed with Lists and Dictionaries present. I tried it just > for the kicks !). Anyway here is the code - Generally very nice. > # Creating a class comprising of node in Link L

Re: New Python.org website ?

2006-01-12 Thread Mike Meyer
Tim Parkin <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> Of course, this is typical on the web: "Works in IE" really means >> "works in IE in the configurations we tested it for", and usually >> means "works in our favorite configuration&qu

Re: How can I create a dict that sets a flag if it's been modified

2006-01-12 Thread Mike Meyer
>> here's one attempt. (I'm no expert, so wait for better :-) >> >>> class ModFlagDict(dict): >> def __init__(self, *args, **kwargs): >> super(ModFlagDict, self).__init__(*args, **kwargs) >> self.modified = False >> def __setitem__(self, key, value): >>

Re: Why keep identity-based equality comparison?

2006-01-12 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: > Op 2006-01-11, Mike Meyer schreef <[EMAIL PROTECTED]>: >> Antoon Pardon <[EMAIL PROTECTED]> writes: >>> Op 2006-01-11, Mike Meyer schreef <[EMAIL PROTECTED]>: >>>> Antoon Pardon <[EMAIL PROTECTED]

Re: Reading from input file.

2006-01-12 Thread Mike Meyer
"Sheldon" <[EMAIL PROTECTED]> writes: > after you have read the file then split it like this: > file = open('inputfile.txt', 'r').read() > import string > file = string.split(file,'\n') You're doing things the hard way - at least if you have a modern Python. The above can be done as: file = open(

Re: How to create a script that list itself ?

2006-01-11 Thread Mike Meyer
Tim Roberts <[EMAIL PROTECTED]> writes: > It was pointed out to me that the shortest Python program which produces > itself on stdout is: > -- Which, oddly enough, is also the shortest shell program that produces itself on stdout. http://www.mired.org/home/mwm/ Independe

Re: Python Scripts to logon to websites

2006-01-11 Thread Mike Meyer
Peter Hansen <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> Peter Hansen <[EMAIL PROTECTED]> writes: >>>By the way, note that neither basic auth nor digest auth provide any >>>real security, and in fact with basic auth the userid and password are &

Re: Why keep identity-based equality comparison?

2006-01-11 Thread Mike Meyer
Steven Bethard <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> Steven Bethard writes: >>> Not to advocate one way or the other, but how often do you use >>> heterogeneous containers? >> Pretty much everything I do has heterogenous containers of some sor

Re: Python Scripts to logon to websites

2006-01-11 Thread Mike Meyer
Peter Hansen <[EMAIL PROTECTED]> writes: > By the way, note that neither basic auth nor digest auth provide any > real security, and in fact with basic auth the userid and password are > sent *in cleartext*. For any serious production site these techniques > should probably not be used without add

Re: Python Scripts to logon to websites

2006-01-11 Thread Mike Meyer
"BartlebyScrivener" <[EMAIL PROTECTED]> writes: > New to Python and Programming. Trying to make scripts that will open > sites and automatically log me on. A common enough things to want to do. > The following example is from the urllib2 module. > > What are "realm" and "host" in this example. H

Re: Why keep identity-based equality comparison?

2006-01-11 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: > Op 2006-01-11, Mike Meyer schreef <[EMAIL PROTECTED]>: >> Antoon Pardon <[EMAIL PROTECTED]> writes: >>> Op 2006-01-10, Mike Meyer schreef <[EMAIL PROTECTED]>: >>>>> Now you can take the practical

Re: New Python.org website ?

2006-01-11 Thread Mike Meyer
Stefan Rank <[EMAIL PROTECTED]> writes: > on 11.01.2006 11:44 Steve Holden said the following: >> http://beta.python.org > Very nice! > Just wanted to note that the content area and the menu area overlap > (leaving some content unreadable) > in Opera 8.51 / WinXP Ditto for Opera 8.51 / OSX, and f

Re: how to improve this simple block of code

2006-01-11 Thread Mike Meyer
"py" <[EMAIL PROTECTED]> writes: > Say I have... > x = "132.00" > but I'd like to display it to be "132" ...dropping the trailing > zeros...I currently try this The two-strip solution is cleaner, but: > if x.endswith("0"): > x = x[:len(x)-1] x = x[:-1] or del x[-1] both improve t

Re: Restart process with SIGHUP

2006-01-11 Thread Mike Meyer
[EMAIL PROTECTED] writes: > I'm trying to restart a process with the os.kill command. My Problem is > that if the command gets executed, my python script stops working. I > want to SIGHUP a process with the following command: os.kill(pid, > signal.SIGHUP). That looks right. > Can anyone give me a

Re: Why keep identity-based equality comparison?

2006-01-11 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: > Op 2006-01-10, Mike Meyer schreef <[EMAIL PROTECTED]>: >>> Now you can take the practical option and decide that programmatically >>> it make no sense to compare a specific couple of values and throw an >>> exc

Re: Spelling mistakes!

2006-01-11 Thread Mike Meyer
Dennis Lee Bieber <[EMAIL PROTECTED]> writes: > On Wed, 11 Jan 2006 06:57:06 +, Steve Holden <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: >> I suppose most readers aren't old enough to remember the punch card >> days, when you would hand your work in on coding sheets to t

Re: Why keep identity-based equality comparison?

2006-01-10 Thread Mike Meyer
Steven Bethard <[EMAIL PROTECTED]> writes: > Not to advocate one way or the other, but how often do you use > heterogeneous containers? Pretty much everything I do has heterogenous containers of some sort or another. SQL queries made to DP API compliant modules return homogenous lists of heterogen

Re: Why keep identity-based equality comparison?

2006-01-10 Thread Mike Meyer
[EMAIL PROTECTED] writes: > It seems to me that both Mike's and Fuzzyman's objections were that > sometimes you want the current behaviour, of saying that two objects > are equal if they are: 1. the same object or 2. have the same value > (when it's meaningful). In both cases this can be accomplis

Re: Why keep identity-based equality comparison?

2006-01-10 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: >>> There is no way in python now to throw an exception when you >>> think comparing your object to some very different object >>> is just meaningless and using such an object in a container >>> that can be searched via the "in" operator. >> I claim that co

Re: Why keep identity-based equality comparison?

2006-01-10 Thread Mike Meyer
Antoon Pardon <[EMAIL PROTECTED]> writes: >> Yes. Searching for items in heterogenous containers. With your change >> in place, the "in" operator becomes pretty much worthless on >> containers of heterogenous objects. Ditto for container methods that >> do searches for "equal" members. Whenever you

Re: Why keep identity-based equality comparison?

2006-01-09 Thread Mike Meyer
[EMAIL PROTECTED] writes: > My question is, what reasons are left for leaving the current default > equality operator for Py3K, not counting backwards-compatibility? > (assume that you have idset and iddict, so explicitness' cost is only > two characters, in Guido's example) Yes. Searching for ite

Re: testing units in a specific order?

2006-01-09 Thread Mike Meyer
Tim Peters <[EMAIL PROTECTED]> writes: > They're run in alphabetical order, sorting on the test methods' names. > For that reason some people name test methods like 'test_001', > 'test_002', ..., although unit tests really "shouldn't" case which > order they get run in. This seems sort of hard to

Re: Help with dynamic attributes.

2006-01-09 Thread Mike Meyer
"Mr.Rech" <[EMAIL PROTECTED]> writes: > Hi all, > I was writing a simple class when I get a strange error message that I > can't > understand. Hopefully someone could help me here. > > My class's init method takes a list of lists as input argument and I'd > like to create > several attributes each

Re: Spelling mistakes!

2006-01-09 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Terry> But not faster than use a dict server! Why not just use (e.g.) > Terry> kdict? > > >> Maybe because not everybody has it? > > Sybren> Lame excuse. If you don't have something but you do want to use > Sybren> it, you get it. > > I don't think

Re: Newline at EOF Removal

2006-01-09 Thread Mike Meyer
"Alex N" <[EMAIL PROTECTED]> writes: > Peter gave me a good clue here > w.write(f.read().rstrip('\n') + '\n') > However the 2nd \n puts that empty line at the end of the file so I No, it doesn't. Well, maybe it doesn't, depending on how your applications treats newlines. Normally, a newline termin

Re: config errors on Freebsd and python 2.3

2006-01-09 Thread Mike Meyer
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Safeer Tabassum wrote: >> why you are not installing it from ports? > The port distribution doesn't build to support Tkinter. Looks like they changed that recently - because it used to build it by default. Tkinter is now installed by x11-toolkits/

Re: Try Python update

2006-01-08 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > Meanwhile, other JS/DOM experts have told me that there's NO way to set > cursor position within a textarea according to w3c standards. In this > case, what your site does now may be the "least bad" approach, and that > fact might be noted in the "browse

Re: Newline at EOF Removal

2006-01-08 Thread Mike Meyer
"Alex Nordhus" <[EMAIL PROTECTED]> writes: > I am looking for a way to strip the blank line and the empty newline at > the end of the text file. I can get the blank lines removed from the > file but it always leaves the end line (which is blank) as a newline. My > code is here and it works but leav

Re: Try Python update

2006-01-08 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > I'm finding it hard to arrange my own experiments with Safari (I'm using > a loaner machine since my normal one[s] are all having problems and > under repair) but I'm told the solution for cursor positioning is to set > the caretPos attribute of the texta

Re: Newbie with some doubts.

2006-01-08 Thread Mike Meyer
Jorgen Grahn <[EMAIL PROTECTED]> writes: > On Sat, 07 Jan 2006 18:47:20 -0500, Mike Meyer <[EMAIL PROTECTED]> wrote: > ... >> As far as I'm concerned, the definitive work in this area is Meyer's >> "Object Oriented Software Construction". He

Re: Returning Values from Bash Scripts

2006-01-08 Thread Mike Meyer
Jorgen Grahn <[EMAIL PROTECTED]> writes: > On Sun, 08 Jan 2006 08:57:01 GMT, Tim Roberts <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote: >>>How to execute bash scripts from python (other than using os.popen) and >>>get the values that those bash scripts return. >> Why would you eliminate os.

Re: Try Python update

2006-01-08 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: > For some reason, I couldn't see the links at the end of the page; now I > can, though they look sort of "ragged", but, OK. Probably the fonts I chose. I'm in no way a good visu

Re: Returning Values from Bash Scripts

2006-01-07 Thread Mike Meyer
[EMAIL PROTECTED] writes: > How to execute bash scripts from python (other than using os.popen) and > get the values that those bash scripts return. The easy way is to call it with subprocess.call. http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix con

Re: Newbie with some doubts.

2006-01-07 Thread Mike Meyer
Claudio Grondi <[EMAIL PROTECTED]> writes: > Yes, I see your point, but even putting my personal preferences > beside, for someone who just started to program, learning about the > concept of classes and inheritance is probably not what helps to get > immediate fun out of first steps in writing sma

Re: Newbie with some doubts.

2006-01-07 Thread Mike Meyer
Claudio Grondi <[EMAIL PROTECTED]> writes: > Edgar A. Rodriguez wrote: >> Hi everybody, >> Im newbie to Python (I found it three weeks ago) , in fact Im newbie >> to >> programming. I'm being reading and training with the language, but I >> still wondering about what Classes are used to. Could you

Re: Is 'everything' a refrence or isn't it?

2006-01-07 Thread Mike Meyer
Terry Hancock <[EMAIL PROTECTED]> writes: > On Sat, 07 Jan 2006 01:29:46 -0500 > Mike Meyer <[EMAIL PROTECTED]> wrote: >> From what I can tell, Liskov proposed *three* different >> names for >> passing references to objects: call-by-sharing, >> call-by-obj

Re: Is 'everything' a refrence or isn't it?

2006-01-07 Thread Mike Meyer
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > In ordinary CS, "call by reference" generally means that the function is > handed a reference to the *variable* holding the *value*. That's the strictest definition of "call-by-reference". It's got a major problem in that it means doing (with C syntax)

Re: Is 'everything' a refrence or isn't it?

2006-01-07 Thread Mike Meyer
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Sat, 07 Jan 2006 01:29:46 -0500, Mike Meyer wrote: >> Call by object is the worst choice among the three, because "object" >> has such a vague meaning, so you never know what implications someone >> will

Re: Try Python update

2006-01-07 Thread Mike Meyer
[EMAIL PROTECTED] (Alex Martelli) writes: > Mike Meyer <[EMAIL PROTECTED]> wrote: >> And yes, I know about this. It's listed in "Known Problems". Anything > What's the URL to "Known Problems"? There's a strange cursor-placement > bug on Appl

Re: Copying files between different linux machines

2006-01-07 Thread Mike Meyer
"Thierry Lam" <[EMAIL PROTECTED]> writes: > Let's say I have two linux machines with the following names: > -linone > -lintwo > > If I'm currently on linone and if I want to copy a bunch of files from > lintwo into linone, how can that be done in a python script without > using ftp? Use scp.

  1   2   3   4   5   6   7   8   9   10   >