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

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

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,

Re: problems with documentation

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

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 powerful

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

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

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

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

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

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

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

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.

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__',

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

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

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

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

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

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

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't

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

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

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 by

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

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

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 interpret the hiven help

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