Re: mutable numeric type

2007-01-01 Thread Steven D'Aprano
On Mon, 01 Jan 2007 19:20:21 -0800, Andreas Beyer wrote: > I am using a third party library that is performing basic numerical > operations (adding, multiplying, etc.) with objects of unknown type. Of > course, the objects must support the numerical operators. In my case the > third party libra

how to move files based on file-ending from dirs and subdirs to specific dir?

2007-01-01 Thread Evan Carmi
hey, i am trying to move files with a specific file-ending (.msf) to dir above their current location. my code so far works as long as all the files are on the same dir level. but how can i make it work if there are multiple subdirs with files inside of them on different dir levels? my code so

Re: How do I add users using Python scripts on a Linux machine

2007-01-01 Thread Ramdas
Well, I need to add users from a web interface for a web server, which runs only Python. I need to add users, set quotas and in future even look at managing ip tables to limit bandwidth. I know os.system(), but this has to be done through a form entry through a web interface. Anyways thanks, do

Special Characters (Unicode, Ascii) in Python and MySQL

2007-01-01 Thread ronrsr
I have an MySQL database called zingers. The structure is: zid - integer, key, autoincrement keyword - varchar citation - text quotation - text I am having trouble storing text, as typed in latter two fields. Special characters and punctuation all seem not to be stored and retrieved correctly. S

Re: Writing more efficient code

2007-01-01 Thread Beliavsky
If in the newsgroup comp.lang.x somone asks how to do y, and you suggest using language z, without answering their question, which was how to do it in x, you will likely just annoy people and perhaps make it even less likely that they will try z. I have my own favorite language z and have not alwa

mutable numeric type

2007-01-01 Thread Andreas Beyer
There has been quite some traffic about mutable and immutable data types on this list. I understand the issues related to mutable numeric data types. However, in my special case I don't see a better solution to the problem. Here is what I am doing: I am using a third party library that is perfo

Re: OO question

2007-01-01 Thread Dan Sommers
On 1 Jan 2007 17:09:19 -0800, [EMAIL PROTECTED] wrote: > Lets say I have those two classes, Person and Address. How would one > implement the relationship between them? First, a Person can have one > or more addresses (or none), that could be represented as a list of > Addresses, right? But then,

Re: OO question

2007-01-01 Thread Paddy
Steven D'Aprano wrote: > On Sun, 31 Dec 2006 22:00:58 -0800, Paddy wrote: > > >> def save(self, filename): > >> self.currentfile = file(filename, "w") > >> for address in self.addresses: > >> self.save_one_address(address.export()) > >> self.currentfile.clos

Re: OO question

2007-01-01 Thread Tim Henderson
On Jan 1, 8:09 pm, [EMAIL PROTECTED] wrote: > Lets say I have those two classes, Person and Address. How would one > implement the relationship between them? First, a Person can have one > or more addresses (or none), that could be represented as a list of > Addresses, right? But then, if I have an

HowTo feed AcctName and Password into a website via HTTP

2007-01-01 Thread J. Richards
I'm doing QA testing of a WebApp. First step before crawling the links is to enter the two texts mentioned. Do I extract the login page using: import sys, os, urllib, urlparse Then figure out the HTTP string and then feed that into a HTTP Post ? Or do I use Forms, CGI or Pamie ?? Whats the

Re: Writing more efficient code

2007-01-01 Thread John Machin
gonzlobo wrote: > Greetings, and happyNewYear to all. > > I picked up Python a few weeks ago, and have been able to parse large > files and process data pretty easily, but I believe my code isn't too > efficient. I'm hoping dictionaries will help out, but I'm not sure the > best way to implement th

Re: OO question

2007-01-01 Thread fejkadress
First I want to say thanks everyone for helping me! John Machin wrote: > [EMAIL PROTECTED] wrote: > > I want to make an addressbook and I'm new to OO programming, so I > > wonder if this sounds reasonable. > > > > I think of making a class Address which contains all data about one > > person, tha

Re: Writing more efficient code

2007-01-01 Thread bearophileHUGS
Jon Harrop: > I think most people could pick up the core ideas in a day and start writing > working programs. Probably I am not that intelligent, I probably need some months :-) But that language has many good sides, and one day I'll probably try to learn it a bit. > Mathematica is expensive but

Re: Writing more efficient code

2007-01-01 Thread Paul McGuire
"gonzlobo" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Greetings, and happyNewYear to all. > > I picked up Python a few weeks ago, and have been able to parse large > files and process data pretty easily, but I believe my code isn't too > efficient. I'm hoping dictionaries will h

Re: How do I add users using Python scripts on a Linux machine

2007-01-01 Thread Hari Sekhon
That is shell scripting with a python layer on top. Is there a specific reason you have to use python? Why not just use shell, that's what it's designed for? Unless you have some complex maths/networking requirement or something on top. -h On 01/01/07, Daniel Klein <[EMAIL PROTECTED]> wrote: > On

Re: How do I add users using Python scripts on a Linux machine

2007-01-01 Thread Daniel Klein
On 1 Jan 2007 11:33:42 -0800, "Ramdas" <[EMAIL PROTECTED]> wrote: >How do I add users using Python scripts on a Linux machine? > >Someone has a script? This should be as easy as something like: os.system("/usr/sbin/useradd -m -d /home/newuser -s /bin/ksh") Dan -- http://mail.python.org/mailman

Re: PEP 3107 Function Annotations for review and comment

2007-01-01 Thread Tony Lownds
On Jan 1, 2007, at 1:53 PM, Paul Boddie wrote: > It's true that for the area to be explored, which I know you've been > doing, one first has to introduce an annotation scheme that can > then be > used by things like pylint. I'd like to see assertions about the > usefulness of such annotations ve

Re: Writing more efficient code

2007-01-01 Thread Jon Harrop
[EMAIL PROTECTED] wrote: > Jon Harrop: >> OCaml's pattern matcher is very sophisticated and very fast. You'll >> probably shrink your code by several fold whilst also having it run a few >> orders of magnitude faster and having it statically checked, so it will >> be more reliable. > > You seem to

Re: Writing more efficient code

2007-01-01 Thread Diez B. Roggisch
gonzlobo schrieb: > Greetings, and happyNewYear to all. > > I picked up Python a few weeks ago, and have been able to parse large > files and process data pretty easily, but I believe my code isn't too > efficient. I'm hoping dictionaries will help out, but I'm not sure the > best way to implement

Re: PEP 3107 Function Annotations for review and comment

2007-01-01 Thread Paul Boddie
Tony Lownds wrote: > > It's possible packages like pylint will learn to interpret function > annotations to provide > better static analysis. Right? It's true that for the area to be explored, which I know you've been doing, one first has to introduce an annotation scheme that can then be used by

Re: are there Tomboy and F-Spot equivalents?

2007-01-01 Thread Joel Rosdahl
"Tshepang Lekhonkhobe" <[EMAIL PROTECTED]> writes: > I dislike installing the entire Mono stack simply to take notes and > manage photos, and am totally biased towards Python. At least for > search I got Tracker, instead of Beagle. Are there equvalents > applications for Tomboy and F-Spot which ar

Re: Writing more efficient code

2007-01-01 Thread bearophileHUGS
Jon Harrop: > OCaml's pattern matcher is very sophisticated and very fast. You'll probably > shrink your code by several fold whilst also having it run a few orders of > magnitude faster and having it statically checked, so it will be more > reliable. You seem to forget some months of time to lear

Re: Missing erf()

2007-01-01 Thread Carsten Haese
On Sun, 2006-12-31 at 13:23 -0600, [EMAIL PROTECTED] wrote: > rrenaud> Is there a reason why erf() is not included in the math > rrenaud> package? According to the following URL it looks like it has > rrenaud> been standard C since 1999. > > Python is implemented in the C89 dialect.

Online Books

2007-01-01 Thread rajs
http://languages-books.yourlib.com/index.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Question concerning this list [WebCrawler]

2007-01-01 Thread Diez B. Roggisch
Thomas Ploch schrieb: > John Nagle schrieb: >> Very true. HTML is LALR(0), that is, you can parse it without >> looking ahead. Parsers for LALR(0) languages are easy, and >> work by repeatedly getting the next character and using that to >> drive a single state machine. The first character-l

How do I add users using Python scripts on a Linux machine

2007-01-01 Thread Ramdas
How do I add users using Python scripts on a Linux machine? Someone has a script? -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 3107 Function Annotations for review and comment

2007-01-01 Thread Tony Lownds
On Jan 1, 2007, at 9:48 AM, Kay Schluehr wrote: > Good. There is still one issue. I understand that you don't want to > fix > the semantics of function annotations but to be usefull some > annotations are needed to express function types. Using those > consistently with the notation of the enhan

Re: Writing more efficient code

2007-01-01 Thread Jon Harrop
gonzlobo wrote: > I picked up Python a few weeks ago, and have been able to parse large > files and process data pretty easily, but I believe my code isn't too > efficient. I'm hoping dictionaries will help out, but I'm not sure the > best way to implement them. > > I've been using a bunch of nest

Re: DOS, UNIX and tabs

2007-01-01 Thread Tom Plunket
Lawrence D'Oliveiro wrote: > I think there should be a single environment variable, perhaps > called "TABS", which specifies the tab settings across all relevant tools > that work with text, including less and diff. So for example setting this > as > > export TABS=4 > > will cause these tool

Re: Wow, Python much faster than MatLab

2007-01-01 Thread Wensui Liu
Gerry, I have the similar background as yours, many years using SAS/R. Right now I am trying to pick up python. >From your point, is there anything that can be done with python easily but not with SAS/R? thanks for your insight. wensui On 1/1/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >

Re: Wow, Python much faster than MatLab

2007-01-01 Thread gblais
We're not so far apart. I've used SAS or 25 years, and R/S-PLUS for 10. I think you've said it better than I did, though: R requires more attention (which is often needed). I certainly didn't mean that R crashed - just an indictment of how much I thought I was holding in my head. Gerry -- http

Writing more efficient code

2007-01-01 Thread gonzlobo
Greetings, and happyNewYear to all. I picked up Python a few weeks ago, and have been able to parse large files and process data pretty easily, but I believe my code isn't too efficient. I'm hoping dictionaries will help out, but I'm not sure the best way to implement them. I've been using a bunc

Re: PEP 3107 Function Annotations for review and comment

2007-01-01 Thread Kay Schluehr
Tony Lownds wrote: > On Dec 31, 2006, at 4:26 AM, Kay Schluehr wrote: > > > I have two questions: > > > > 1) I don't understand the clause ('*' [tname] (',' tname ['=' test])* > > in the grammar rule of typedargslist. Does it stem from another PEP? > > > > Yes, PEP 3102 Keyword-only Arguments. > >

BOOST confuses me: a few assumptions: true or false.....

2007-01-01 Thread Osiris
I read a lot of the html pages on installing boost etc. Still a lot of confusion. Here is what I want: I have old, stable wonderful C-code I want to use in Python projects. So I encapsulate the C-code in some C++ stuf and try to compile it into a DLL. 1: I DL-ed boost_1_33_1.exe (I use WinXP) and

BOOST again: how to proceed from here....

2007-01-01 Thread Osiris
I'm trying to work with Boost, trying to use my C-code from Python.. So now I have generated a C_test2.dll and a C_test2.lib with Visual C++ 2005, from code like this: === #include #include namespace { // Avoid cluttering the global namespace. int my_int; /* a global integer: or o

Re: Collecting list of module dependencies

2007-01-01 Thread David Pratt
Hi skip. Many thanks for this. Exactly what I need :-) Regards, David [EMAIL PROTECTED] wrote: > David> Hi. Is anyone aware of any code to create a list of dependent > David> modules for a python module. > > modulefinder: http://docs.python.org/lib/module-modulefinder.html > > Added to

Re: Collecting list of module dependencies

2007-01-01 Thread skip
David> Hi. Is anyone aware of any code to create a list of dependent David> modules for a python module. modulefinder: http://docs.python.org/lib/module-modulefinder.html Added to Python in 2.3. Skip -- http://mail.python.org/mailman/listinfo/python-list

Collecting list of module dependencies

2007-01-01 Thread David Pratt
Hi. Is anyone aware of any code to create a list of dependent modules for a python module. Ideally am looking for something with a method to create a unique list of imported modules that excludes imports from the module being analyzed. Many thanks. Regards, David -- http://mail.python.org/mail

Re: OO question

2007-01-01 Thread robert
[EMAIL PROTECTED] wrote: > If I want to save all addresses to disk, I can have a method, say, > save() of AddressBook. But then what? What is a good object oriented > approach? Should each Address object take care of saving itself to the > file, with a method like writetofile(filename), or should t

Re: Help with small program

2007-01-01 Thread gokkog
"Paul Watson 写道: " > Tim Roberts wrote: > > [EMAIL PROTECTED] wrote: > >> Interesting impl in Python! I am wondering what if the requirement is > >> to find the minimum number of coins which added to the "fin" sum... > > > > Given the set of coins in the original problem (100, 10, 5, 1, 0.5), the >

Re: Forking in windows. Possible?

2007-01-01 Thread robert
[EMAIL PROTECTED] wrote: > I know under mac/*nix it's possible to fork the proccess to the > background and exit the parent process. I have used this on a couple of > my projects, but right now I am working on a project that will be > required to run in the background, I have considered using the .

Re: Why does Python never add itself to the Windows path?

2007-01-01 Thread robert
Ben Sizer wrote: > Martin v. Löwis wrote: > >> 2. Many windows users (including myself) dislike setup routines that >>manipulate PATH. > > My opinion is that this is not as big a problem as some may feel that > it is. Unlike Unix systems, the PATH variable is rarely used. Most It is a big pr

Re: OO question

2007-01-01 Thread Steven D'Aprano
On Sun, 31 Dec 2006 22:00:58 -0800, Paddy wrote: >> def save(self, filename): >> self.currentfile = file(filename, "w") >> for address in self.addresses: >> self.save_one_address(address.export()) >> self.currentfile.close() >> self.currentfile = Non

Re: A question about unicode() function

2007-01-01 Thread JTree
Thanks everyone! Sorry for my ambiguous question. I changed the codes and now it works fine. JTree wrote: > Hi,all > I encountered a problem when using unicode() function to fetch a > webpage, I don't know why this happenned. > My codes and error messages are: > > > Code: > #!/usr/bin

Re: OO question

2007-01-01 Thread John Machin
[EMAIL PROTECTED] wrote: > I want to make an addressbook and I'm new to OO programming, so I > wonder if this sounds reasonable. > > I think of making a class Address which contains all data about one > person, that class can have UserDict as baseclass so I can access data > like object['name'], et

Re: A question about unicode() function

2007-01-01 Thread John Machin
JTree wrote: > Hi, > > I changed my codes to: > > #!/usr/bin/python > #Filename: test.py > #Modified: 2007-01-01 > > import cPickle as p > import urllib > import htmllib > import re > import sys > > funUrlFetch = lambda url:urllib.urlopen(url).read() > > objUrl = raw_input('Enter the Url:') > cont