Re: def __init__ question in a class definition

2005-02-06 Thread Miki Tebeka
Hello Jeffrey, > I have an open source program which i am trying to add to. > > class classname(member,member) > > def __init__(self,list) > self.__list = list > self.refresh = 360 > > my question is what is the __ (double underscore) represent, if > anything,

Display subprocess progress

2005-02-06 Thread Miki Tebeka
Hello All, Any ideas on how to show subprocess progress? I have a GUI application that launches a subprocess which does some lengthy work. What is a good way for the two to communicate so that the GUI can show the subprocess progress? (A cross platform solution is best, but windows only OK). Tha

Re: "Collapsing" a list into a list of changes

2005-02-06 Thread Peter Otten
Francis Girard wrote: > This is a prefect use case for the good old "reduce" function: > > --BEGIN SNAP > > a_lst = [None,0,0,1,1,1,2,2,3,3,3,2,2,2,4,4,4,5] > > def straightforward_collapse(lst): > return reduce(lambda v,e: v[-1]!=e and v+[e] or v, lst[1:], [lst[0]]) reduce() magically increa

Dumb glob question

2005-02-06 Thread Python Dunce
I've run into an issue with glob and matching filenames with brackets '[]' in them. The problem comes when I'm using part of such a filename as the path I'm passing to glob. Here's a trimmed down dumb example. Let's say I have a directory with the following files in it. foo.par2 foo.vol0+1.p

Re: IDLE history, Python IDE, and Interactive Python with Vim

2005-02-06 Thread Ashot
On Mon, 07 Feb 2005 00:55:07 -0600, Ashot <[EMAIL PROTECTED]> wrote: On Sat, 05 Feb 2005 11:07:40 -0700, Fernando Perez <[EMAIL PROTECTED]> wrote: Hi, Ashot wrote: This is sort of both Python and Vim related (which is why I've posted to both newsgroups). [...] I know you've been using ipython recen

Re: IDLE history, Python IDE, and Interactive Python with Vim

2005-02-06 Thread Ashot
On Sat, 05 Feb 2005 11:07:40 -0700, Fernando Perez <[EMAIL PROTECTED]> wrote: Hi, Ashot wrote: This is sort of both Python and Vim related (which is why I've posted to both newsgroups). [...] I know you've been using ipython recently (the readline color bugs), so perhaps my reply is a bit redundant

Re: WYSIWYG wxPython "IDE"....?

2005-02-06 Thread Luis M. Gonzalez
Try PythonCard. Very simple, very easy and based on wxPython. -- http://mail.python.org/mailman/listinfo/python-list

Re: WYSIWYG wxPython "IDE"....?

2005-02-06 Thread Brent W. Hughes
I've also tried Boa Constructor a couple of times and keep having problems using it. So I've got it stuck in the back of my mind for when it finally becomes ready for prime time. (One of the problems was that the tutorial didn't quite match the program.) I really like the concept. It's a lot

Re: overwriting method in baseclass

2005-02-06 Thread Steven Bethard
Harald Massa wrote: Hello! I am using a library (= code of so else) within Python. Somewhere in this library there is: class foo: def baa(self, parameters): print "something" self.baazanan(some other parameters) class mirbo(foo): def baazanan(self, lalala):

Re: Memory Allocation?

2005-02-06 Thread M.E.Farmer
Hello Chris, I am sure there are many inaccuracies in this story but hey you asked instead of seeking your owns answers so In general you need not worry about memory allocation. Too be more specific objects have a size and most of them are known (at least to a wizard named Tim) , but it doesn

overwriting method in baseclass

2005-02-06 Thread Harald Massa
Hello! I am using a library (= code of so else) within Python. Somewhere in this library there is: class foo: def baa(self, parameters): print "something" self.baazanan(some other parameters) class mirbo(foo): def baazanan(self, lalala): print "heylo t

Re: Unable to run IDLE Under Windows

2005-02-06 Thread Marian Aldenhövel
Hi, > Any ideas as to what might me wrong? TclError: unknown color name "white " There is a space after "white" in this error-message. If this string comes from some per-user configuration that may well explain your problem. Ciao, MM -- Marian Aldenhövel, Rosenhain 23, 53123 Bonn. +49 228 624013. h

Re: pygame.mixer.music not playing

2005-02-06 Thread Marian Aldenhövel
Hi, Just curious what is not suitable about FMOD? Nothing. See my other posting. It just took me some time... Ciao, MM -- Marian Aldenhövel, Rosenhain 23, 53123 Bonn. +49 228 624013. http://www.marian-aldenhoevel.de "Wir brauchen keine Opposition, wir sind bereits Demokraten." -- http://mail.python

Re: CGI POST problem was: How to read POSTed data

2005-02-06 Thread M.E.Farmer
Sweet! Glad you fixed it, and documented it all! Thanks for the followups. Now the next poor soul to stumble in can get the right fix. Never know when it could be me ;) M.E.Farmer -- http://mail.python.org/mailman/listinfo/python-list

Re: pygame.mixer.music not playing

2005-02-06 Thread M.E.Farmer
Very cool, glad you got it working. Good job getting it all installed and running so fast. It won't be long till you have a cool media player of your own. I have not used PyFMOD yet so can't help with it ( I thought it was cross platform too **sigh**, at least FMOD is) Happy hacking, M.E.Farme

Returned mail: see transcript for details

2005-02-06 Thread The Post Office
The original message was received at Mon, 7 Feb 2005 10:38:51 +0500 from 196.191.122.168 - The following addresses had permanent fatal errors - python-list@python.org -- http://mail.python.org/mailman/listinfo/python-list

Re: def __init__ question in a class definition

2005-02-06 Thread M.E.Farmer
>Jeffrey Borkent >Systems Specialist >Information Technology Services With that kind of credentials, and the fact that you claim you are a system specialists I don't know you have me worried already. I guess for you I just say RTFM. If you think that is harsh then don't ask a 2nd grade questio

Re: remove duplicates from list *preserving order*

2005-02-06 Thread Steven Bethard
John Machin wrote: So, just to remove ambiguity, WHICH one of the bunch should be retained? Short answer: "the first seen" is what the proverbial "man in the street" would expect For my purposes, it doesn't matter which instance is retained and which are removed, so yes, retaining the first one is

Re: empty classes as c structs?

2005-02-06 Thread Steven Bethard
Michael Spencer wrote: ISTM that 'bunch' or 'namespace' is in effect the complement of vars i.e., while vars(object) => object.__dict__, namespace(somedict) gives an object whose __dict__ is somedict. Yeah, I kinda liked this application too, and I think the symmetry would be nice. Looked at th

Re: CGI POST problem was: How to read POSTed data

2005-02-06 Thread Dan Perl
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > CGIHTTPServer, on the other hand, I have never really trusted. I would > suspect that fella. CGIHTTPServer wasn't the culprit after all, it was os.py. See bug report "[ 1100235 ] Scripts started with CGIHTTPServer: missing cgi envir

Re: pygame.mixer.music not playing

2005-02-06 Thread Marian Aldenhövel
Hi, Also you can try and look for another sound package, like maybe pyFMOD I have looked at it. While I do not like some of the boasting on the FMOD site it does seem very suitable. FMOD is cross-platform but pyFMOD is available only as Win32-Setup. Does that mean it cannot be made to work on Linux

Re: pygame.mixer.music not playing

2005-02-06 Thread M.E.Farmer
Just curious what is not suitable about FMOD ? It seems to be exactly what you are looking for. Cross platform, free, great sound, python bindings, no compiler needed. M.E.Farmer -- http://mail.python.org/mailman/listinfo/python-list

Memory Allocation?

2005-02-06 Thread Chris S.
Is it possible to determine how much memory is allocated by an arbitrary Python object? There doesn't seem to be anything in the docs about this, but considering that Python manages memory allocation, why would such a module be more difficult to design than say, the GC? -- http://mail.python.org

Unable to run IDLE Under Windows

2005-02-06 Thread Jonathan Polley
I have one account on a WindowsXP machine that refuses to run IDLE (or any other python script that uses Tk). Other people can login to that PC and IDLE runs just fine, so it is not an installation issue. When the person who has the problem logs into another PC the problem follows them. Any idea

Re: pygame.mixer.music not playing

2005-02-06 Thread Marian Aldenhövel
Hi, Perhaps Zinf? I could not find anything about remote-controlling it. Did not install it, however. Ciao, MM -- Marian Aldenhövel, Rosenhain 23, 53123 Bonn. +49 228 624013. http://www.marian-aldenhoevel.de "Wir brauchen keine Opposition, wir sind bereits Demokraten." -- http://mail.python.org/mai

Re: WYSIWYG wxPython "IDE"....?

2005-02-06 Thread Simon John
Tim Hoffman wrote: > Have you tried Boa Constructor ? > > http://boa-constructor.sourceforge.net/ Yeah, I was never very impressed with it either. The current version doesn't seem to work with wxPython 2.5.3.1 though I guess there isn't a GUI builder that does what I want, back to the manual

Re: Questions about mathematical signs...

2005-02-06 Thread Dan Bishop
Jeff Epler wrote: > On Sun, Feb 06, 2005 at 12:26:30PM -0800, administrata wrote: > > Hi! I'm programming maths programs. > > And I got some questions about mathematical signs. ... > > 2. Inputing fractions like (a / b) + (c / d), It's tiring work too. > >Can it be simplified? > > Because of th

Re: pygame.mixer.music not playing

2005-02-06 Thread Marian Aldenhövel
Hi, > Could it be a hardware problem? I don't think so. I can play sounds on this machine and I can also play this very file using Windows Media Player. I suspect it's software, but I do not know at which level the problem may lie. Ciao, MM -- Marian Aldenhövel, Rosenhain 23, 53123 Bonn. +49 228 62

Re: Converting a string to a function pointer

2005-02-06 Thread Tim Roberts
Håkan Persson <[EMAIL PROTECTED]> wrote: > >I am trying to "convert" a string into a function pointer. >Suppose I have the following: > >from a import a >from b import b >from c import c > >funcString = GetFunctionAsString() > >and funcString is a string that contains either "a", "b" or "c". >How c

Re: How to read POSTed data

2005-02-06 Thread Dan Perl
"Dan Perl" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thanks, Pierre, this got me much further but I hit another stumbling > block. I can see now that CGIHTTPServer writes all the header lines into > os.environ and creates a subprocess for the script with os.popen2 or > os.p

declarations summary

2005-02-06 Thread Michael Tobis
Summary of my understanding of a recent interesting thread: General usage has "declaration" meaning "statement which does not generate executable bytecode but merely affects the compiler". My assertion that decorator syntax is "declarative" is therefore formally false. The common assertion that "

Re: pygame.mixer.music not playing

2005-02-06 Thread Marian Aldenhövel
Hi, Please post your os name and version, Python version, Pygame version, German Windows XP Home, 2.3.4, 1.6 Also you can try and look for another sound package I will. Until I find something suitable I will just build a dummy class that has the commands I need, I can later interface that to whatev

Re: empty classes as c structs?

2005-02-06 Thread Michael Spencer
Alex Martelli wrote: Steven Bethard <[EMAIL PROTECTED]> wrote: Hmm... interesting. This isn't the main intended use of Bunch/Struct/whatever, but it does seem like a useful thing to have... I wonder if it would be worth having, say, a staticmethod of Bunch that produced such a view, e.g.: class

def __init__ question in a class definition

2005-02-06 Thread Jeffrey Borkent
Hi There, I have an open source program which i am trying to add to. class classname(member,member) def __init__(self,list) self.__list = list self.refresh = 360 my question is what is the __ (double underscore) represent, if anything, in this bliock of a

Re: pickle/marshal internal format 'life expectancy'/backward compatibility

2005-02-06 Thread Adam DePrince
On Sun, 2005-02-06 at 12:12, Philippe C. Martin wrote: > > How complicated is your data structure? Might you just store: > > that's the thing: I don't want to know: My goal is to be able to design You must know. Marshal and pickle both have limits on what they can serialize. > my SC applicat

Re: Word for a non-iterator iterable?

2005-02-06 Thread Terry Reedy
"vincent wehren" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Leif K-Brooks wrote: >> Is there a word for an iterable object which isn't also an iterator, and >> therefor can be iterated over multiple times without being exhausted? The 'therefor' above is a non sequitor. A non

Re: bytecode obfuscation

2005-02-06 Thread Adam DePrince
On Sun, 2005-02-06 at 08:19, Philippe Fremy wrote: > Adam DePrince wrote: > > No amount of obfuscation is going to help you. > > Theorically, that's true. Anything obfuscated can be broken, just like > the non obfuscated version. However it takes more skills and time to > break it. And that's th

Re: pygame.mixer.music not playing

2005-02-06 Thread M.E.Farmer
Hello again, Sorry you have had no success. I would suspect it is your system setup. Seems the code is working. I didn't think you had the typo problem, just mentioned it because it says somewhere in the docs that if the mixer has problems with file loading it would result in a proxy object that s

Re: newbie wants to compile python list of filenames in selected directories

2005-02-06 Thread M.E.Farmer
anthonyberet wrote: > Hi, I am new at Python, and very rusty at the one language I was good > at, which was BASIC. > > I want to write a script to compare filenames in chosen directories, on > windows machines. Ideally it would compose a list of strings of all the > filenames in the directories, a

Re: OT: why are LAMP sites slow?

2005-02-06 Thread Leif K-Brooks
Paul Rubin wrote: I notice that lots of the medium-largish sites (from hobbyist BBS's to sites like Slashdot, Wikipedia, etc.) built using this approach are painfully slow even using seriously powerful server hardware. Yet compared to a really large site like Ebay or Hotmail (to say nothing of Go

Re: Insane import behaviour and regrtest.py: heeelp

2005-02-06 Thread John J. Lee
Tim Peters <[EMAIL PROTECTED]> writes: > [John J. Lee] > > I'm still puzzled, though. Reading the -vv output, I see that when [...] > > Lib[0]$ pwd > > /hda/usr/local/buf/python/python/dist/src/Lib > > That doesn't look to be the same thing as the > > /usr/local/src/python/python/dist/src/L

Re: remove duplicates from list *preserving order*

2005-02-06 Thread John Machin
Francis Girard wrote: > Hi, > > I think your last solution is not good unless your "list" is sorted (in which > case the solution is trivial) since you certainly do have to see all the > elements in the list before deciding that a given element is not a duplicate. > You have to exhaust the iterata

Re: IPython colors in windows

2005-02-06 Thread Fernando Perez
Claudio Grondi wrote: > Hi, > > I have just updated previously announced > and uploaded to > http://people.freenet.de/AiTI-IT/Python/Console.py > version > of Console.py because I was not satisfied with > it (it didn't support arbitrary ANSI escape > sequences for setting text colors ...) I'd s

Re: OT: why are LAMP sites slow?

2005-02-06 Thread Lee Harr
>> Not only that, but with a well-design RDBMS you can put your >> schema changes inside of a transaction and make sure everything >> is right before committing. >> > Bear in mind, however, that *most* common RDBMS will treat each DDL > statement as implicitly committing, so transactional change

python under java2

2005-02-06 Thread motokoit
For some reason i need to start a python script from inside a java code. The main part of the code is something like this try{ Runtime rt = Runtime.getRuntime(); System.out.println("start"); Process proc = Runtime.getRuntime().exec("python myscript.py"); proc.waitFor(); System.out.

Re: Python versus Perl ?

2005-02-06 Thread Dan Perl
"Alex Martelli" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > snacktime <[EMAIL PROTECTED]> wrote: > >> The one drawback coming from the perl world is that you don't have as >> many options when it comes stuff like application frameworks, and some > > URK -- _my_ feeling is that w

RE: Alternative to standard C "for"

2005-02-06 Thread Delaney, Timothy C (Timothy)
[EMAIL PROTECTED] wrote: > 2) for i in range(A, B, STEP): > ...do something... Note that the most common use of this is something like: t = 1, 2, 3 for i in range(len(t)): print i, t[i] This is best accomplished as: t = 1, 2, 3 for i, e in enumerate(t): p

Re: How to read POSTed data

2005-02-06 Thread Dan Perl
"Pierre Quentel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > >> Pierre, I am repeating some questions I already stated in another thread, >> 'CGI POST problem', but do you have any opinions on how CGIHTTPServer's >> do_POST handles requests? It looks to me like it always expe

Re: IPython colors in windows

2005-02-06 Thread Claudio Grondi
Hi, I have just updated previously announced and uploaded to http://people.freenet.de/AiTI-IT/Python/Console.py version of Console.py because I was not satisfied with it (it didn't support arbitrary ANSI escape sequences for setting text colors ...) Now the Console() class supports ANSI escape s

Re: empty classes as c structs?

2005-02-06 Thread Fernando Perez
Steven Bethard wrote: > The complications with attribute hiding is one of main reasons I've > tried to minimize the number of methods associated with Bunch... in order for bunches to be fully useful in general, open contexts, I think that number of methods should be exactly zero (at least without

RE: Why does super() require the class as the first argument?

2005-02-06 Thread Delaney, Timothy C (Timothy)
Nick Coghlan wrote: > It *is* possible to eliminate the explicit class argument, but it > takes a bit (*cough*) of work: > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/286195 Nick - you stole my thunder ;) Note that my recipe uses a sys._getframe() hack, so it will never be in Python

Re: string issue

2005-02-06 Thread Alex Martelli
Bill Mill <[EMAIL PROTECTED]> wrote: ... > > > You are modifying the list as you iterate over it. Instead, iterate over > > > a copy by using: > > > > > > for ip in ips[:]: ... > Once you know it, it's neat, and I use it sometimes. However, it's a > little too "magical" for my tastes; I'd rat

Re: Confused with methods

2005-02-06 Thread jfj
Alex Martelli wrote: I still wouldn't see any "inconsistency" even if two different ways of proceeding gave the same result in a certain case. That would be like saying that having x-(-y) give the same result as x+y (when x and y are numbers) is ``inconsistent''... the word ``inconsistent'' just d

Re: empty classes as c structs?

2005-02-06 Thread Alex Martelli
Brian van den Broek <[EMAIL PROTECTED]> wrote: ... > (I'm just a hobbyist, so if this suggestion clashes with some well > established use of 'Bag' in CS terminology, well, never mind.) Yep: a Bag is a more common and neater name for a "multiset" -- a set-like container which holds each item ``

Re: Confused with methods

2005-02-06 Thread Alex Martelli
jfj <[EMAIL PROTECTED]> wrote: > >>Isn't that inconsistent? > > > > That Python has many callable types, not all of which are descriptors? > > I don't see any inconsistency there. Sure, a more generalized currying > > (argument-prebinding) capability would be more powerful, but not more > > cons

Re: Python versus Perl ?

2005-02-06 Thread Alex Martelli
snacktime <[EMAIL PROTECTED]> wrote: > The one drawback coming from the perl world is that you don't have as > many options when it comes stuff like application frameworks, and some URK -- _my_ feeling is that we have entirely *too many* options for stuff like web application frameworks, GUI tool

Re: loops -> list/generator comprehensions

2005-02-06 Thread Steven Bethard
Alex Martelli wrote: Steven Bethard <[EMAIL PROTECTED]> wrote: at the OP's original code, the line: [(x[0], x[2]) for x in os.walk(".")] is the equivalent of: [dirpath, filenames for dirpath, dirnames, filenames in os.walk('.')] Just a nit: you need parentheses in your second LC too, i.e.: [(dir

Re: empty classes as c structs?

2005-02-06 Thread Steven Bethard
Alex Martelli wrote: Steven Bethard <[EMAIL PROTECTED]> wrote: I don't know what the right solution is here... I wonder if I should write a classmethod-style descriptor that disallows the calling of a function from an instance? Or maybe I should just document that the classmethods should only b

Re: Python versus Perl ?

2005-02-06 Thread Roy Smith
"EP" <[EMAIL PROTECTED]> wrote: > There are very very few cases where anyone is going to require > you to use Python Conversely, it pays to understand when you are likely to be permitted to use it (or any new technology), and when you are likely to be forbidden. Companies are generally the most

Re: Confused with methods

2005-02-06 Thread Alex Martelli
jfj <[EMAIL PROTECTED]> wrote: > If I say: > > x=b.foo > x(1) > > Then, without looking at the previous code, one can say that "x" is a > function which takes one argument. One can say whatever one wishes, but saying it does not make it true. One can say that x is a green frog, but that's fals

Re: loops -> list/generator comprehensions

2005-02-06 Thread Alex Martelli
Steven Bethard <[EMAIL PROTECTED]> wrote: > at the OP's original code, the line: > > [(x[0], x[2]) for x in os.walk(".")] > > is the equivalent of: > > [dirpath, filenames for dirpath, dirnames, filenames in os.walk('.')] Just a nit: you need parentheses in your second LC too, i.e.: [(dirp

Re: empty classes as c structs?

2005-02-06 Thread Alex Martelli
Steven Bethard <[EMAIL PROTECTED]> wrote: > Seems pretty reasonable -- the only thing I worry about is that > classmethods and other attributes (e.g. properties) that are accessible > from instances can lead to subtle bugs when a user accidentally > initializes a Bunch object with the attributes

Re: Python versus Perl ?

2005-02-06 Thread EP
[EMAIL PROTECTED] asked > 3. Perl is installed on our system and a lot of other systems. > You don't have to make sys admins go out of there way to make it > available. It's usualy allready there. I also did a search of job > postings on a popular website. 108 jobs where listed that require > know

Re: Curses on Windows

2005-02-06 Thread Do Re Mi chel La Si Do
same symptoms @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: Python versus Perl ?

2005-02-06 Thread snacktime
I just recently picked up Python after using perl almost exclusively for the last 8 years, and the above mentioned article by Eric Raymond echos my feelings almost exactly. The one drawback coming from the perl world is that you don't have as many options when it comes stuff like application frame

Re: loops -> list/generator comprehensions

2005-02-06 Thread Steven Bethard
Caleb Hattingh wrote: filenames = [os.path.join(dirpath, filename) # This is cool for dirpath, _, filenames in os.walk('.') # This is getting tricky, whats the '_' for? Nothing to do with the list comprehension really. '_' is a commonly used variable name

Re: Insane import behaviour and regrtest.py: heeelp

2005-02-06 Thread Tim Peters
[John J. Lee] > I'm still puzzled, though. Reading the -vv output, I see that when > importing test_cookielib (which is currently the only line in my > regrtest.py -f file), Python doesn't appear to look in Lib/test to > find module "test.test_cookielib" (the actual string passed by > regrtest.py

Re: Python versus Perl ?

2005-02-06 Thread beliavsky
Jorgen Grahn wrote: > > I've read that many people prefer Python and that it is better than > > Perl. However, I want to ask a few other questions. > > I could go on and on, but this essay by Eric Raymond says it better: > > http://www.linuxjournal.com/article/3882 His survey of programming la

New to unix/python. How to install

2005-02-06 Thread Bobby Owens
Hi, Please excuse what is probably a completely newbie question, but my situation is as follows. I'm a windows/.NET developer but have now been asked to take over part of the project which is written in python and runs on Unix. I've muddled through the python code and figured out parts of it. I'

Re: string issue

2005-02-06 Thread Francis Girard
Yes, I also this that comprehension is the clearer way to handle this. You might also consider the good old "filter" function : ips = filter(lambda ip: '255' not in ip, ips) Francis Girard Le vendredi 4 Février 2005 20:38, rbt a écrit : > Thanks guys... list comprehension it is! > > Bill Mill w

Re: [noob] Questions about mathematical signs...

2005-02-06 Thread Steve Holden
administrata wrote: Hi! I'm programming maths programs. And I got some questions about mathematical signs. 1. Inputing suqare like a * a, It's too long when I do time-consuming things. Can it be simplified? You mean you have to write a*a*a*a when you want the fourth power? You need the exponent

Re: Confused with methods

2005-02-06 Thread jfj
Diez B. Roggisch wrote: If things worked as you wanted it to, that would mean that passing a bound method as argument to a class and storing it there to an instance variable that would "eat up" the arguments - surely not the desired behaviour. Could you please give an example of this ? If you mean:

Re: "Collapsing" a list into a list of changes

2005-02-06 Thread Francis Girard
This is a prefect use case for the good old "reduce" function: --BEGIN SNAP a_lst = [None,0,0,1,1,1,2,2,3,3,3,2,2,2,4,4,4,5] def straightforward_collapse(lst): return reduce(lambda v,e: v[-1]!=e and v+[e] or v, lst[1:], [lst[0]]) def straightforward_collapse_secu(lst): return lst and reduce

Re: loops -> list/generator comprehensions

2005-02-06 Thread Caleb Hattingh
Sure Steve Lemme see ... (indentation changed so comments associate with correct bits) Out of curiosity, do you find: filenames = [os.path.join(dirpath, filename) # This is cool for dirpath, _, filenames in os.walk('.') # This is getting tricky, whats

Re: Python versus Perl ?

2005-02-06 Thread Caleb Hattingh
Hi Surfunbear I don't know about the stuff regarding jobs, resumes, etc, but I will tell you the same thing I tell everyone I meet regarding python: Set aside a morning, and work through the python tutorial that comes with the documentation. People like me are going to tell you this and that,

Re: Confused with methods

2005-02-06 Thread Diez B. Roggisch
> I expected that when we add this "x" to a class's dictionary and > then we request it from an instance of that class, it will be > converted to an bound-method and receive its --one-- argument > from the referring instance. Here you are wrong: your b.foo is a bound method - it already _has_ its

Re: Multiple constructors

2005-02-06 Thread Caleb Hattingh
Hi Philip C++ to Python is a steep 'unlearning' curve... That's worthy of QOTW. I decided not to reply to this thread earlier, but you just convinced me otherwise :) I work in Delphi a lot, which is in a lot of respects very similar to C. I have come to the conclusion that function overloadi

Re: loops -> list/generator comprehensions

2005-02-06 Thread Steven Bethard
On 6 Feb 2005 11:28:37 -0800, <[EMAIL PROTECTED]> wrote: > > walkList = [(x[0], x[2]) for x in os.walk(".")] > filenames = [] > for dir, files in walkList: > filenames.extend(["/".join([dir, f]) for f in files]) Caleb Hattingh top-posted: I would be interested to see an example

Re: empty classes as c structs?

2005-02-06 Thread Steven Bethard
Alex Martelli wrote: I think this ``view'' or however you call it should be a classmethod too, for the same reason -- let someone handily subclass Bunch and still get this creational pattern w/o extra work. Maybe a good factoring could be something like: class Bunch(object): def __init__(self,

Re: loops -> list/generator comprehensions

2005-02-06 Thread jamesthiele . usenet
> HTH, It does. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: returning True, False or None

2005-02-06 Thread Francis Girard
I think it is evil to do something "at your own risk" ; I will certainly not embark some roller coaster at my own risk. I also think it is evil to scan the whole list (as "max" ought to do) when only scanning the first few elements would suffice most of the time. Regards Francis Girard Le ven

Re: OT: why are LAMP sites slow?

2005-02-06 Thread Steve Holden
Lee Harr wrote: On 2005-02-06, Brian Beck <[EMAIL PROTECTED]> wrote: Refactoring a database on a live system is a giant pain in the ass, simpler file-based approaches make incremental updates easier. As much as I hate working with relational databases, I think you're forgetting the reliability ev

Re: IPython colors in windows

2005-02-06 Thread Fernando Perez
Claudio Grondi wrote: > It works for me as it is now, so probably it is better to wait for the > next release of IPython with a cleaner implementation of color > schemes before further efforts towards support for choosing > of background colors for each colorized text output in IPython > via exten

Re: [noob] Questions about mathematical signs...

2005-02-06 Thread Jeff Epler
On Sun, Feb 06, 2005 at 12:26:30PM -0800, administrata wrote: > Hi! I'm programming maths programs. > And I got some questions about mathematical signs. > > 1. Inputing suqare like a * a, It's too long when I do time-consuming >things. Can it be simplified? You can write powers with the "**"

Re: loops -> list/generator comprehensions

2005-02-06 Thread Caleb Hattingh
I would be interested to see an example of code that is more concise but yet as *clear* as the one you already have. I can actually read and understand what you've got there. That's cool :) On 6 Feb 2005 11:28:37 -0800, <[EMAIL PROTECTED]> wrote: I wrote this little piece of code to get a l

Re: newbie wants to compile python list of filenames in selected directories

2005-02-06 Thread Caleb Hattingh
Hi Anthony Here is some stuff to get you started (this is from memory, I'm not checking it, but should be mostly helpful): *** import os os.chdir('C:\My Documents') # Can use this to jump around to different folders fileNames = os.listdir('.') # Checks the now current folder namesToMatch = [

Re: empty classes as c structs?

2005-02-06 Thread Alex Martelli
Steven Bethard <[EMAIL PROTECTED]> wrote: > Hmm... interesting. This isn't the main intended use of > Bunch/Struct/whatever, but it does seem like a useful thing to have... > I wonder if it would be worth having, say, a staticmethod of Bunch that > produced such a view, e.g.: > > class Bunch(ob

Googling for wmi and python....

2005-02-06 Thread Harald Massa
I upgraded Python to 2.4 now the game really starts, looking all over the internet for all the packages ... I needed Tim Goldens WMI ... and googeld, dropping there: http://www.microsoft.com/technet/scriptcenter/scripts/python/misc/wmi/defau lt.mspx With comment: Sample scripts for retrieving

[noob] Questions about mathematical signs...

2005-02-06 Thread administrata
Hi! I'm programming maths programs. And I got some questions about mathematical signs. 1. Inputing suqare like a * a, It's too long when I do time-consuming things. Can it be simplified? 2. Inputing fractions like (a / b) + (c / d), It's tiring work too. Can it be simplified? 3. How can i

Re: newbie wants to compile python list of filenames in selected directories

2005-02-06 Thread John J. Lee
Greg Krohn <[EMAIL PROTECTED]> writes: > anthonyberet wrote: [...] > > I want to write a script to compare filenames in chosen directories, > > on windows machines. Ideally it would compose a list of strings of > > all the filenames in the directories, and those directories would be > > chosable by

Re: Insane import behaviour and regrtest.py: heeelp

2005-02-06 Thread John J. Lee
Tim Peters <[EMAIL PROTECTED]> writes: > [John J. Lee] > > ... > > I tried it, and I get the same results as before (the test modules from my > > installed copy of Python are picked up instead of the local copies in > > my CVS checkout's Lib/test, apparently entirely contrary to sys.path). > > Tr

Re: How to read POSTed data

2005-02-06 Thread Pierre Quentel
Pierre, I am repeating some questions I already stated in another thread, 'CGI POST problem', but do you have any opinions on how CGIHTTPServer's do_POST handles requests? It looks to me like it always expects form data to be part of the POST command header, in the path of the URL, just like a

Re: "Collapsing" a list into a list of changes

2005-02-06 Thread Alan McIntyre
Thanks to everybody that responded; I appreciate all the input, even if I didn't respond to all of it individually. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: remove duplicates from list *preserving order*

2005-02-06 Thread Steven Bethard
Francis Girard wrote: I think your last solution is not good unless your "list" is sorted (in which case the solution is trivial) since you certainly do have to see all the elements in the list before deciding that a given element is not a duplicate. You have to exhaust the iteratable before yie

Re: Error!

2005-02-06 Thread administrata
"John Machin" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > administrata wrote: > > I'm programming Car Salesman Program. > > It's been "3 days" learning python... > > >From whom or what book or what tutorial? > > > But, i got problem > > You got problemS. What Jeff & Brian

Re: loops -> list/generator comprehensions

2005-02-06 Thread Steven Bethard
[EMAIL PROTECTED] wrote: I wrote this little piece of code to get a list of relative paths of all files in or below the current directory (*NIX): walkList = [(x[0], x[2]) for x in os.walk(".")] filenames = [] for dir, files in walkList: filenames.extend(["/".join([dir, f]) for

ANN: 'twander' 3.193 Released And Available

2005-02-06 Thread Tim Daneliuk
'twander' Version 3.193 is now released and available for download at: http://www.tundraware.com/Software/twander The last public release was 3.160. Existing users are encouraged to upgrade to this release as it has a number of bug fixes and several significant new features including: -

Re: remove duplicates from list *preserving order*

2005-02-06 Thread Francis Girard
Hi, I think your last solution is not good unless your "list" is sorted (in which case the solution is trivial) since you certainly do have to see all the elements in the list before deciding that a given element is not a duplicate. You have to exhaust the iteratable before yielding anything.

Re: Multiple constructors

2005-02-06 Thread Steven Bethard
Alex Martelli wrote: If you want to do this all the time, you could even build appropriate infrastructure for this task -- a little custom descriptor and metaclass, and/or decorators. Such infrastructure building is in fact fun and instructive -- as long as you don't fall into the trap of *using* s

Re: ANN: Frog 1.3 released (python 'blog' application)

2005-02-06 Thread Irmen de Jong
Jorey Bump wrote: Thanks, I'm impressed. However, I feel as though the file manager should be integrated with Frog in a such a way that it is enabled automatically for users when they are created. The mkuser.py script felt a bit awkward, especially when creating users was so easy in the administ

  1   2   >