Re: a type without a __mro__?

2005-02-06 Thread Alex Martelli
John Lenton <[EMAIL PROTECTED]> wrote: > class C(type): > def __getattribute__(self, attr): > if attr == '__mro__': > raise AttributeError, "What, *me*, a __mro__? Nevah!" > return super(C, self).__getattribute__(attr) > > class D(object): > __metacla

Re: bytecode obfuscation

2005-02-06 Thread Adam DePrince
On Thu, 2005-02-03 at 16:58, Jarek Zgoda wrote: > snacktime napisał(a): > > > Everything except the libraries that actually connect to the > > bank networks would be open source, and those libraries aren't > > something that you would even want to touch anyways. > > This sounds suspicious to me.

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

2005-02-06 Thread Adam DePrince
On Sat, 2005-02-05 at 17:04, Tim Peters wrote: > [Philippe C. Martin] > > I am looking into using the pickle format to store object/complex data > > structures into a smart card as it would make the design of the embedded > > application very simple. > > > > Yet the card might have to stay in the p

Re: Multiple constructors

2005-02-06 Thread Leif K-Brooks
Philip Smith wrote: I don't seem to be able to define multiple versions of __init__ in my matrix class (ie to initialise either from a list of values or from 2 dimensions (rows/columns)). You could either use an if statement with *args: class Matrix(object): def __init__(self, *args):

Re: bicyclerepairman python24 windows idle :(

2005-02-06 Thread EuGeNe
Kim Changjune wrote: EuGeNe wrote: Hi there, I am no expert but wanted to give bicyclerepairman 0.9 a go just to see what a refactoring browser is and does. Followed every step of the install, I think, but idle doesn't start with the RepairMan section in config-extensions.def ... is it incompatible

Re: bicyclerepairman python24 windows idle :(

2005-02-06 Thread EuGeNe
Kim Changjune wrote: EuGeNe wrote: Hi there, I am no expert but wanted to give bicyclerepairman 0.9 a go just to see what a refactoring browser is and does. Followed every step of the install, I think, but idle doesn't start with the RepairMan section in config-extensions.def ... is it incompatible

Re: How to read POSTed data

2005-02-06 Thread Pierre Quentel
Here is an example of how to get the POST data : #def do_POST(self): #ctype, pdict = cgi.parse_header(self.headers.getheader('content-type')) #length = int(self.headers.getheader('content-length')) #if ctype == 'multipart/form-data': #self.body = cgi.parse_m

Re: Multiple constructors

2005-02-06 Thread vincent wehren
Philip Smith wrote: Call this a C++ programmers hang-up if you like. I don't seem to be able to define multiple versions of __init__ in my matrix class (ie to initialise either from a list of values or from 2 dimensions (rows/columns)). Even if Python couldn't resolve the __init__ to use on the

Re: [EVALUATION] - E01: The Java Failure - May Python Helps?

2005-02-06 Thread Terry Reedy
"Ilias Lazaridis" <[EMAIL PROTECTED]> wrote in message >> Then 'print html_doc_instance' can print the html doc corresponding to >> the object model. > > I understand this procedure. > > I would like to use a standard way, which uses the standard metadata > [implicit/explicit defined]. > > Does

Re: Word for a non-iterator iterable?

2005-02-06 Thread vincent wehren
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? "Sequence" is close, but a non-iterator iterable could technically provide an __iter__ method without implementing the sequence prot

Re: Multiple constructors

2005-02-06 Thread Leif K-Brooks
Leif K-Brooks wrote: @classmethod def from_pair(self, rows, columns): return Matrix([rows, columns]) # Or with the right argument Er... I'm not sure why I named that argument "self", it should be "cls" if you don't want to confuse anyone reading your code. -- http://mail.python.or

Re: Multiple constructors

2005-02-06 Thread Terry Reedy
"Philip Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Call this a C++ programmers hang-up if you like. > > I don't seem to be able to define multiple versions of __init__ in my > matrix Correct. > class (ie to initialise either from a list of values or from 2 dimensions

Re: Multiple constructors

2005-02-06 Thread Alex Martelli
Philip Smith <[EMAIL PROTECTED]> wrote: > Call this a C++ programmers hang-up if you like. > > I don't seem to be able to define multiple versions of __init__ in my matrix Indeed, you can never define ``multiple versions'' of the same name in the same scope: one scope + one name -> one object.

Re: Word for a non-iterator iterable?

2005-02-06 Thread Alex Martelli
Leif K-Brooks <[EMAIL PROTECTED]> 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? > "Sequence" is close, but a non-iterator iterable could technically > provide an __iter__ method without imp

Re: [EVALUATION] - E01: The Java Failure - May Python Helps?

2005-02-06 Thread Alex Martelli
Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Markus Wankus wrote: > > > Google his name - he has been banned from Netbeans and Eclipse (and > > Hibernate, and others...) for good reason. Can you imagine how much of > > a Troll you need to be to *actually* get "banned" from the newsgroups of > > op

Re: bytecode obfuscation

2005-02-06 Thread Alex Martelli
snacktime <[EMAIL PROTECTED]> wrote: ... > How difficult is it to turn python bytecode into it's original source? It's pretty easy, not really the original source (you lose comments etc) but close enough to read and understand. > Is it that much different than java (this is what they will pro

Re: [EVALUATION] - E01: The Java Failure - May Python Helps?

2005-02-06 Thread Ilias Lazaridis
Terry Reedy wrote: "Ilias Lazaridis" <[EMAIL PROTECTED]> wrote in message Then 'print html_doc_instance' can print the html doc corresponding to the object model. I understand this procedure. I would like to use a standard way, which uses the standard metadata [implicit/explicit defined]. Does s

Re: Python 2.4 binaries for accessing PostgreSQL from Windows?

2005-02-06 Thread Frank Millman
Frank Millman wrote: > Hi all > > The subject line says it all. > > I have been using pypgsql to access PostgreSQL from Linux and from > Windows, and it works fine. > > I am upgrading to Python 2.4. I can recompile pypgsql for Linux, but I > do not have a Windows compiler. SourceForge has a binary

Re: How do I convert arithemtic string (like "2+2") to a number?

2005-02-06 Thread Reinhold Birkenfeld
Michael Hartl wrote: > Adam brings up a good point: eval is a very general function which > evaluates an arbitrary Python expression. As a result, it (and its > close cousin exec) should be used with caution if security is an issue. To get a secure eval for simple mathematical expressions, it sho

Re: Multiple constructors

2005-02-06 Thread Reinhold Birkenfeld
vincent wehren wrote: > Philip Smith wrote: >> Call this a C++ programmers hang-up if you like. >> >> I don't seem to be able to define multiple versions of __init__ in my matrix >> class (ie to initialise either from a list of values or from 2 dimensions >> (rows/columns)). >> >> Even if Pytho

Python scripts a PC Interfacing equipment

2005-02-06 Thread Pramode C E
Hello, The Phoenix project aims to bring low cost PC-based experimental Physics to the classroom. Read a short intro here: http://linuxgazette.net/111/pramode.html Regards, Pramode --- -- http://mail.python.org/mailman/listinfo/python-list

Download a file from FTP server to local machine

2005-02-06 Thread rozita raissi
Hello,   I'm writing an ftp client script which must run in explorer. My script must be placed on and run from a web server. User can connect through it to a FTP server. If user requests to download a file from FTP server, file is downloaded to web server on which my script is running. How can I t

pygame.mixer.music not playing

2005-02-06 Thread Marian Aldenhövel
Hi, I am trying to make pygame play music on windows. This simple program: import pygame,time pygame.init() print "Mixer settings", pygame.mixer.get_init() print "Mixer channels", pygame.mixer.get_num_channels() pygame.mixer.music.set_volume(1.0) pyga

Re: How do I convert arithemtic string (like "2+2") to a number?

2005-02-06 Thread Adomas
Well, a bit more secure would be eval(expression, {'__builtins__': {}}, {}) or alike. -- http://mail.python.org/mailman/listinfo/python-list

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

2005-02-06 Thread Tim Hoffman
Have you tried Boa Constructor ? http://boa-constructor.sourceforge.net/ Simon John wrote: I'm writing my 2nd large wxPython program, and after the problems I found doing the first's layout in code, I'd like to look at using a 'WYSIWYG' IDE, like VisualStudio does for MFC. I've tried a few that I f

Re: dynamic func. call

2005-02-06 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > Try this: > > def myfunc(): > print "helo" > > s = "myfunc()" > a = eval(s) > No, please don't try that. Good uses for eval are *very* rare, and this isn't one of them. Use the 'a = locals()[x]()' suggestion (or vars() instead of locals()), or even better put al

Re: Multiple constructors

2005-02-06 Thread Philip Smith
Thanks to all of you Some useful ideas in there, even if some of them stretch my current knowledge of the language. C++ to Python is a steep 'unlearning' curve... Phil "Philip Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Call this a C++ programmers hang-up if you like.

After 40 years ... Knuth vol 4 is to be published!!

2005-02-06 Thread Laura Creighton
"More than forty years in the making, the long-anticipated Volume 4 of The Art of Computer Programming is about to make its debuta. in parts. Rather than waiting for the complete book, Dr. Knuth and Addison-Wesley are publishing it in installments ("fascicles") a la Charles Dickens. See http://www

Re: [EVALUATION] - E01: The Java Failure - May Python Helps?

2005-02-06 Thread Stephen Kellett
In message <[EMAIL PROTECTED]>, Ilias Lazaridis <[EMAIL PROTECTED]> writes Can one please point me to a downloadable version of the 2 reference manuals (did not found them)? Well, there is an obvious website address to visit and you can see the word "documentation" on that website without scroll

Re: OT: why are LAMP sites slow?

2005-02-06 Thread Brian Beck
Refactoring a database on a live system is a giant pain in the ass, simpler file-based approaches make incremental updates easier. The Wikipedia example has been thrown around, I haven't looked at the code either; except for search why would they need a database to look up an individual WikiWord?

Re: Multiple constructors

2005-02-06 Thread vincent wehren
Reinhold Birkenfeld wrote: vincent wehren wrote: Philip Smith wrote: Call this a C++ programmers hang-up if you like. I don't seem to be able to define multiple versions of __init__ in my matrix class (ie to initialise either from a list of values or from 2 dimensions (rows/columns)). Even if Py

Re: variable declaration

2005-02-06 Thread Arthur
On Sun, 6 Feb 2005 08:47:31 +0100, [EMAIL PROTECTED] (Alex Martelli) wrote: > >Even the various "success stories" we've collected (both on websites, >and, more impressive to PHBs, into paper booklets O'Reilly has printed) >play a role. ``NASA uses it for space missions, so of course we must >use

Re: changing local namespace of a function

2005-02-06 Thread Kent Johnson
Bo Peng wrote: Kent Johnson wrote: You are still including the compile overhead in fun2. If you want to see how fast the compiled code is you should take the definition of myfun out of fun2: I assumed that most of the time will be spent on N times execution of myfunc. Doh! Right. Kent -- http://

Re: bad generator performance

2005-02-06 Thread Johannes Ahl-mann
> Um. Under my definition of "recursion", you haven't really removed > recursion in the generator version. That is, you're still calling the > depthFirstIterator method upon each iteration--you've just changed from > list-concatenation to yielding instead, which trades off list-management > overhea

Re: [EVALUATION] - E01: The Java Failure - May Python Helps?

2005-02-06 Thread Ilias Lazaridis
Stephen Kellett wrote: In message <[EMAIL PROTECTED]>, Ilias Lazaridis <[EMAIL PROTECTED]> writes Can one please point me to a downloadable version of the 2 reference manuals (did not found them)? Well, there is an obvious website address to visit and you can see the word "documentation" on tha

Python versus Perl ?

2005-02-06 Thread surfunbear
I've read some posts on Perl versus Python and studied a bit of my Python book. I'm a software engineer, familiar with C++ objected oriented development, but have been using Perl because it is great for pattern matching, text processing, and automated testing. Our company is really fixated on r

Re: bytecode obfuscation

2005-02-06 Thread Philippe Fremy
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 the point. By raising the barrier for breaking a product, you just

Re: bad generator performance

2005-02-06 Thread Alex Martelli
Johannes Ahl-mann <[EMAIL PROTECTED]> wrote: > a non-recursive solution to traversing a recursive data type is bound to > get ugly, isn't it? Not necessarily: sometimes using an explicit stack can be quite pretty, depending. E.g.: def all_leaves(root): stack = [root] while stack:

Re: Python versus Perl ?

2005-02-06 Thread Reinhold Birkenfeld
[EMAIL PROTECTED] wrote: > I've read some posts on Perl versus Python and studied a bit of my > Python book. > > I'm a software engineer, familiar with C++ objected oriented > development, but have been using Perl because it is great for pattern > matching, text processing, and automated testing

Re: Insane import behaviour and regrtest.py: heeelp

2005-02-06 Thread John J. Lee
Nick Coghlan <[EMAIL PROTECTED]> writes: > John J. Lee wrote: > > The only change I made to regrtest other than the print statements was > > to add Lib to sys.path, so I pick up modules from CVS instead of the > > installed 2.4 versions (yeah, I know I should build and install a > > python2.5 exec

Re: Python versus Perl ?

2005-02-06 Thread Kartic
[EMAIL PROTECTED] said the following on 2/6/2005 8:19 AM: I've read some posts on Perl versus Python and studied a bit of my Python book. I'm a software engineer, familiar with C++ objected oriented development, but have been using Perl because it is great for pattern matching, text processing, a

Curses on Windows

2005-02-06 Thread Peter
Last November I posted a message asking for advice on using simple screen handling techniques under Windows. Since then I have been occupied with family / job /Christmas /living and trying to understand curses under linux (it works, seems very complex, sure I'm missing something ...). Only now a

Re: [EVALUATION] - E01: The Java Failure - May Python Helps?

2005-02-06 Thread Ilias Lazaridis
"Ilias Lazaridis" <[EMAIL PROTECTED]> wrote in message [...] I want to add metadata to everything within my design (functions, data, classes, ...), if possible with a standard way. [...] I want to generate things (code, txt, html etc.) out of my object-model, whilst using with a flexible generator

Re: How do I convert arithemtic string (like "2+2") to a number?

2005-02-06 Thread John J. Lee
"Adomas" <[EMAIL PROTECTED]> writes: > Well, a bit more secure would be > > eval(expression, {'__builtins__': {}}, {}) > > or alike. Don't believe this without (or even with ;-) very careful thought, anyone. Google for rexec. John -- http://mail.python.org/mailman/listinfo/python-list

Re: pygame.mixer.music not playing

2005-02-06 Thread M.E.Farmer
Marian Aldenhövel wrote: > Hi, > > I am trying to make pygame play music on windows. This simple program: > > import pygame,time > pygame.init() > print "Mixer settings", pygame.mixer.get_init() > print "Mixer channels", pygame.mixer.get_num_channels() > pygame.mixer.m

ANN: SPE 0.7.2.A IDE with wxGlade, Uml & Blender support

2005-02-06 Thread s_t_a_n_i
Spe is a python IDE with auto-indentation, auto completion, call tips, syntax coloring, uml viewer, syntax highlighting, class explorer, source index, auto todo list, sticky notes, integrated pycrust shell, python file browser, recent file browser, drag&drop, context help, ... Special is its blende

RE: bad generator performance

2005-02-06 Thread Jimmy Retzlaff
Johannes Ahl-mann wrote: > i just wondered if there was a concise, clean way of doing this with > generators which i had overlooked, or whether there was some blatant > mistake in my code. Aside from the recursion question... You don't really give the complete story so it's hard to tell what exac

Re: Python versus Perl ?

2005-02-06 Thread Roy Smith
[EMAIL PROTECTED] wrote: > I've read some posts on Perl versus Python and studied a bit of my > Python book. > > I'm a software engineer, familiar with C++ objected oriented > development, but have been using Perl because it is great for pattern > matching, text processing, and automated testin

Re: variable declaration

2005-02-06 Thread Roy Smith
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Alex Martelli) wrote: > This is a good development, overall. Against stupidity, the gods > themselves contend in vain; Python's entrance into stupid firms broadens > its potential appeal from less than 10% to around 100% of the market, > which i

Re: Python versus Perl ?

2005-02-06 Thread moma
Reinhold Birkenfeld wrote: [EMAIL PROTECTED] wrote: I've read some posts on Perl versus Python and studied a bit of my Python book. I'm a software engineer, familiar with C++ objected oriented development, but have been using Perl because it is great for pattern matching, text processing, and autom

Confused with methods

2005-02-06 Thread jfj
I don't understand. We can take a function and attach it to an object, and then call it as an instance method as long as it has at least one argument: # class A: pass def foo(x): print x A.foo = foo a=A() a.foo() # However this is not possible for another instance method

Re: OT: why are LAMP sites slow?

2005-02-06 Thread Lee Harr
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 even

Re: variable declaration

2005-02-06 Thread Alex Martelli
Roy Smith <[EMAIL PROTECTED]> wrote: > > which is good news for sellers of books, tools, training, consultancy > > services, and for Python programmers everywhere -- more demand always > > helps. *BUT* the price is eternal vigilance... > > I'm not sure what that last sentence is supposed to mean

Re: Confused with methods

2005-02-06 Thread Matthias Kempka
Hi Gerald, When you define an instance method, the first parameter (in the definition) represents the instance. By convention, you would name it "self": # class B: def foo(self, x): print "we have two parameters: " + str(self) + " and " + x # then

Re: bad generator performance

2005-02-06 Thread Johannes Ahl-mann
> You don't really give the complete story so it's hard to tell what > exactly is going on. For example, I would assume the recursion is > calling the same method (i.e., depthFirstIterator1 or > depthFirstIterator2), but then you posted separate timing information > for a "recursive helper function

Re: Python versus Perl ?

2005-02-06 Thread Alex Martelli
Reinhold Birkenfeld <[EMAIL PROTECTED]> wrote: ... > > Perl also has excellent pattern matching compared to > > sed, not sure about how Python measures up, > > but this seems to make perl ideally suited to text processing. > > Python has regular expressions much like Perl. The only difference

Re: Confused with methods

2005-02-06 Thread Dan Perl
"jfj" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I don't understand. > We can take a function and attach it to an object, and then call it > as an instance method as long as it has at least one argument: > > # > class A: > pass > > def foo(x): > print x > > A.foo

Re: Confused with methods

2005-02-06 Thread Alex Martelli
jfj <[EMAIL PROTECTED]> wrote: > I don't understand. > We can take a function and attach it to an object, and then call it > as an instance method as long as it has at least one argument: > > # > class A: >pass > > def foo(x): >print x > > A.foo = foo > a=A() > a.foo() > ###

Re: bad generator performance

2005-02-06 Thread Fredrik Lundh
Johannes Ahl-mann wrote: > the program is supposed to manage bookmarks and i thought it would be a > good idea to represent the bookmarks as a tree (with folders as internal > nodes and bookmarks as leaves). > so, a tree is never going to hold more than say 2000 nodes and is going > to be rather w

Re: Python versus Perl ?

2005-02-06 Thread Courageous
> If Python is better than Perl, I'm curious how really significant >those advantages are ? The main advantage is Python's cleanliness. In Perl, there are so many different ways of writing a thing, that to be adept in perl, you have to know them all, otherwise you won't be able to read another p

Re: pygame.mixer.music not playing

2005-02-06 Thread Marian Aldenhövel
Hi, Search the net. You are not the first to try and build a jukebox out of pygame ;) I did find a few, yes. Currently this is a toy project as I am learning the language, so early success means more to me than perfect results. And, as I said, I do not really have an alternative. Maybe some way to

Re: How do I convert arithemtic string (like "2+2") to a number?

2005-02-06 Thread Michael Spencer
John J. Lee wrote: "Adomas" <[EMAIL PROTECTED]> writes: Well, a bit more secure would be eval(expression, {'__builtins__': {}}, {}) or alike. Don't believe this without (or even with ;-) very careful thought, anyone. Google for rexec. John This module provides a more systematic way to set up res

Re: IPython colors in windows

2005-02-06 Thread Claudio Grondi
Hi, I have done some more work on Console.py from the readline package version 1.12, adding support for background colors and testing of proper function of them (run the Console.py script to see coloured output). Added was also the possibility to set the default text/background colors for colored

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

2005-02-06 Thread Philippe C. Martin
> 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 my SC applications without having to change the file system every time I wish to add/subtract data to be store - I should say 'constant' data to be stored for 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] > Dan Perl wrote: > >> how is a multipart POST request parsed by CGIHTTPServer? > [...] > CGIHTTPServer, on the other hand, I have never really trusted. I would > suspect that fella. It turns out I was wrong thinking that the POST reque

Re: Insane import behaviour and regrtest.py: heeelp

2005-02-06 Thread Tim Peters
[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). Try running Python with -vv (that's two letter "v", not

Re: How to read POSTed data

2005-02-06 Thread Dan Perl
"Pierre Quentel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Here is an example of how to get the POST data : > > #def do_POST(self): > #ctype, pdict = > cgi.parse_header(self.headers.getheader('content-type')) > #length = int(self.headers.getheader('content

Re: How do I enter/receive webpage information?

2005-02-06 Thread Jorgen Grahn
On 05 Feb 2005 22:58:52 +, John J. Lee <[EMAIL PROTECTED]> wrote: > Jorgen Grahn <[EMAIL PROTECTED]> writes: > [...] >> I did it this way successfully once ... it's probably the wrong approach in >> some ways, but It Works For Me. >> >> - used httplib.HTTPConnection for the HTTP parts, buildi

Re: Confused with methods

2005-02-06 Thread jfj
Dan Perl wrote: "jfj" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] However this is not possible for another instance method: class A: pass class B: def foo(x,y) print x,y b=B() A.foo = b.foo a=A() # error!!! a.foo() ## Python complains that 'foo() takes

Re: An Ode To My Two Loves

2005-02-06 Thread Jorgen Grahn
On Sat, 05 Feb 2005 12:33:47 -0500, Jamey Cribbs <[EMAIL PROTECTED]> wrote: > At the risk of calling my manhood into question, ... > Under the influence of some kind of strange force and will probably be > embarrassed when he snaps out of it, You shouldn't be -- I don't think I've seen anyone tal

Re: Confused with methods

2005-02-06 Thread jfj
Alex Martelli wrote: 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 consiste

Re: variable declaration

2005-02-06 Thread Jeremy Bowers
On Sun, 06 Feb 2005 07:30:33 -0500, Arthur wrote: > What if: > > There was a well conducted market survey conclusive to the effect that > adding optional strict variable declaration would, in the longer run, > increase Python's market share dramatically. > > It just would. > > Why would it? Wha

Re: Python versus Perl ?

2005-02-06 Thread Jorgen Grahn
On 6 Feb 2005 05:19:09 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: ... > I'm a software engineer, familiar with C++ objected oriented > development, but have been using Perl because it is great for pattern > matching, text processing, and automated testing. Our company is really > fixated

newbie wants to compile python list of filenames in selected directories

2005-02-06 Thread anthonyberet
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, and those directories would be

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

2005-02-06 Thread Greg Krohn
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, and those

Re: pygame.mixer.music not playing

2005-02-06 Thread Greg Krohn
Marian Aldenhövel wrote: Hi, I am trying to make pygame play music on windows. This simple program: import pygame,time pygame.init() print "Mixer settings", pygame.mixer.get_init() print "Mixer channels", pygame.mixer.get_num_channels() pygame.mixer.music.set_volume(1.0) pyg

Re: variable declaration

2005-02-06 Thread Arthur
On Sun, 06 Feb 2005 08:20:29 -0500, Jeremy Bowers <[EMAIL PROTECTED]> wrote: >On Sun, 06 Feb 2005 07:30:33 -0500, Arthur wrote: >> What if: >> >> There was a well conducted market survey conclusive to the effect that >> adding optional strict variable declaration would, in the longer run, >> incr

Re: pygame.mixer.music not playing

2005-02-06 Thread Daniel Bickett
Marian Aldenhövel wrote: > Maybe some way to remote control another player would be in order. Leave it > to software that is specialized and all. But I would want something that runs > on Windows and Linux which narrows down my options. Perhaps Zinf? http://www.zinf.org/ -- Daniel Bickett dbick

Re: empty classes as c structs?

2005-02-06 Thread Steven Bethard
Nick Coghlan wrote: By assigning to __dict__ directly, you can use the attribute view either as it's own dictionary (by not supplying one, or supplying a new one), or as a convenient way to programmatically modify an existing one. For example, you could use it to easily bind globals without need

loops -> list/generator comprehensions

2005-02-06 Thread jamesthiele . usenet
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 f in files]) It works f

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

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: 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.

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

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: 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: "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: 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: 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: 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

[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

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

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

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: 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: [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: 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: 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: 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

  1   2   >