473,756 Members | 1,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Misleading wikipedia article on Python 3?

I'm surprised to read this:

http://en.wikipedia.org/wiki/Python_3

"""Note that while there is no explicit requirement that code be able
to run unmodified in both versions, in practice it is quite likely for
most code. As of January 2007, it looks like most reasonable code
should run quite well under either branch."""
I haven't been following Python 3 development recently. Have things
really changed that much? Last time I looked, e.g. dict.items() no
longer returned a list. Seems unlikely that most code will run on 2
and 3, in that case, and IIUC Guido has said all along that not much
code will run on both.

Maybe somebody who's following current Py3k goings-on can fix the
article if needed...
John
Aug 5 '07 #1
27 1512
I'm surprised to read this:
>
http://en.wikipedia.org/wiki/Python_3

"""Note that while there is no explicit requirement that code be able
to run unmodified in both versions, in practice it is quite likely for
most code. As of January 2007, it looks like most reasonable code
should run quite well under either branch."""
It's difficult to predict the future, but I think this statement is
a fair description.
>
I haven't been following Python 3 development recently. Have things
really changed that much? Last time I looked, e.g. dict.items() no
longer returned a list.
Correct.
Seems unlikely that most code will run on 2
and 3, in that case,
Why that? Most reasonable code doesn't care what dict.items returns,
as it reads like

for k,v in dict.items():
do_something_wi th(k,v)
and IIUC Guido has said all along that not much
code will run on both.
I think you misunderstood. It's not a design goal that code works
without modifications, yet most reasonable code will even without
that being an explicit goal.

Regards,
Martin
Aug 5 '07 #2
"Martin v. Löwis" <ma****@v.loewi s.dewrites:
>I'm surprised to read this:

http://en.wikipedia.org/wiki/Python_3

"""Note that while there is no explicit requirement that code be able
to run unmodified in both versions, in practice it is quite likely for
most code. As of January 2007, it looks like most reasonable code
should run quite well under either branch."""

It's difficult to predict the future, but I think this statement is
a fair description.
>>
I haven't been following Python 3 development recently. Have things
really changed that much? Last time I looked, e.g. dict.items() no
longer returned a list.

Correct.
>Seems unlikely that most code will run on 2
and 3, in that case,

Why that? Most reasonable code doesn't care what dict.items returns,
as it reads like

for k,v in dict.items():
do_something_wi th(k,v)
We could discuss that. However, my example wasn't really intended to
relate strictly to that technical feature. Rather, to the intent of
the Python 3 developers, as suggested by things like that change, and
by what they've said over the last year or so (I think I've seen that
specific change used several times by people explaining that 2.6 / 3.0
compatibility will be impractical, which is why I chose it).

>and IIUC Guido has said all along that not much
code will run on both.

I think you misunderstood. It's not a design goal that code works
without modifications, yet most reasonable code will even without
that being an explicit goal.
I think the design goals have been fairly clear. What hasn't been
clear (to me, at least) is the practical question of the feasibility
of code working unchanged on both 2.6 and 3.0.

http://www.python.org/dev/peps/pep-3000/

"""There is no requirement that Python 2.6 code will run unmodified on
Python 3.0. Not even a subset. (Of course there will be a tiny subset,
but it will be missing major functionality.) """
Though certainly neither quote is precise enough to pin it down
formally, certainly the tone of the first quote (from the Wikipedia
article) to my ear makes it sound like (at minimum!) it will be
practical for most projects, if they do the work to support both 3.0
and 2.6, to run simultaneously on 2.6 and 3.0 without use of a
translation tool. The second quote makes it sound like that will be
highly impractical. That picture is reinforced by what follows (in
PEP 3000):

"""
The recommended development model for a project that needs to support
Python 2.6 and 3.0 simultaneously is as follows:

0. You should have excellent unit tests with close to full
coverage.

1. Port your project to Python 2.6.

2. Turn on the Py3k warnings mode.

3. Test and edit until no warnings remain.

4. Use the 2to3 tool to convert this source code to 3.0 syntax. Do
not manually edit the output!

5. Test the converted source code under 3.0.

6. If problems are found, make corrections to the 2.6 version of
the source code and go back to step 3.

7. When it's time to release, release separate 2.6 and 3.0 tarballs
(or whatever archive form you use for releases).

It is recommended not to edit the 3.0 source code until you are ready
to reduce 2.6 support to pure maintenance (i.e. the moment when you
would normally move the 2.6 code to a maintenance branch anyway).
"""
So which is it? That is, will it be practical for most projects to
support 2.6 and 3.0 simultaneously, from the same codebase, without
relying on translation tools? I'm assuming the practicalities of this
*are* clear by now to the Python 3 developers -- is that right? It
seems to me that if I don't understand what the Python 3 developers
expect the practicalities to be, most other interested people won't
either ("interested " in the opposite sense to "disinteres ted" rather
than to "uninterested") .
John
Aug 5 '07 #3
>I think you misunderstood. It's not a design goal that code works
>without modifications, yet most reasonable code will even without
that being an explicit goal.

I think the design goals have been fairly clear. What hasn't been
clear (to me, at least) is the practical question of the feasibility
of code working unchanged on both 2.6 and 3.0.

http://www.python.org/dev/peps/pep-3000/

"""There is no requirement that Python 2.6 code will run unmodified on
Python 3.0. Not even a subset. (Of course there will be a tiny subset,
but it will be missing major functionality.) """
That's a different statement, though: It is likely that code will not
run unmodified on 3k. For example, print is now a statement, and
many many modules use that statement somewhere; they break in 3k.

However, it *is* a design goal to make 2.6 so that transition to
3k becomes simpler. That's not a 3k feature, but a 2.6 one.
Though certainly neither quote is precise enough to pin it down
formally, certainly the tone of the first quote (from the Wikipedia
article) to my ear makes it sound like (at minimum!) it will be
practical for most projects, if they do the work to support both 3.0
and 2.6, to run simultaneously on 2.6 and 3.0 without use of a
translation tool. The second quote makes it sound like that will be
highly impractical. That picture is reinforced by what follows (in
PEP 3000):

"""
The recommended development model for a project that needs to support
Python 2.6 and 3.0 simultaneously is as follows:
That's Guido's recommendation, yes: use the 2to3 tool.

There are certainly projects for which this might be the only reasonable
strategy. However, whether that will be the *common* strategy remains
to be seen. I personally believe that many projects won't need the 2to3
tool, if they are willing to compromise on the notations used in the
source code.
So which is it?
Both.
That is, will it be practical for most projects to
support 2.6 and 3.0 simultaneously, from the same codebase, without
relying on translation tools?
That remains to be seen. I believe it will be, yes. Only when people
start trying we will actually know. Personal preference will vary
across projects; some will use the conversion tool even though they
could have come up with a single-source solution, others will fight
for a single-source solution even though life would have been much
simpler with the conversion tool.
I'm assuming the practicalities of this
*are* clear by now to the Python 3 developers -- is that right?
Not at all (at least now to me). I know what kind of changes *I*
regularly do to make code run in 3k, namely, put parentheses around
into the print statements. I can live with that. Whether it is
practical to run, say, Django unmodified, I don't know - I have
not looked into Django with that much detail, let alone tested
whether it will work.

Note that I'm primarily talking about pure Python here; for
C code, you can get a single-source version only with a lot
of #ifdefs (but again, I believe it is practical to make it
work that way).
It
seems to me that if I don't understand what the Python 3 developers
expect the practicalities to be, most other interested people won't
either ("interested " in the opposite sense to "disinteres ted" rather
than to "uninterested") .
I think comp.lang.pytho n is then the wrong place to find out; the py3k
list likely reaches more of these developers. OTOH, I don't know whether
they all want to participate in a survey of their expectations...

Rather than studying people's opinions, why don't you try to port your
own projects to 3k, and report whether you found it practical to use
a single source (assuming you would prefer such a solution for your
own project)?

Regards,
Martin
Aug 5 '07 #4
"Martin v. Löwis" <ma****@v.loewi s.dewrites:
[... snip stuff I don't follow ...]
However, it *is* a design goal to make 2.6 so that transition to
3k becomes simpler. That's not a 3k feature, but a 2.6 one.
Not sure I care about this sort of thing for the purpses of my
question. I just wanted to know: is it easy to make my code so it
runs on 2.6 and 3.0, without funny stuff like a code translator?
Seems wikipedia said "yes" and Guido said "no".
[...]
to be seen. I personally believe that many projects won't need the 2to3
tool, if they are willing to compromise on the notations used in the
source code.
OK, so there's disagreement on this point amongst the Python 3
developers. That's interesting (I don't mean that in a negative way).
[...]
>It
seems to me that if I don't understand what the Python 3 developers
expect the practicalities to be, most other interested people won't
either ("interested " in the opposite sense to "disinteres ted" rather
than to "uninterested") .

I think comp.lang.pytho n is then the wrong place to find out; the py3k
list likely reaches more of these developers. OTOH, I don't know whether
they all want to participate in a survey of their expectations...
I was also hoping to get a quick answer rather than a long discussion,
if any Python 3 developers were around to talk to the broader range of
people that read this list. You have given your answers, I wonder if
anybody else will turn up.

Rather than studying people's opinions, why don't you try to port your
own projects to 3k, and report whether you found it practical to use
a single source (assuming you would prefer such a solution for your
own project)?
Because that might well tell me much less than asking a Python 3
developer, and yet take far more time, and fail to inform everybody
else.
John
Aug 5 '07 #5
John J. Lee schrieb:
"Martin v. Löwis" <ma****@v.loewi s.dewrites:
[... snip stuff I don't follow ...]
>However, it *is* a design goal to make 2.6 so that transition to
3k becomes simpler. That's not a 3k feature, but a 2.6 one.

Not sure I care about this sort of thing for the purpses of my
question. I just wanted to know: is it easy to make my code so it
runs on 2.6 and 3.0, without funny stuff like a code translator?
Seems wikipedia said "yes" and Guido said "no".
Neither of these are qualified to make any statements about your
code. Only you can find out yourself. OTOH, neither of these *did*
make any statement about *your* code.

Regards,
Martin
Aug 6 '07 #6
On Sun, 2007-08-05 at 23:09 +0000, John J. Lee wrote:
I just wanted to know: is it easy to make my code so it
runs on 2.6 and 3.0, without funny stuff like a code translator?
That depends on your definitions of "easy" and "funny stuff." I'm pretty
sure you'll be able to run the same source code on Python 2.6 and Python
3.0 without either one breaking, as long as the code is written
sufficiently carefully. You may have to give up some Python 3.0 features
and/or write compatibility shims depending on what features you'll need.
Whether that's acceptable depends on the features you need and how much
"yak shaving" you find acceptable.

For instance, if you never use print statements in your code, you won't
notice that print is becoming a function. If you do, you'll have to make
appropriate accommodations.

HTH,

--
Carsten Haese
http://informixdb.sourceforge.net
Aug 6 '07 #7
Carsten Haese <ca*****@uniqsy s.comwrites:
For instance, if you never use print statements in your code, you won't
notice that print is becoming a function. If you do, you'll have to make
appropriate accommodations.
Why on earth did they make this change? It just seems gratuitous. Is
the assert statement also being changed? Are they going to update all
the docs that say that the yield statement works like the print statement?
Aug 6 '07 #8
On 2007-08-06, Paul Rubin <httpwrote:
Carsten Haese <ca*****@uniqsy s.comwrites:
>For instance, if you never use print statements in your code, you won't
notice that print is becoming a function. If you do, you'll have to make
appropriate accommodations.

Why on earth did they make this change? It just seems
gratuitous. Is the assert statement also being changed? Are
they going to update all the docs that say that the yield
statement works like the print statement?
From the footnotes of PEP 3100:

http://mail.python.org/pipermail/pyt...er/056154.html
http://www.python.org/dev/peps/pep-3105

--
Neil Cerutti
Aug 6 '07 #9
On 2007-08-06, Neil Cerutti <ho*****@yahoo. comwrote:
On 2007-08-06, Paul Rubin <httpwrote:
>Carsten Haese <ca*****@uniqsy s.comwrites:
>>For instance, if you never use print statements in your code,
you won't notice that print is becoming a function. If you
do, you'll have to make appropriate accommodations.

Why on earth did they make this change? It just seems
gratuitous. Is the assert statement also being changed? Are
they going to update all the docs that say that the yield
statement works like the print statement?

From the footnotes of PEP 3100:

http://mail.python.org/pipermail/pyt...er/056154.html
http://www.python.org/dev/peps/pep-3105
Incidentally, from the second link I find it shocking that the
keyword parameter "file" shadows a builtin. It seems to endorse a
bad practice.

--
Neil Cerutti
Aug 6 '07 #10

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

Similar topics

0
1159
by: Laurence Parry | last post by:
Some people over on Wikipedia seem to have the idea that VB.NET is not a major programming language: http://en.wikipedia.org/wiki/Template_talk:Major_programming_languages_small#Visual_Basic_.NET I think they're wrong. But I had to agree with what one guy said - the general view in the geeky programming community is that VB.NET is a poor brother to C#; some still think it's just a slightly improved version of VB! I don't think this will...
24
2377
by: Luis M. González | last post by:
For those interested in the simplest, easiest and most pythonic web framework out there, there's a new page in Wikipedia: http://en.wikipedia.org/wiki/Karrigell
9
4963
by: AES | last post by:
I fairly often make PDF copies of web pages or sites by copying the web page link from the web page itself and pasting it into the Acrobat 7.0 Standard "Create PDF From Web Page" command. (Not trying to steal material; usually just want to make a temporary copy to read offline, e.g. on a plane flight.) This almost always works remarkably well, but when I tried it recently with a Wikipedia article
8
2131
by: Claudio Grondi | last post by:
Here an example of what I mean (Python 2.4.2, IDLE 1.1.2, Windows XP SP2, NTFS file system, 80 GByte large file): Traceback (most recent call last): File "<pyshell#1>", line 1, in -toplevel- f = file('veryBigFile.dat','r+') IOError: No such file or directory: 'veryBigFile.dat'
7
1419
by: Pitaridis Aristotelis | last post by:
There is a free encyclopedia called wikipedia (http://wikimediafoundation.org/). Does anyone knows how to use it in order to get various articles for diplaying them in my application?
5
7669
by: jkn | last post by:
Hi all Python 2.4.2 (#1, Apr 26 2006, 23:35:31) on linux2 Type "help", "copyright", "credits" or "license" for more information. Traceback (most recent call last): File "<stdin>", line 1, in ? IOError: invalid mode: a
11
2312
by: Paddy | last post by:
I just had a link to Tim peters first post on doctest: http://groups.google.com/group/comp.lang.python/msg/1c57cfb7b3772763 removed from http://en.wikipedia.org/wiki/Doctest as it doesn't fit their guidelines for external links. I wonder, could maybe the official website be persuaded to host a copy so that it could be linked to? Tim, would you object? - Paddy.
2
2626
by: John Nagle | last post by:
For some reason, Python's parser for "robots.txt" files doesn't like Wikipedia's "robots.txt" file: False The Wikipedia robots.txt file passes robots.txt validation, and it doesn't disallow unknown browsers. But the Python parser doesn't see it that way. No matter what user agent or URL is specified; for that robots.txt file, the only answer is "False". It's failing in Python 2.4 on Windows and 2.5 on Fedora Core.
13
2462
by: Paddy | last post by:
I would value the opinion of fellow Pythoneers who have also contributed to Wikipedia, on the issue of "Is Python Standardized". Specifically in the context of this table: http://en.wikipedia.org/wiki/Comparison_of_programming_languages#General_comparison (Comparison of programming languages) And this entry in the talk page http://en.wikipedia.org/wiki/Talk:Comparison_of_programming_languages#Standardized_Python.3F (Talk:Comparison of...
0
9275
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
10034
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
9872
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...
0
9713
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...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.