As Python changes and old code still needs to work properly, I wonder if
there is a standard way to note which version of the Python interpreter
code is intended to work with. I know that an executable may begin with
#!/usr/bin/python2.3 or something similar, but what about libraries and
such? Would it be a good idea for the software I write to check for the
version of the interpreter?
Randall Smith 12 1276
Randall Smith wrote: As Python changes and old code still needs to work properly, I wonder if there is a standard way to note which version of the Python interpreter code is intended to work with. I know that an executable may begin with #!/usr/bin/python2.3 or something similar, but what about libraries and such? Would it be a good idea for the software I write to check for the version of the interpreter?
Python is exceptionally backwards compatible, so generally
code from an older version will run unchanged on newer
Pythons.
There is a simple way of encoding a version of the interpreter,
but the real question is why would you want to do that. If
you really think it's necessary, just import sys and check the
value of sys.version_info. Lots of code which wants to require
a *minimum* version of Python (a far more common use case than
checking for a *maximum*) contains code like this:
import sys
if sys.hex_version[:3] < (2, 3, 3):
sys.exit('Requires Python 2.3.3 or later to run!')
-Peter
Randall Smith wrote: As Python changes and old code still needs to work properly, I wonder if there is a standard way to note which version of the Python interpreter code is intended to work with. I know that an executable may begin with #!/usr/bin/python2.3 or something similar, but what about libraries and such? Would it be a good idea for the software I write to check for the version of the interpreter?
Python is exceptionally backwards compatible, so generally
code from an older version will run unchanged on newer
Pythons.
There is a simple way of encoding a version of the interpreter,
but the real question is why would you want to do that. If
you really think it's necessary, just import sys and check the
value of sys.version_info. Lots of code which wants to require
a *minimum* version of Python (a far more common use case than
checking for a *maximum*) contains code like this:
import sys
if sys.hex_version[:3] < (2, 3, 3):
sys.exit('Requires Python 2.3.3 or later to run!')
-Peter
Peter Hansen wrote: Randall Smith wrote:
As Python changes and old code still needs to work properly, I wonder if there is a standard way to note which version of the Python interpreter code is intended to work with. I know that an executable may begin with #!/usr/bin/python2.3 or something similar, but what about libraries and such? Would it be a good idea for the software I write to check for the version of the interpreter?
Python is exceptionally backwards compatible, so generally code from an older version will run unchanged on newer Pythons.
There is a simple way of encoding a version of the interpreter, but the real question is why would you want to do that. If you really think it's necessary, just import sys and check the value of sys.version_info. Lots of code which wants to require a *minimum* version of Python (a far more common use case than checking for a *maximum*) contains code like this:
import sys if sys.hex_version[:3] < (2, 3, 3): sys.exit('Requires Python 2.3.3 or later to run!')
-Peter
i think you meant something this: import sys sys.version_info[:3]
(2, 4, 0) sys.version_info[:3] >= (2, 3, 3)
True
sys.hex_version
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
AttributeError: 'module' object has no attribute 'hex_version'
bryan
Peter Hansen wrote: Randall Smith wrote:
As Python changes and old code still needs to work properly, I wonder if there is a standard way to note which version of the Python interpreter code is intended to work with. I know that an executable may begin with #!/usr/bin/python2.3 or something similar, but what about libraries and such? Would it be a good idea for the software I write to check for the version of the interpreter?
Python is exceptionally backwards compatible, so generally code from an older version will run unchanged on newer Pythons.
There is a simple way of encoding a version of the interpreter, but the real question is why would you want to do that. If you really think it's necessary, just import sys and check the value of sys.version_info. Lots of code which wants to require a *minimum* version of Python (a far more common use case than checking for a *maximum*) contains code like this:
import sys if sys.hex_version[:3] < (2, 3, 3): sys.exit('Requires Python 2.3.3 or later to run!')
-Peter
i think you meant something this: import sys sys.version_info[:3]
(2, 4, 0) sys.version_info[:3] >= (2, 3, 3)
True
sys.hex_version
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
AttributeError: 'module' object has no attribute 'hex_version'
bryan
"Peter Hansen" <pe***@engcorp.com> wrote in message news:co**********@utornnr1pp.grouptelecom.net... Python is exceptionally backwards compatible, so generally code from an older version will run unchanged on newer Pythons.
I'm just curious: why exceptionally? I like Python for a lot of
reasons but I wouldn't put API stability high on the list.
Not compared with a traditional language like C or Fortran,
anyway. Which languages go around breaking backwards
conmpatibility in a cavalier way?
"Peter Hansen" <pe***@engcorp.com> wrote in message news:co**********@utornnr1pp.grouptelecom.net... Python is exceptionally backwards compatible, so generally code from an older version will run unchanged on newer Pythons.
I'm just curious: why exceptionally? I like Python for a lot of
reasons but I wouldn't put API stability high on the list.
Not compared with a traditional language like C or Fortran,
anyway. Which languages go around breaking backwards
conmpatibility in a cavalier way?
Richard Brodie wrote: "Peter Hansen" <pe***@engcorp.com> wrote in message news:co**********@utornnr1pp.grouptelecom.net...
Python is exceptionally backwards compatible, so generally code from an older version will run unchanged on newer Pythons.
I'm just curious: why exceptionally? I like Python for a lot of reasons but I wouldn't put API stability high on the list. Not compared with a traditional language like C or Fortran, anyway. Which languages go around breaking backwards conmpatibility in a cavalier way?
Anything from Microsoft, for a start.
Anyway, you're confusing "instability" (I hate that word,
it has connotations of unreliability, which aren't intended)
with "enhancement". The API gets changed, yes, but by
adding new things, almost never by removing the old stuff
or changing how it works. You are free to ignore the new
stuff, and almost all old code will work unchanged. That's
what backwards compatibility means, not that no new features
are ever added.
-Peter
Richard Brodie wrote: "Peter Hansen" <pe***@engcorp.com> wrote in message news:co**********@utornnr1pp.grouptelecom.net...
Python is exceptionally backwards compatible, so generally code from an older version will run unchanged on newer Pythons.
I'm just curious: why exceptionally? I like Python for a lot of reasons but I wouldn't put API stability high on the list. Not compared with a traditional language like C or Fortran, anyway. Which languages go around breaking backwards conmpatibility in a cavalier way?
Anything from Microsoft, for a start.
Anyway, you're confusing "instability" (I hate that word,
it has connotations of unreliability, which aren't intended)
with "enhancement". The API gets changed, yes, but by
adding new things, almost never by removing the old stuff
or changing how it works. You are free to ignore the new
stuff, and almost all old code will work unchanged. That's
what backwards compatibility means, not that no new features
are ever added.
-Peter
On Fri, 3 Dec 2004 11:03:58 -0000, Richard Brodie <r.******@rl.ac.uk> wrote: I'm just curious: why exceptionally? I like Python for a lot of reasons but I wouldn't put API stability high on the list. Not compared with a traditional language like C or Fortran, anyway. Which languages go around breaking backwards conmpatibility in a cavalier way?
VB, for a start. <http://www.mvps.org/vb/index2.html?rants/vfred.htm>
--
Cheers,
Simon B, si***@brunningonline.net, http://www.brunningonline.net/simon/blog/
On Fri, 3 Dec 2004 11:03:58 -0000, Richard Brodie <r.******@rl.ac.uk> wrote: I'm just curious: why exceptionally? I like Python for a lot of reasons but I wouldn't put API stability high on the list. Not compared with a traditional language like C or Fortran, anyway. Which languages go around breaking backwards conmpatibility in a cavalier way?
VB, for a start. <http://www.mvps.org/vb/index2.html?rants/vfred.htm>
--
Cheers,
Simon B, si***@brunningonline.net, http://www.brunningonline.net/simon/blog/
"Peter Hansen" <pe***@engcorp.com> wrote in message news:co**********@utornnr1pp.grouptelecom.net... Anyway, you're confusing "instability" (I hate that word, it has connotations of unreliability, which aren't intended) with "enhancement". The API gets changed, yes, but by adding new things, almost never by removing the old stuff or changing how it works.
I'm not confusing it, I'm disagreeing. Take xreadlines, for
example. Added in 2.1, deprecated in 2.3, removed in 2.4
Perhaps I lead a sheltered life but that's almost infinitely
worse than any other language I have used. It's not a big
issue though: I'm just surprised that what I would regard as
a weakness in Python, others consider a strength.
"Peter Hansen" <pe***@engcorp.com> wrote in message news:co**********@utornnr1pp.grouptelecom.net... Anyway, you're confusing "instability" (I hate that word, it has connotations of unreliability, which aren't intended) with "enhancement". The API gets changed, yes, but by adding new things, almost never by removing the old stuff or changing how it works.
I'm not confusing it, I'm disagreeing. Take xreadlines, for
example. Added in 2.1, deprecated in 2.3, removed in 2.4
Perhaps I lead a sheltered life but that's almost infinitely
worse than any other language I have used. It's not a big
issue though: I'm just surprised that what I would regard as
a weakness in Python, others consider a strength. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Sandman |
last post by:
Hello - I suppose this group could be suitable for my questions...
I am interested in a versioning system that works good for web authoring. I
don't know what differences web development might...
|
by: kartik |
last post by:
2 enable non-backward compatible changes to be made to the language or
the standard library (or other libraries, for that matter), i feel
there should be a way to version python files. the current...
|
by: Randall Smith |
last post by:
As Python changes and old code still needs to work properly, I wonder if
there is a standard way to note which version of the Python interpreter
code is intended to work with. I know that an...
|
by: PatrickSA |
last post by:
Hi,
Am new to web services, so apologies for the basic nature of the question -
and apologies in advance if this is the wrong newsgroup. We're building a
new web service and I'm looking around...
|
by: MrNobody |
last post by:
Is there any way to have .NET IDE to handle versioning for your application?
If for example you want a certain build number to increment every time you
build your project? Would need this version...
|
by: MikeY |
last post by:
Hi everyone,
Hopefully someone can help me on this.
I've been trying to find out how to change my naming on my executable
program when I have updated the application ie: myApp.exe1.0 to...
|
by: Modica82 |
last post by:
Hi all,
Does anyone have any views/information on the best way to version web
services. I am writing a proposal on how the company should handle
versioning of its web services and would like...
|
by: zacks |
last post by:
Am using VB.NET 2005.
I have a solution that has four projects. Two projects are standard
windows applications. One is a class library that is shared by the two
windows application projects, it...
|
by: betbubble |
last post by:
I replicate (transactional replication) my data entry database to a
read-only database. Both are SQL 2000+SP4. The web server reads the
read-only database. At times, there will be lots of changes...
|
by: Coaster |
last post by:
orig ref here
http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet/browse_thread/thread/ff29cc370678911d/c0db5b7e3da283b9?lnk=st&q=gac+assembly+new+version&rnum=7#c0db5b7e3da283b9...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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...
|
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...
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |