473,804 Members | 3,809 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1245

"David Stockwell" <wi*******@hotm ail.com> wrote in message
news:ma******** *************** **************@ python.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 programmaticall y, which explains the surrounding split()
and indexing operations, and the function call.

-Peter
Jul 18 '05 #3
In article <ma************ *************** **********@pyth on.org>,
"David Stockwell" <wi*******@hotm ail.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
2601
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 submitting it to BDFL for approval, more work was needed and the discussion of PEP 318 on python-dev increased rapidly. It was evident that I was in over my head, so I asked more someone more experienced to take over. I guess others had bigger...
25
2170
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 problems with the maturity and support when working with Mono. So I was considering Python as an alternative development language. Is Python actively developed and supported on Linux? Would it be a viable option for cross-platform application...
12
2079
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. i'm still in the early stages, and am trying to code something simple and interactive to get the percentages of the portfolio in the five different investment categories. i thought i'd get in with the error handling early so if someone types in...
9
321
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(); where p is a pointer ot unsigned char.
16
2532
by: DE | last post by:
Hello, Here is what I do in C++ and can not right now in python : pushMatrix() { drawStuff(); pushMatrix(); {
27
1747
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 with heterogeneous lists/tuples at hand, I tend to stuff many things into the list and *assume* a structure of the list or tuple, instead of declaring them explicitly as one will do with C structs. So, what used to be struct nameval { char *...
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9577
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10569
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10325
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10315
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10075
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.