Re: Weird lambda rebinding/reassignment without me doing it

2008-07-10 Thread A.T.Hofkamp
Python doesn't use value semantics for variables but reference semantics: a = [1] b = a In many languages, you'd now have 2 lists. In Python you still have one list, and both a and b refer to it. Now if you modify the data (the list), both variables will change a.append(2) # in-place modificat

Re: TypeError, I know why but not how!?

2008-07-09 Thread A.T.Hofkamp
On 2008-07-10, ssecorp <[EMAIL PROTECTED]> wrote: > > def validate(placed): > student = round(random.random()*401) > if student in placed: > validate(placed) > else: > placed.append(student) > return student, placed > > def pair(incompatibles, placed): > stud

Re: socket-module: different behaviour on windows / unix when a timeout is set

2008-07-09 Thread A.T.Hofkamp
On 2008-07-09, Mirko Vogt <[EMAIL PROTECTED]> wrote: > Is that behaviour common or even documented? Found nothing. Second sentence in the socket module documentation: Note: Some behavior may be platform dependent, since calls are made to the operating system socket APIs. So yes, what you found i

Re: start reading from certain line

2008-07-09 Thread A.T.Hofkamp
On 2008-07-09, antar2 <[EMAIL PROTECTED]> wrote: > I am a starter in python and would like to write a program that reads > lines starting with a line that contains a certain word. > For example the program starts reading the program when a line is > encountered that contains 'item 1' > > > The weat

Re: Newbie question

2008-07-09 Thread A.T.Hofkamp
On 2008-07-09, |e0 <[EMAIL PROTECTED]> wrote: > So, i can't use wmi module on linux? > > On Wed, Jul 9, 2008 at 9:14 AM, Lamonte Harris <[EMAIL PROTECTED]> wrote: >> I think the win32 module is only for windows. >> Welcome to the world outside MS. Many python modules don't actually do anything th

Re: I am looking for svn library(module)

2008-07-07 Thread A.T.Hofkamp
On 2008-07-07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > > I am looking fo svn library(module) which is used in the svn- > mailer(http://opensource.perlig.de/svnmailer/) project. Does anybody > know where can I find it(download url)? This is information which I > received from python err

Re: yo...

2008-07-07 Thread A.T.Hofkamp
On 2008-07-07, abhishek <[EMAIL PROTECTED]> wrote: > hey guys...me nu 2 python yo...help me...by da way...jus joined > inthanks Ask a specific question and you may get an answer. If you want an answer from me, it helps *a lot* if you write full english sentences (starting with a capital lette

Re: python beginner

2008-07-07 Thread A.T.Hofkamp
On 2008-07-07, cna <[EMAIL PROTECTED]> wrote: > Hi all and one, > how may i learn python. is there any other website except python.org Yes, there are several millions web-sites, all across the world. They cover every possible topic you may and may not imagine. If you mean a website that tries to

Re: Problem with a for loop and a list

2008-07-02 Thread A.T.Hofkamp
On 2008-07-02, Alexnb <[EMAIL PROTECTED]> wrote: > I have no idea what "list assignment index out of range means?!?! You are assigning a value to a non-existing list element, as in >>> x = [1] >>> x[2] = 4 Traceback (most recent call last): File "", line 1, in ? IndexError: list assignment in

Re: n00bie wants advice.

2008-07-02 Thread A.T.Hofkamp
On 2008-07-02, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > This simple script writes html color codes that can be viewed in a > browser. I used short form hex codes (fff or 000, etc) and my list > has only six hex numbers otherwise the results get rather large. I > invite criticism as to whethe

Re: Required items in a form

2008-07-02 Thread A.T.Hofkamp
On 2008-07-01, Brandon <[EMAIL PROTECTED]> wrote: > What I'm trying to do is essentially force a user to fill in required items > in a form, which will be saved to a database. How can I get it so that once > the user clicks "OK" on the dialog box, it transfers control back to the > form, and no

Re: How make regex that means "contains regex#1 but NOT regex#2" ??

2008-07-01 Thread A.T.Hofkamp
On 2008-07-01, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I'm looking over the docs for the re module and can't find how to > "NOT" an entire regex. (?! R) > How make regex that means "contains regex#1 but NOT regex#2" ? (\1|(?!\2)) should do what you want. Albert -- http://mail.python.org

Re: shorten path to files

2008-06-27 Thread A.T.Hofkamp
On 2008-06-27, cesco <[EMAIL PROTECTED]> wrote: > Hi, > > I need to retrieve the content of some files which are placed on a > network drive so in order to open them I need the full path to the > file. > Unfortunately some times the path is longer than 256 characters and in > Windows such a path is

Re: python -regular expression - list element

2008-06-25 Thread A.T.Hofkamp
On 2008-06-25, antar2 <[EMAIL PROTECTED]> wrote: > I am a beginner in Python and am not able to use a list element for > regular expression, substitutions. > > list1 = [ 'a', 'o' ] > list2 = ['star', 'day', 'work', 'hello'] > > Suppose that I want to substitute the vowels from list2 that are in >

Re: insertion sorts...

2008-06-25 Thread A.T.Hofkamp
On 2008-06-25, python_newbie <[EMAIL PROTECTED]> wrote: > On 24 Haziran, 04:33, Terry Reedy <[EMAIL PROTECTED]> wrote: > Thanks for all answers. At the end i ve only one point. If a decide to > copy list to iterate when will i have to do this ? Before the > iteration ? And then iterate through one

Re: Problem found in tutorial

2008-06-25 Thread A.T.Hofkamp
On 2008-06-25, John W. Hamill <[EMAIL PROTECTED]> wrote: > 20JUN2008 > By John W. Hamill > > > Errata found in Python tutorial > http://www.python.org Bugs and other problems should be reported in bugs.python.org Otherwise they will probably get lost. > Error Found by John W. Hamill > - -

Re: Difference between two dates

2008-06-24 Thread A.T.Hofkamp
On 2008-06-24, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi! > > I am new in Python, so I count for your help. I need to get difference > in months between two dates. How to do it in python? I am substracting > two dates, for example date1 - date2 and I got result in days, how to > change it?

Re: very large graph

2008-06-24 Thread A.T.Hofkamp
On 2008-06-24, MRAB <[EMAIL PROTECTED]> wrote: > On Jun 24, 1:26 am, [EMAIL PROTECTED] wrote: >> I need to represent the hyperlinks between a large number of HTML >> files as a graph.  My non-directed graph will have about 63,000 nodes >> and and probably close to 500,000 edges. >> >> I have looked

Re: dict order

2008-06-18 Thread A.T.Hofkamp
On 2008-06-18, Robert Bossy <[EMAIL PROTECTED]> wrote: > Lie wrote: >>> Whoops, I think I misunderstood the question. If what you're asking >>> whether two dictionary is equal (equality comparison, rather than >>> sorting comparison). You could do something like this: >>> > Testing for equalit

Re: Getting Python exit code when calling Python script from Java program

2008-06-18 Thread A.T.Hofkamp
On 2008-06-18, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I have a Python script which is used to load data into a database. Up to > now this script has been run by customers from the Windows command > prompt using "python edg_loader.pyc". Any error messages generated are > written to a log fil

Re: dict order

2008-06-18 Thread A.T.Hofkamp
On 2008-06-18, Robert Bossy <[EMAIL PROTECTED]> wrote: > Hi, > > I wish to know how two dict objects are compared. By browsing the > archives I gathered that the number of items are first compared, but if > the two dict objects have the same number of items, then the comparison > algorithm was n

Re: Numeric type conversions

2008-06-17 Thread A.T.Hofkamp
On 2008-06-17, John Dann <[EMAIL PROTECTED]> wrote: > I'm reading in a byte stream from a serial port (which I've got > working OK with pyserial) and which contains numeric data in a packed > binary format. Much of the data content occurs as integers encoded as > 2 consecutive bytes, ie a 2-byte in

Re: Showing a point in Gnuploy.py

2008-06-17 Thread A.T.Hofkamp
On 2008-06-16, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello. Could some1 tell me how i could "display" a specific point in > gnuplot.py. Supposingly if i have a point of intersection (2,3). How > can i show this on the graph? As in how can i write near the point of > intersection the value

Re: Dumb idea?

2008-06-11 Thread A.T.Hofkamp
On 2008-06-10, Peter Hunt <[EMAIL PROTECTED]> wrote: > Hi everyone - > > I like playing around with language syntax and semantics. I'm thinking > about pulling down the PyPy code and messing around to see what I can > accomplish. My first idea is most succinctly described by example: > > class IBlo

Re: configure fails

2008-06-06 Thread A.T.Hofkamp
On 2008-06-05, Mathieu Prevot <[EMAIL PROTECTED]> wrote: > I have the following error on a OSX.5 OS with CC=icc and using the > python-svn files: > > checking size of wchar_t... configure: error: cannot compute sizeof (wchar_t) > > I would like to help so we can compile python with icc/OSX. This l

Re: Problem with PEXPECT in Python

2008-06-05 Thread A.T.Hofkamp
On 2008-06-04, Mallikarjun Melagiri <[EMAIL PROTECTED]> wrote: > Hi Noah, > > I am new to python. I'm trying to use pexpect. > > Following is my problem definition: > > I should have a script on my machine A, which > should 'ssh' to machine B and from there i

Re: How to get all the variables in a python shell

2008-05-29 Thread A.T.Hofkamp
On 2008-05-29, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi! > > I'm currently working on a scientific computation software built in > python. > What I want to implement is a Matlab style command window <-> > workspace interaction. ok, although I personally favor the style of writing and runn

Re: Loading contents behind the scenes

2008-05-22 Thread A.T.Hofkamp
On 2008-05-22, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, I wanted to know how cautious it is to do something like: > > f = file("filename", "rb") > f.read() > > for a possibly huge file. When calling f.read(), and not doing > anything with the return value, what is Python doing internally?

Re: Code For Five Threads To Process Multiple Files?

2008-05-21 Thread A.T.Hofkamp
On 2008-05-21, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I'd appreciate any help. I've got a list of files in a directory, and > I'd like to iterate through that list and process each one. Rather > than do that serially, I was thinking I should start five threads and > process five files at

Re: how to proccess the blank in the path on linux

2008-05-21 Thread A.T.Hofkamp
On 2008-05-21, zhf <[EMAIL PROTECTED]> wrote: > I want ro walk a directory and its sub directory on linux, > to find some shell script file, and run them, but I found some path belong > blank charactor, such as '8000 dir', if I write as follow, I got error > "no such file" > path = '8000 dir' > for

Re: Organizing a Python project

2008-05-19 Thread A.T.Hofkamp
On 2008-05-19, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello all, > > I'm starting work on what is going to become a fairly substantial > Python project, and I'm trying to find the best way to organize > everything. The project will consist of: > > - A few applications > - Several small scri

Re: default object comparison considered harmful?

2008-05-19 Thread A.T.Hofkamp
On 2008-05-16, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On 16 Mai, 10:03, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: >> Hello all, >> >> Yesterday we found the cause of a bug that has caused problems for a long >> time. >> It appeared

Re: managing properties/configurations

2008-05-16 Thread A.T.Hofkamp
On 2008-05-16, Venkatraman.S. <[EMAIL PROTECTED]> wrote: > The problem being, if i change the config file, then the configobj has > to reload this file again. I do not want to 'refresh' the config obj > per transaction but only when the config params change. If you have trustable time stamps at yo

default object comparison considered harmful?

2008-05-16 Thread A.T.Hofkamp
Hello all, Yesterday we found the cause of a bug that has caused problems for a long time. It appeared to be the following: class A(object): pass print min(1.0, A()) which is accepted by Python even though the A() object is not numerical in nature. The cause of this behavior seems to be th

Re: managing properties/configurations

2008-05-16 Thread A.T.Hofkamp
On 2008-05-16, Venkatraman.S. <[EMAIL PROTECTED]> wrote: > Or a better example would be: Indeed, this is concrete enough to make some suggestions. > I have the params in a config file and import this module: > myconfig.py > a=10 > b=30 > c=31 > d=40 The big problem imho with coding such stuff di

Re: List behaviour

2008-05-15 Thread A.T.Hofkamp
On 2008-05-15, Gabriel <[EMAIL PROTECTED]> wrote: > Hi all > > Just wondering if someone could clarify this behaviour for me, please? > tasks = [[]]*6 tasks > [[], [], [], [], [], []] tasks[0].append(1) tasks > [[1], [1], [1], [1], [1], [1]] > > Well what I was expecting to end

Re: Newbie to python --- why should i learn !

2008-05-08 Thread A.T.Hofkamp
On 2008-05-08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > > i was reading/learning some hello world program in python. > I think its very simillar to Java/C++/C#. What's different (except > syntax) ? Yes, and all programs that people write typically look like the hello world program. Loo

Re: open filename with spaces in path

2008-05-07 Thread A.T.Hofkamp
On 2008-05-07, Chris <[EMAIL PROTECTED]> wrote: os.chdir('C:\temp\my test') > Traceback (most recent call last): > File "", line 1, in > WindowsError: [Error 123] The filename, directory name, or volume > label syntax is incorrect: 'C:\temp\\my test' Python strings have \ escapes, such as

Re: Am I missing something with Python not having interfaces?

2008-05-06 Thread A.T.Hofkamp
On 2008-05-06, jmDesktop <[EMAIL PROTECTED]> wrote: > > I would imagine this is why I haven't found any schools teaching > Python in their basic programming classes too. On the dynamic typing, I don't understand your reasoning. What part does 'this' refer to? Also, you are wrong. We teach 2nd yea

Re: Am I missing something with Python not having interfaces?

2008-05-06 Thread A.T.Hofkamp
On 2008-05-06, jmDesktop <[EMAIL PROTECTED]> wrote: > Studying OOP and noticed that Python does not have Interfaces. Is > that correct? Is my schooling for nought on these OOP concepts if I Depends on your definition of 'Python does not have Interfaces'. They are not in the official language, bu

Re: Comparing strings - akin to Perl's "=~"

2008-05-06 Thread A.T.Hofkamp
On 2008-05-06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello gurus, Hello fellow-guru, > I am grabbing the output from a SQL statement (using PyGreSQL 'pg' > module), and when it returns the result, I am pulling it out as such: > > try: > sc=pg.connect(dbname='mydb',host='dbhost',user=

Re: Unix Device File Emulation

2008-04-24 Thread A.T.Hofkamp
On 2008-04-23, blaine <[EMAIL PROTECTED]> wrote: > On Apr 23, 2:01 pm, "Martin Blume" <[EMAIL PROTECTED]> wrote: >> "blaine" schrieb >> No, >> while 1: >> r = self.fifodev.readline() >> if r: print r >> else: time.sleep(0.1) >> is ok (note the "if r:" clause). >> >> Martin > >

Re: [Python 2.4/2.5] subprocess module is sorely deficient?

2008-04-22 Thread A.T.Hofkamp
On 2008-04-22, Harishankar <[EMAIL PROTECTED]> wrote: > Hi, > > Sorry to start off on a negative note in the list, but I feel that the Python > subprocess module is sorely deficient because it lacks a mechanism to: > > 1. Create non-blocking pipes which can be read in a separate thread (I am I d

Re: Fwd: is file open in system ? - other than lsof

2008-04-18 Thread A.T.Hofkamp
On 2008-04-17, bvidinli <[EMAIL PROTECTED]> wrote: > is there another way, any python command sequence that i can check if > a file is open at the time of "before i process file" > > i am not interested in " the file may be written after i access it.." > the important point is " the time at i first

Re: is file open in system ? - other than lsof

2008-04-16 Thread A.T.Hofkamp
On 2008-04-16, bvidinli <[EMAIL PROTECTED]> wrote: > is there a way to find out if file open in system ? - > please write if you know a way other than lsof. because lsof if slow for me. > i need a faster way. > i deal with thousands of files... so, i need a faster / python way for this. > thanks.

Re: Cannot understand the detailedly the following code

2008-04-09 Thread A.T.Hofkamp
On 2008-04-09, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Apr 8, 5:45 pm, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: > Ok following these instructions one gets > > def find_all_paths(graph, start, end, path=[]): > path= path+ [start] > > for

Re: Cannot understand the detailedly the following code

2008-04-08 Thread A.T.Hofkamp
On 2008-04-08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: [deleted a long piece of text by our BDFL about recursive graph path-finding algorithm] > after first writing the inductive part ... for node in > graph[start] > and then by trial and error put square brackets around path in the >

Re: dictionary of operators

2008-02-15 Thread A.T.Hofkamp
On 2008-02-14, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > > In the standard library module "operator", it would be nice to have a > dictionary > mapping operators strings with their respective functions. Something like: > > { > '+': add, > '-': sub, > 'in': contains, >

Re: CVS access with Python

2008-02-08 Thread A.T.Hofkamp
On 2008-02-07, Steve Holden <[EMAIL PROTECTED]> wrote: > Ravi Kumar wrote: >> I have to design a Web-based CVS client. I could not find any module, >> cvs-binding in python. There isn't any afaik. CVS was never designed with scripting in mind. You'll have to issue the command, then parse the text

Re: Python noob SOS (any [former?] Perlheads out there?)

2008-01-31 Thread A.T.Hofkamp
On 2008-01-30, grflanagan <[EMAIL PROTECTED]> wrote: > On Jan 29, 5:39 pm, kj <[EMAIL PROTECTED]> wrote: > For command line options I get a long way with this: > > [code python] > def _getargs(): > allargs = sys.argv[1:] > args = [] > kwargs = {} > key = None > while allargs: >

Re: Test driven development

2008-01-24 Thread A.T.Hofkamp
On 2008-01-24, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I like the concept of TDD but find it difficult to put into practice > most of the time. I think this primarily because I tend to like top- > down development and functional/object decomposition and TDD feels > more like a bottom-up appr

Re: Is there a HTML parser who can reconstruct the original html EXACTLY?

2008-01-23 Thread A.T.Hofkamp
On 2008-01-23, kliu <[EMAIL PROTECTED]> wrote: > On Jan 23, 7:39 pm, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: >> On 2008-01-23, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> >> > Hi, I am looking for a HTML parser who can parse a given

Re: Is there a HTML parser who can reconstruct the original html EXACTLY?

2008-01-23 Thread A.T.Hofkamp
On 2008-01-23, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, I am looking for a HTML parser who can parse a given page into > a DOM tree, and can reconstruct the exact original html sources. Why not keep a copy of the original data instead? That would be VERY MUCH SIMPLER than trying to

Re: How to create graphs an embed them in GUI?

2008-01-17 Thread A.T.Hofkamp
On 2008-01-17, Heiko Niedermeyer <[EMAIL PROTECTED]> wrote: > As I'm learning Python from scratch, I don't care wether to use (=learn) > TKinter or PyQt or whatever, I just need some advice, which suits my > needs best. > It would be nice to have the programm working under win and linux > (shoul

Re: __init__ explanation please

2008-01-14 Thread A.T.Hofkamp
On 2008-01-13, Erik Lind <[EMAIL PROTECTED]> wrote: > I'm new to Python, and OOP. I've read most of Mark Lutz's book and more > online and can write simple modules, but I still don't get when __init__ > needs to be used as opposed to creating a class instance by assignment. For > some strange re

Re: where do my python files go in linux?

2008-01-13 Thread A.T.Hofkamp
On 2008-01-12, Jorgen Bodde <[EMAIL PROTECTED]> wrote: > Question 1. Where do I put the bulk of python scripts in a normal > linux environment? > Question 2. Should I use *.pyc rather then *.py files to speed up > executing as the user cannot write to /usr/bin or any other dir in the > system and e

Re: reading a specific column from file

2008-01-11 Thread A.T.Hofkamp
On 2008-01-11, cesco <[EMAIL PROTECTED]> wrote: > Hi, > > I have a file containing four columns of data separated by tabs (\t) > and I'd like to read a specific column from it (say the third). Is > there any simple way to do this in Python? > > I've found quite interesting the linecache module but

Re: Help needed

2008-01-10 Thread A.T.Hofkamp
On 2008-01-11, tijo <[EMAIL PROTECTED]> wrote: > Hi mate > i created the socket and the connection with tcp and udp i dont know > how to check the bytes send and time > could you help me with this Have a look at the time or timeit modules. Albert -- http://mail.python.org/mailman/listinfo/python

Re: Python too slow?

2008-01-10 Thread A.T.Hofkamp
On 2008-01-09, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I'm pretty new to Python, and even newer to Image/Video processing, > and trying to get started on a project similar to GRL Vienna's laser > marker. I found some sample code here > http://janto.blogspot.com/2006/01/motion-capture-in-pyt

Re: __iadd__ useless in sub-classed int

2007-12-10 Thread A.T.Hofkamp
On 2007-12-06, samwyse <[EMAIL PROTECTED]> wrote: > On Dec 6, 1:12 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > And that's my complaint. The value in is being replaced by > something almost, but not quite, identical to the original value. > Python's internal implementation of __iadd__ for

Re: My very first python web app (no framework)

2007-12-10 Thread A.T.Hofkamp
On 2007-12-10, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On 9 Dic, 15:43, [EMAIL PROTECTED] wrote: >> Is it the right way to go? Is it safe in a web production >> environment ? Is it thread-friendly (since flup is threaded) ? >> >> tnx > > Any hint ? If you as author are asking, my bet is on

Re: Why Python 3?

2007-12-05 Thread A.T.Hofkamp
On 2007-12-05, Chris Gonnerman <[EMAIL PROTECTED]> wrote: > I spent some time today reading about Python 3, and specifically the > differences between Python 3 and Python 2, and I was left with a > question... why? Why bother to change to Python 3, when the CPython > implementation is slower, a

Re: How to suggest a new Python list? Was: Science list

2007-11-29 Thread A.T.Hofkamp
On 2007-11-29, J. Robertson <[EMAIL PROTECTED]> wrote: > Francesco Pietra wrote: >> I was trying to suggest a more specific mail-list in order not to be >> floaded. I >> am the opinion that python-list@python.org is very informative and useful, >> though it is hard to find the time for so many ma

Re: Code Management

2007-11-25 Thread A.T.Hofkamp
On 2007-11-24, BlueBird <[EMAIL PROTECTED]> wrote: > On Nov 21, 7:05 am, "Sergio Correia" <[EMAIL PROTECTED]> wrote: > And then you do your development in python-dev. But how do you manage > multiple development branches of the same program ? If you are using SVN, you may want to check out 'combi

Re: the annoying, verbose self

2007-11-22 Thread A.T.Hofkamp
On 2007-11-22, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Wed, 21 Nov 2007 15:51:56 -0800, braver wrote: > >> Is there any trick to get rid of having to type the annoying, >> character-eating "self." prefix everywhere in a class? You got this highly flexible language, very good for rapid prog

Re: Web update library in python?

2007-11-21 Thread A.T.Hofkamp
On 2007-11-20, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > Jorgen Bodde wrote: > >> Hi, A.T.Hofkamp (sorry for not knowing your first name ;-), Well Jorgen, it is at the bottom of each post (usually)... ;-) >> SCM sounds like a term I can google for, if the tool n

Re: marked-up Python code

2007-11-20 Thread A.T.Hofkamp
On 2007-11-20, Luc Goossens <[EMAIL PROTECTED]> wrote: > Hi Tim, > > thanks for your suggestions > > I have two questions. > 1. can I color the background of the text keeping the normal syntax > coloring for actual text? can you give some hints on how to do that > in vim? :help syntax > 2. wi

Re: Web update library in python?

2007-11-20 Thread A.T.Hofkamp
On 2007-11-20, Jorgen Bodde <[EMAIL PROTECTED]> wrote: > The 'repositories' can be created by anyone who likes to share their > code templates, and let the end user configure this template and > create a customized code base of it, on which they can code their > entire app. My tool supports increme

Re: Web update library in python?

2007-11-20 Thread A.T.Hofkamp
On 2007-11-20, Jorgen Bodde <[EMAIL PROTECTED]> wrote: > Hi all, > > I want to provide my users the ability to download a repository from > the web, and after that check for updates. I thought of a mechanism > that could do that, but since there is patch and diff readily > available I wondered if t

Re: Python Design Patterns - composition vs. inheritance

2007-11-16 Thread A.T.Hofkamp
On 2007-11-15, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > inheritance when an object's relationship to another object is 'is-a' > and composition when the relationship is 'has-a'. > > Since this is all new and I'm still learning, I was hoping someone can > give me some pointers on best practice

Re: help

2007-11-06 Thread A.T.Hofkamp
On 2007-11-05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > please open this link this is will help you > > http://www.55a.net > This one might help as well: http://www.python.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Readline and record separator

2007-10-30 Thread A.T.Hofkamp
On 2007-10-30, Johny <[EMAIL PROTECTED]> wrote: > Is it possible to change record separator when using readline? > As far as I know readline reads characters until found '\n' and it is > the end of record for readline. > My problem is that my record consits several '\n' and when I use > readline it

Re: local variable referenced before assignment

2007-10-25 Thread A.T.Hofkamp
On 2007-10-25, Tim Williams <[EMAIL PROTECTED]> wrote: > On 25/10/2007, A.T.Hofkamp <[EMAIL PROTECTED]> wrote: >> On 2007-10-25, Pete Bartonly <[EMAIL PROTECTED]> wrote: >> > >> Also, brackets around conditions (in the if) are not needed, and comparing &g

Re: local variable referenced before assignment

2007-10-25 Thread A.T.Hofkamp
On 2007-10-25, Pete Bartonly <[EMAIL PROTECTED]> wrote: > > Quick question, probably quite a simple matter. Take the follow start of > a method: > > > def review(filesNeedingReview): > > for item in filesNeedingReview: > (tightestOwner, logMsg) = item > > if (logMsg != None)

Re: Better writing in python

2007-10-24 Thread A.T.Hofkamp
> On 2007-10-24, Alexandre Badez <[EMAIL PROTECTED]> wrote: > I'm just wondering, if I could write a in a "better" way this > code > > lMandatory = [] > lOptional = [] > for arg in cls.dArguments: > if arg is True: > lMandatory.append(arg) > else: > lOptional.append(arg) > return (lMand

Re: Set operations on object attributes question

2007-10-23 Thread A.T.Hofkamp
On 2007-10-23, TheSeeker <[EMAIL PROTECTED]> wrote: > Hi, > > I have run into something I would like to do, but am not sure how to > code it up. I would like to perform 'set-like' operations (union, > intersection, etc) on a set of objects, but have the set operations > based on an attribute of the

Re: Noob questions about Python

2007-10-19 Thread A.T.Hofkamp
On 2007-10-19, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Oct 19, 1:44 am, MRAB <[EMAIL PROTECTED]> wrote: >> On Oct 18, 7:05 am, Michele Simionato <[EMAIL PROTECTED]> >> >> if number == 0: >> return "0" >> > > Hey, > > Isn't > if not number: > return "0" > > faster? Depends o

Re: Really basic problem

2007-10-08 Thread A.T.Hofkamp
On 2007-10-08, Andreas Tawn <[EMAIL PROTECTED]> wrote: >> i know this example is stupid and useless, but that's not the answer >> to my question. >> here it goes: >> > You've just discovered the joys of floating point number comparisons. > > Consider this snippet: > > status = 0.0 > print (repr(st

Re: Asynchronous Messaging

2007-09-26 Thread A.T.Hofkamp
On 2007-09-26, wink <[EMAIL PROTECTED]> wrote: > Hello, > > I'm getting my feet wet in Python and thought I'd try to see how well > Python works for asynchronous messaging. I've been using asynchronous Have a look at Twisted (www.twistedmatrix.com) Albert -- http://mail.python.org/mailman/list

Re: sorteddict PEP proposal [started off as orderedict]

2007-09-25 Thread A.T.Hofkamp
On 2007-09-25, Mark Summerfield <[EMAIL PROTECTED]> wrote: > If there is positive feedback I will submit the PEP to the reviewers, > so if you think it is a good idea please say so. (I'm sure that if you > _don't_ like it you'll tell me anyway:-) I like the idea, ie +1. > This PEP proposes th

Re: An Editor that Skips to the End of a Def

2007-09-25 Thread A.T.Hofkamp
On 2007-09-25, Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > In message <[EMAIL PROTECTED]>, Neil Cerutti wrote: > That's like saying, about a program that, when given "2 + 2", outputs "5", > that _of course_ it knows the correct answer is "4", it just chooses > to "modify" the answer before ou

Re: cannot create my own dict

2007-09-19 Thread A.T.Hofkamp
On 2007-09-19, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > A.T.Hofkamp a écrit : >> So if copying all methods of a native dictionary is not enough, what should I >> do to make my class work as a dictionary WITHOUT deriving from dict (which >> will >> obviou

Re: How can I know how much to read from a subprocess

2007-09-19 Thread A.T.Hofkamp
On 2007-09-18, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Sep 18, 1:48 pm, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: >> On 2007-09-17, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> >> > It seems that another solution is gobject.io_add_wa

cannot create my own dict

2007-09-19 Thread A.T.Hofkamp
Hello all, This morning I tried to create my own read-only dictionary, and failed miserably. I don't understand why, can somebody enlighten me? Below is a brute-force experiment that cannot deal with "x in obj", plz read the explanation below the code: class myown

Re: How can I know how much to read from a subprocess

2007-09-18 Thread A.T.Hofkamp
On 2007-09-17, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > It seems that another solution is gobject.io_add_watch, but I don't > see how it tells me how much I can read from the file - if I don't > know that, I won't know the argument to give to the read() method in > order to get all the data:

Re: Parallel/Multiprocessing script design question

2007-09-13 Thread A.T.Hofkamp
On 2007-09-13, Amit N <[EMAIL PROTECTED]> wrote: > Hi guys, > > I tend to ramble, and I am afraid none of you busy experts will bother > reading my long post, so I will try to summarize it first: I haven't read the details, but you seem to aim for a single python program that does 'it'. A single

Re: Python Problem

2007-09-12 Thread A.T.Hofkamp
On 2007-09-11, Wiseman <[EMAIL PROTECTED]> wrote: > > Hi, > > OK - it works in WindowsXP. > I installed "enchant" on my SuSE 10.0 (using YAST). > The enchant Suse package looks like a general Linux package, not a > Python specific. You'd seem to be right judging by this web-page: http://www.nove

Re: Using a time duration to print out data where every 2 seconds is a pixel

2007-09-10 Thread A.T.Hofkamp
On 2007-09-10, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I want to be able print out the Steps as a visual representation so > that I can show > 1. The order the steps started > 2. The duration of the steps > > i.e. a print out such as: > > > [a] >[ b ] > [

Re: Python wrapper, problem with subprocess read/write

2007-09-10 Thread A.T.Hofkamp
On 2007-09-07, NeoGregorian <[EMAIL PROTECTED]> wrote: > I tried instead to use: > > lines = [] > line = proc.stdout.readline() > while line : > lines.append(line) > line = proc.stdout.readline() > > This prints out everything except the ">" line, which is good. But > then freezes while wai

Re: Parse or Pass?

2007-09-05 Thread A.T.Hofkamp
On 2007-09-05, Martin P. Hellwig <[EMAIL PROTECTED]> wrote: > Martin v. Löwis wrote: > Eingeben = Input: (A bit of) data from outside the function > Ausgeben = Output: (A bit of) data to display, network > connection or file > Zurückgeben = Return: (altered)(bits of) data (from Input) > to Out

Re: Calling a matlab script from python

2007-09-05 Thread A.T.Hofkamp
On 2007-09-05, n o s p a m p l e a s e <[EMAIL PROTECTED]> wrote: > Suppose I have a matlab script mymatlab.m. How can I call this script > from a python script? use the mlabwrap module Albert -- http://mail.python.org/mailman/listinfo/python-list

Printing lists in columns (was: TypeError: 'module object is not callable')

2007-09-04 Thread A.T.Hofkamp
On 2007-09-04, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Thanks guys. Changing to how Python does things has a lot of geting > used to! That's part of the fun :-) > Do any of you have any ideas on the best way to do the following > problem: > > Each loop I perform, I get a new list of String

Re: How to parse this line of code manually

2007-08-28 Thread A.T.Hofkamp
On 2007-08-28, Davy <[EMAIL PROTECTED]> wrote: > On Aug 28, 11:00 am, Davy <[EMAIL PROTECTED]> wrote: >> Hi all, >> >> It is well known that Python is appreciated for its merit of concise. >> However, I found the over concise code is too hard to understand for >> me. >> >> Consider, for instance, >

Re: Regular expression use

2007-08-24 Thread A.T.Hofkamp
On 2007-08-24, Nick Maclaren <[EMAIL PROTECTED]> wrote: > people actually use regular expressions for. Not the subject > domain, but the construction of the regular expressions. This is easy. I use RE for checking whether some input matches a certain pattern, and optionally, to extract some speci

Re: desperately in need of a tool

2007-08-20 Thread A.T.Hofkamp
On 2007-08-19, yagyala <[EMAIL PROTECTED]> wrote: > Hi. > > one of those standards is that the comments for each routine must > indicate every other routine that it calls. As I try to keep my > to do this by hand. Does anyone know of a tool that could do this for > me, or at least a tool that can

Re: Who told str() to round my int()'s!!!

2007-08-15 Thread A.T.Hofkamp
On 2007-08-15, Larry Bates <[EMAIL PROTECTED]> wrote: > > What are they teaching in schools these days? I see questions like this and > the > equally perplexing "why don't floats represent numbers exactly?" or the mildy > amusing "how do I write bytes not characters to a file" questions at least

Re: Using python for dynamic behavior from C++

2007-08-15 Thread A.T.Hofkamp
On 2007-08-15, Jorgen Bodde <[EMAIL PROTECTED]> wrote: > Hi all, > > I am looking into using Python to introduce dynamic behavior in my > C++, e.g. something like a simulation where objects can interact with > eachother. I know Python can be called from C++, but is it possible to > call a binary co

Re: Retry: Question about FutureWarning

2007-08-15 Thread A.T.Hofkamp
On 2007-08-15, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Aug 14, 8:49 pm, Erik Max Francis <[EMAIL PROTECTED]> wrote: > > So if by '0x' you meant -1, then change this line to use -1. > Otherwise, if you really meant 4294967295L, leave it at 0x and > move on. A third option is to

Re: Who told str() to round my int()'s!!!

2007-08-15 Thread A.T.Hofkamp
On 2007-08-11, Adam W. <[EMAIL PROTECTED]> wrote: > After a fair amount of troubleshooting of why my lists were coming > back a handful of digits short, and the last digit rounded off, I > determined the str() function was to blame: > foonum > 0.0071299720384678782 str(foonum) > '0.007129

Re: How to close a program I execute with subprocess.Popen?

2007-06-29 Thread A.T.Hofkamp
On 2007-06-29, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I want to end the execution of the command when the user closes my > application. > > Right now I'm using an object my_child of type subprocess.Popen to > execute the command, inside a thread with an infinite loop where we > constantly a

  1   2   >