Re: Decoupling the version of the file from the name of the module.

2006-01-28 Thread bobueland
Xavier Morel wrote: > Just get rid of the version number in the name (what's the point) and >define a __version__ attribute in the module, that's what is usually done. Thanks Xavier, but as I said I'm newbie and I'm not sure how to do that. Here's my module # circle.py from math import pi __ver

Decoupling the version of the file from the name of the module.

2006-01-28 Thread bobueland
I'm a newbie experimenting with Python. I want to incrementally develop a module called 'circle'. The problem is now that the file name is used for two purposes. To keep track of the version number and as the name for the module. So when I develop the first version of my file I have to call it circ

Re: problems with documentation

2006-01-27 Thread bobueland
Thanks, that works :) -- http://mail.python.org/mailman/listinfo/python-list

problems with documentation

2006-01-27 Thread bobueland
I'm using standard widows xp installation of Python 2.4.2. I tried to find some help for print and entered >>> help() and then chose help> print Sorry, topic and keyword documentation is not available because the Python HTML documentation files could not be found. If you have installed them, p

Announcement Study Group "Essentials of Programming Languages"

2006-01-19 Thread bobueland
Since there have been some interest, a reading group has been started at http://groups.yahoo.com/group/csg111 I must warn you that the programming language used in "Essentials of Programming Languages" is Scheme, which is variant of Lisp. Now this course is not a course in Scheme but about powerfu

Can you pass functions as arguments?

2005-12-18 Thread bobueland
I want to calculate f(0) + f(1) + ...+ f(100) over some function f which I can change. So I would like to create a function taking f as argument giving back the sum. How do you do that in Python? -- http://mail.python.org/mailman/listinfo/python-list

Re: what does this mean?

2005-12-13 Thread bobueland
Brian van den Broek has answered this in the topic newbie-one more example of difficulty in van Rossum's tutorial -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie-one more example of difficulty in van Rossum's tutorial

2005-12-13 Thread bobueland
Thanks Brian, now I get it. BTW there is no fuzzuness in your explanaition it is crystal clear. Bob -- http://mail.python.org/mailman/listinfo/python-list

what does this mean?

2005-12-13 Thread bobueland
In van Rossum's tutorial there is a paragraph in chapter 9.6 which says "Notice that code passed to exec, eval() or evalfile() does not consider the classname of the invoking class to be the current class; this is similar to the effect of the global statement, the effect of which is likewise restr

Re: newbie-name mangling?

2005-12-13 Thread bobueland
Good example Brian It shows clearly the special role that two underscores play in a class definition. Thanks Bob -- http://mail.python.org/mailman/listinfo/python-list

newbie-one more example of difficulty in van Rossum's tutorial

2005-12-13 Thread bobueland
This is from 9.6 (Private variables). I quote - "Notice that code passed to exec, eval() or evalfile() does not consider the classname of the invoking class to be the current class; this is similar to the effect of the global statement, the effect of which is likewise restricted to code that is by

Re: newbie-name mangling?

2005-12-13 Thread bobueland
Thanks Diez, Everything becomes very clear from this example Bob -- http://mail.python.org/mailman/listinfo/python-list

newbie-name mangling?

2005-12-13 Thread bobueland
I'm reading van Rossum's tutorial. Mostly it is well written and examples are given. However sometimes I get lost in a text, when it doesn't give any examples and no clues. There are several examples of this in chapter 9 about classes. Here's one from 9.6 (Private Variables). I quote "There is lim

how does exception mechanism work?

2005-12-12 Thread bobueland
Sometimes the best way to understand something is to understand the mechanism behind it. Maybe that is true for exceptions. This is a model I have right now (which probably is wrong) 1. When a runtime error occurs, some function (probably some class method) in Python is called behind the scenes. 2

double underscore attributes?

2005-12-10 Thread bobueland
Entering >>>dir(5) I get ['__abs__', '__add__', '__and__', '__class__', '__cmp__', '__coerce__', '__delattr__', '__div__', '__divmod__', '__doc__', '__float__', '__floordiv__', '__getattribute__', '__getnewargs__', '__hash__', '__hex__', '__init__', '__int__', '__invert__', '__long__', '__lshift__

Re: newbie - needing direction

2005-12-04 Thread bobueland
Thanks for the advice, The reason for the choice of my particular test project is that it is in the direction that I want to go in so choosing some other won't do. I've looked briefly at PyGame but this means I have to learn a lot besides what I want to do. I thought that maybe my project could be

Re: newbie - needing direction

2005-12-04 Thread bobueland
I should maybe mention that I want to this on a win XP computer Bob -- http://mail.python.org/mailman/listinfo/python-list

newbie - needing direction

2005-12-04 Thread bobueland
I'm a newbie, just got through van Rossum's tutorial and I would like to try a small project of my own. Here's the description of my project. When the program starts a light blue semi-transparent area, size 128 by 102, is placed in the middle of the screen. The user can move this area with arrow

Re: Where can I find string.translate source?

2005-11-20 Thread bobueland
Thanks Mike and Fredrik. In my Python installation there is no directory called Objects. I use Windows and I downloaded Python from http://www.python.org/download/ As I looked closer I saw that the link # Python 2.4.2 Windows installer (Windows binary -- does not include source) which cl

Where can I find string.translate source?

2005-11-19 Thread bobueland
The module string has a function called translate. I tried to find the source code for that function. In: C:\Python24\Lib there is one file called string.py I open it and it says """A collection of string operations (most are no longer used). Warning: most of the code you see here isn

Re: Can a function access its own name?

2005-11-19 Thread bobueland
Thanks Diez and Peter, Just what I was looking for. In "Library Reference" heading 3.11.1 Types and members I found the info about the method you described. I also made a little function to print out not just the name of the function but also the parameter list. Here it is # fname.py im

Can a function access its own name?

2005-11-19 Thread bobueland
Look at the code below: # mystringfunctions.py def cap(s): print s print "the name of this function is " + "???" cap ("hello") Running the code above gives the following output >>> hello the name of this function is ??? >>> I would like the output

Re: newbie-question about a list

2005-11-19 Thread bobueland
This type of construct seems to be called "list comprehension". Googling for Python "list comprehension" gives a lot of hints that describe the construct. -- http://mail.python.org/mailman/listinfo/python-list

newbie-question about a list

2005-11-19 Thread bobueland
I've seen this construct in a script >>> [x.capitalize() for x in ['a','b', 'c']] ['A', 'B', 'C'] I tried another myself >>> [x+1 for x in [1,2,3]] [2, 3, 4] >>> Apparently you can do [function(x) for x in list] I tried to find a description of this in "Library Reference" but couldn't find it.

Re: IDLE question

2005-11-17 Thread bobueland
I made bat file called startidle.bat which I put in C:\Python24 directory. This is how it looks @echo off start C:\Python24\pythonw.exe C:\Python24\Lib\idlelib\idle.py -r C:\Python24\sitecustomize.py exit Now I put a shortcut of startidle.bat in Quick Launch. The only thing I have to do now is to

Re: IDLE question

2005-11-17 Thread bobueland
This works! Thanks Claudio For complete happiness I would also like to know what's hapening. Is there anywhere I can read about PyShell.py. Bob -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Library Reference - question

2005-11-17 Thread bobueland
I found the answer to Q1. One can download all Python docs in pdf from http://www.python.org/doc/current/download.html -- http://mail.python.org/mailman/listinfo/python-list

Re: IDLE question

2005-11-17 Thread bobueland
I did as you suggested, however after I make a new File (File/New Window) and save and then run (F5) I get the following alert The Python Shell is already executing a command; please waith until it is finished I also get the error message Traceback (most recent call last): File "", line 1, in

Re: newbie - How do I import automatically?

2005-11-17 Thread bobueland
There is one C:\Python24\Lib\site-packages\sitecustomize.py but no C:\Python24\Lib\sitecustomize.py However I created one as you suggested but then I started IDLE nothing showed up. Have you tested that it works on your computer? Bob -- http://mail.python.org/mailman/listinfo/python-list

Re: IDLE question

2005-11-17 Thread bobueland
Okey I tried what you recommended My C:\Python24\sitecustomize.py looks like this: # sitecustomize.py import os from btools import * When I enter C:\Python24>C:\Python24\pythonw.exe C:\Python24\Lib\idlelib\idle.py -r C:\Python24\sitecustomize.py in commad propmt IDLE starts up and automatically

Re: newbie - How do I import automatically?

2005-11-17 Thread bobueland
I tried to do it on my computer (win XP). I put an extra line in PyShell.py #! /usr/bin/env python import os import os.path import sys import string import getopt import re import socket import time import threading import traceback import types import exceptions # test sys.modules['__main__']._

IDLE question

2005-11-17 Thread bobueland
IDLE doesn't seem to honor PYTHONSTARTUP environment variable nor sitecustomize.py How do you then customize in IDLE? (basically I want to execute the statement from btools import * each time I restart IDLEs Python Shell) -- http://mail.python.org/mailman/listinfo/python-list

Python Library Reference - question

2005-11-17 Thread bobueland
The "Python LIbrary Reference" at http://docs.python.org/lib/contents.html seems to be an important document. I have two questions Q1. How do you search inside "Python LibraryReference" ? Does it exist in pdf or chm form? Q2. In some other languages (for instance PHP if I recall correctly) reader

Re: newbie - How do I import automatically?

2005-11-16 Thread bobueland
Where do I put def runsource(self, source): if(source == ''): source = 'from btools import *' "Extend base class method: Stuff the source in the line cache first" filename = self.stuffsource(source) Do I put it in Pyshell.py or somewhere else? Bob -- http://

Re: newbie - How do I import automatically?

2005-11-16 Thread bobueland
I tried to put the line from btools import * in several places in PyShell.py but to now avail. It does not work, IDLE does not execute it??? Bob -- http://mail.python.org/mailman/listinfo/python-list

newbie - Does IDLE care about sitecustomize.py?

2005-11-16 Thread bobueland
I have the following test script in the file customize.py # C:\Python24\Lib\site-packages\sitecustomize.py print "test text from sitecustomize" If start Python from command prompt I get C:\Python24>python test in sitecustomize Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)]

Re: newbie - How do I import automatically?

2005-11-15 Thread bobueland
I also checked in command prompt, and there it works!, but not in IDLE. And it's in IDLE that I work all the time. Can anything be done to get it to work there? Bob -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie - How do I import automatically?

2005-11-15 Thread bobueland
I've tried as you said but it doesn't work. I'm working with Windows XP. I right click at my computer go to Advanced, choose Environment Variables and set PYTHONSTARTUP variable to C:\Python24\binit.py. It looks like this # binit.py from btools import * I've restarted the computer and started IDL

newbie - How do I import automatically?

2005-11-15 Thread bobueland
When I start Python Shell I can see that some names or loaded automatically, ready for me to use >>> dir() ['__builtins__', '__doc__', '__name__'] I have written some functions in a file called btools.py. I would like to import them automatically when I start up Python shell. Today I must do it b

Re: newbie how do I interpret this?

2005-11-12 Thread bobueland
Thanks for the reply I didn't realise the meaning of ""built-in function". Also I thought that help( ) mirrored the info in reference manual, which it obviously does not. Thanks again for a good answer and the link. Bob -- http://mail.python.org/mailman/listinfo/python-list

newbie how do I interpret this?

2005-11-12 Thread bobueland
Here's a small session >>> import re >>> p=re.compile('[a-z]+') >>> m=p.match('abb1a') >>> dir(m) ['__copy__', '__deepcopy__', 'end', 'expand', 'group', 'groupdict', 'groups', 'span', 'start'] >>> help(m.groups) Help on built-in function groups: groups(...) >>> My question is. How do I interpre