473,387 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Is this just for readability to the developer? python

Hi,

I was looking through some of our source code and I found this:

initModule( "$Revision: 3.1 $".split(" ")[1] )

In this example, it looks like only the '3.1' is actually passed to the
function. Which leads me to speculate that the rest of it is just there to
make it easier for the developer when looking at source code to see what
version of the module is being used.

The only thing I think i notice is its also passing a list of one element?

Is this a typical way to do this in python?

Thanks

David
-------
Tracfone: http://cellphone.duneram.com/index.html
bibor: http://www.duneram.com/cam/index.html
Tax: http://www.duneram.com/index.html

__________________________________________________ _______________
MSN 9 Dial-up Internet Access fights spam and pop-ups – now 3 months FREE!
http://join.msn.click-url.com/go/onm...ave/direct/01/
Jul 18 '05 #1
3 1226

"David Stockwell" <wi*******@hotmail.com> wrote in message
news:ma*************************************@pytho n.org...

In this example, it looks like only the '3.1' is actually passed to the
function. Which leads me to speculate that the rest of it is just there to
make it easier for the developer when looking at source code to see what
version of the module is being used.
It looks like that it may be for the benefit of CVS; manually updated
version numbers are a pain.
The only thing I think i notice is its also passing a list of one element?


One element of a list; that's not quite the same thing.
Jul 18 '05 #2
David Stockwell wrote:
I was looking through some of our source code and I found this:

initModule( "$Revision: 3.1 $".split(" ")[1] )

In this example, it looks like only the '3.1' is actually passed to the
function. Which leads me to speculate that the rest of it is just there
to make it easier for the developer when looking at source code to see
what version of the module is being used.


Revision control systems such as CVS and Subversion know how to
find and update information such as the revision tag when it is
formatted in that manner (leading/trailing $ etc). The programmer
also apparently thought it would be a good idea to use the revision
number programmatically, which explains the surrounding split()
and indexing operations, and the function call.

-Peter
Jul 18 '05 #3
In article <ma*************************************@python.or g>,
"David Stockwell" <wi*******@hotmail.com> wrote:
I was looking through some of our source code and I found this:

initModule( "$Revision: 3.1 $".split(" ")[1] )

In this example, it looks like only the '3.1' is actually passed to the
function. Which leads me to speculate that the rest of it is just there to
make it easier for the developer when looking at source code to see what
version of the module is being used. [ ... ]


To amplify David Brodie's answer:

The string "$Revision: 3.1 $" is probably supplied by
CVS, the Concurrent Versioning System, and that literal in
that line of the program changes every time the Python
module is checked into change control. You're really
looking at a slick way to communicate between CVS and the
module user.

Regards. Mel.
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

38
by: Kevin Smith | last post by:
For what it's worth, I wrote the original PEP 318. I probably wasn't qualified, but I just wanted a nice simple way to declare class methods without having to repeat the function name. After...
25
by: redefined.horizons | last post by:
I've traditionally been a Java developer, although I play around with LISP. I recently migrated to Linux and I was exploring Mono as an option for development on Linux. However, I've had some...
12
by: sam | last post by:
hi all, i'm starting to put together a program to simulate the performance of an investment portfolio in a monte carlo manner doing x thousand iterations and extracting data from the results. ...
9
by: Francois Grieu | last post by:
Consider this macro // check if x, assumed of type unsigned char, is in range #define ISVALID(x) ((x)>=0x20 && (x)<=0x7E) Of course, this can't be safely used as in if (ISVALID(*p++)) foo();...
16
by: DE | last post by:
Hello, Here is what I do in C++ and can not right now in python : pushMatrix() { drawStuff(); pushMatrix(); {
27
by: Licheng Fang | last post by:
Python is supposed to be readable, but after programming in Python for a while I find my Python programs can be more obfuscated than their C/C ++ counterparts sometimes. Part of the reason is that...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.