Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #6234 > unrolled thread

Re: Beginner needs advice

Started by"Colin J. Williams" <cjw@ncf.ca>
First post2011-05-25 08:57 -0400
Last post2011-05-28 08:38 -0400
Articles 5 on this page of 45 — 18 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Beginner needs advice "Colin J. Williams" <cjw@ncf.ca> - 2011-05-25 08:57 -0400
    Re: Beginner needs advice harrismh777 <harrismh777@charter.net> - 2011-05-27 09:40 -0500
      Re: Beginner needs advice Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-27 15:52 +0000
        Re: Beginner needs advice harrismh777 <harrismh777@charter.net> - 2011-05-27 15:40 -0500
          Re: Beginner needs advice Chris Angelico <rosuav@gmail.com> - 2011-05-28 09:09 +1000
            Re: Beginner needs advice harrismh777 <harrismh777@charter.net> - 2011-05-27 20:02 -0500
              Re: Beginner needs advice Ethan Furman <ethan@stoneleaf.us> - 2011-05-27 18:30 -0700
                Re: Beginner needs advice harrismh777 <harrismh777@charter.net> - 2011-05-28 14:21 -0500
                  Re: Beginner needs advice Chris Angelico <rosuav@gmail.com> - 2011-05-29 05:47 +1000
                    Re: Beginner needs advice harrismh777 <harrismh777@charter.net> - 2011-05-28 21:02 -0500
                      Re: Beginner needs advice Chris Angelico <rosuav@gmail.com> - 2011-05-29 12:26 +1000
                      Re: Beginner needs advice Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-29 14:09 +0000
                        Re: Beginner needs advice harrismh777 <harrismh777@charter.net> - 2011-05-30 19:32 -0500
                          Re: Beginner needs advice "Rhodri James" <rhodri@wildebst.demon.co.uk> - 2011-05-31 01:58 +0100
                            Re: Beginner needs advice Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-05-30 22:20 -0700
                              Re: Beginner needs advice Ben Finney <ben+python@benfinney.id.au> - 2011-05-31 15:48 +1000
                                Re: Beginner needs advice MRAB <python@mrabarnett.plus.com> - 2011-05-31 17:59 +0100
                                Re: Beginner needs advice Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-05-31 10:22 -0700
                          Re: Beginner needs advice Terry Reedy <tjreedy@udel.edu> - 2011-05-30 21:34 -0400
                          Re: Beginner needs advice Terry Reedy <tjreedy@udel.edu> - 2011-05-30 21:47 -0400
                          Re: Beginner needs advice Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-05-30 22:20 -0700
                          Re: Beginner needs advice Benjamin Kaplan <benjamin.kaplan@case.edu> - 2011-05-30 22:35 -0700
              Re: Beginner needs advice Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-28 05:40 +0000
          Re: Beginner needs advice Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-28 06:15 +0000
            Re: Beginner needs advice harrismh777 <harrismh777@charter.net> - 2011-05-28 21:33 -0500
              Re: Beginner needs advice Ian Kelly <ian.g.kelly@gmail.com> - 2011-05-29 02:06 -0600
                Re: Beginner needs advice harrismh777 <harrismh777@charter.net> - 2011-05-30 19:43 -0500
                  Re: Beginner needs advice Ian Kelly <ian.g.kelly@gmail.com> - 2011-05-30 19:16 -0600
                  Re: Beginner needs advice Chris Angelico <rosuav@gmail.com> - 2011-05-31 12:27 +1000
                    Re: Beginner needs advice harrismh777 <harrismh777@charter.net> - 2011-05-30 22:02 -0500
              Re: Beginner needs advice Jason Tackaberry <tack@urandom.ca> - 2011-05-29 15:28 -0400
                Re: Beginner needs advice rantingrick <rantingrick@gmail.com> - 2011-05-29 16:00 -0700
                  Re: Beginner needs advice Chris Angelico <rosuav@gmail.com> - 2011-05-30 09:31 +1000
                Re: Beginner needs advice harrismh777 <harrismh777@charter.net> - 2011-05-30 19:44 -0500
              Re: Beginner needs advice rantingrick <rantingrick@gmail.com> - 2011-05-29 15:15 -0700
              Re: Beginner needs advice Dotan Cohen <dotancohen@gmail.com> - 2011-05-31 20:56 +0300
              Re: Beginner needs advice Ian Kelly <ian.g.kelly@gmail.com> - 2011-05-31 12:29 -0600
              Re: Beginner needs advice Dotan Cohen <dotancohen@gmail.com> - 2011-05-31 21:42 +0300
          Re: Beginner needs advice Dotan Cohen <dotancohen@gmail.com> - 2011-05-29 08:46 +0300
        Re: Beginner needs advice Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-05-28 07:06 +0200
          Re: Beginner needs advice Thorsten Kampe <thorsten@thorstenkampe.de> - 2011-05-28 08:38 +0200
            Re: Beginner needs advice Thorsten Kampe <thorsten@thorstenkampe.de> - 2011-05-28 08:42 +0200
            Re: Beginner needs advice Chris Angelico <rosuav@gmail.com> - 2011-05-28 16:44 +1000
            Re: Beginner needs advice Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-28 08:13 +0000
          Re: Beginner needs advice "D'Arcy J.M. Cain" <darcy@druid.net> - 2011-05-28 08:38 -0400

Page 3 of 3 — ← Prev page 1 2 [3]


#6455

FromThorsten Kampe <thorsten@thorstenkampe.de>
Date2011-05-28 08:38 +0200
Message-ID<MPG.284ab6e5dded381d98981a@news.individual.de>
In reply to#6449
* Thomas Rachel (Sat, 28 May 2011 07:06:53 +0200)
> Am 27.05.2011 17:52 schrieb Steven D'Aprano:
> > On Fri, 27 May 2011 09:40:53 -0500, harrismh777 wrote:
> >> 3.x is completely incompatible with 2.x (some call it a dialect,
> >> but that is a lie).
> >
> > "Completely incompatible"? A "lie"?
> 
> Hard word, but it is true. Many things can and will fall on your feet
> when moving.

I think we should stop talking about (in)compatability because everyone 
seems to associate something different with that term (incompatible = 
"no Python2 to code will run with Python3", "not all Python2 code will 
run with Python3").

The question is: if you want (or have) to run your code under Python3, 
how likely is that it will run unmodified? My experience is: unless the 
code is especially written with Python3 compatability or just a short 
snippet, it's actually quite unlikely that it will run.

I modified three programs/modules (none of them written with Python3 in 
mind - I was thinking that Python 3000 would come out some day after 
Perl 6, PHP 6 and GNU Hurd; how could I know that the Python developers 
actually mean business?)

One is a tool box kind of module. I had to insert lots of "list()" and 
add a complete function that would deal with the different behaviour of 
"sort". Probably easy to find the problems if you have extensive unit 
tests but without it was a tedious nightmare.

The second a kind of script template. gettext.install has no "unicode = 
True". Easy fix but I wondered why Python 3 does not ignore the keyword 
simply.

The third, a more real world complete application using PyQt. Took me 
about a day to fix. The problem was not just with the code but also with 
the tools (pyuic4, pyrcc4). Without the PyQt mailing list this wouldn't 
have been possible. Still: a complete workday (or even more) for 150 
lines of code.


Thorsten

[toc] | [prev] | [next] | [standalone]


#6456

FromThorsten Kampe <thorsten@thorstenkampe.de>
Date2011-05-28 08:42 +0200
Message-ID<MPG.284ab7b8ff01bf398981b@news.individual.de>
In reply to#6455
* Thorsten Kampe (Sat, 28 May 2011 08:38:54 +0200)
> My experience is: unless the code is especially written with Python3
> compatability [...]

Oops, I meant "unless the code is specifically written with Python3 
compatability in mind [...]"

Thorsten

[toc] | [prev] | [next] | [standalone]


#6457

FromChris Angelico <rosuav@gmail.com>
Date2011-05-28 16:44 +1000
Message-ID<mailman.2187.1306565090.9059.python-list@python.org>
In reply to#6455
On Sat, May 28, 2011 at 4:38 PM, Thorsten Kampe
<thorsten@thorstenkampe.de> wrote:
> The question is: if you want (or have) to run your code under Python3,
> how likely is that it will run unmodified? My experience is: unless the
> code is especially written with Python3 compatability or just a short
> snippet, it's actually quite unlikely that it will run.
>

But what about the 2to3 tool? If you use that, then how much more is
there to deal with?

I installed Python 3 and found that a little bandwidth monitor stopped
working. After running it through 2to3, there were only a couple of
things needing fixing, including the HTTPS library (it didn't like my
Unicode strings, I had to go b" " for them), but the bulk of it was
fine.

Chris Angelico

[toc] | [prev] | [next] | [standalone]


#6459

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2011-05-28 08:13 +0000
Message-ID<4de0aebf$0$29996$c3e8da3$5496439d@news.astraweb.com>
In reply to#6455
On Sat, 28 May 2011 08:38:54 +0200, Thorsten Kampe wrote:

> * Thomas Rachel (Sat, 28 May 2011 07:06:53 +0200)
>> Am 27.05.2011 17:52 schrieb Steven D'Aprano:
>> > On Fri, 27 May 2011 09:40:53 -0500, harrismh777 wrote:
>> >> 3.x is completely incompatible with 2.x (some call it a dialect, but
>> >> that is a lie).
>> >
>> > "Completely incompatible"? A "lie"?
>> 
>> Hard word, but it is true. Many things can and will fall on your feet
>> when moving.
> 
> I think we should stop talking about (in)compatability because everyone
> seems to associate something different with that term (incompatible =
> "no Python2 to code will run with Python3", "not all Python2 code will
> run with Python3").

There is a difference between "completely incompatible" and merely 
"incompatible to some degree". It just takes *one* tiny incompatibility 
to stop a program running, so "will it run unmodified?" is hardly a good 
measure of the degree of incompatibility.

Python 2.5 and 2.6 are incompatible to some degree. I recently had to 
port a client's program from 2.3 to 2.6. I did it in two steps: about two 
hours to get it working in 2.5, then the same to get it working in 2.6, 
and then about a day of effort to iron out all the display issues in 
Tkinter (such as text being shown in giant letters).

Judging by the binary Yes/No "does it run unmodified?" test, I'd have to 
say that Python 2.3, 2.5 and 2.6 are "completely different" -- which 
would be foolish. Nobody sensible applies such a simple-minded, overly 
strict test to minor releases, or even between major releases like 1.5 
versus 2.0. What would be the point? It is not the least bit helpful to 
learn that your 2.3 code doesn't run unmodified in 2.6. (Learning that it 
does, on the other hand, is useful. But such code is in a minority.)

And yet some people are willing to throw commonsense away and apply such 
an obviously unsuitable test to Python 3. These people vehemently insist 
that the differences between Python 2.7 and 3.2 are of the same 
qualitative kind as between Ruby and PHP (they're *different languages* 
you see, not merely different dialects of the same language, and anyone 
who tells you different is not just mistaken but *lying*).



> The question is: if you want (or have) to run your code under Python3,
> how likely is that it will run unmodified? 

That's not a useful question. The useful question is to ask how much 
effort is it to make the code run in the new version. The effort might be 
zero (but probably isn't), or it might be a minute, or an hour, or a day, 
or six months... that depends partly on the complexity of your code and 
partly on the differences between Python 2.x and 3.x.

A trivial app might take three minutes to port from Python 2.5 to 3.2. A 
complicated app might take three months to port from 2.5 to 2.6. What 
generalization do we make from this?


> My experience is: unless the
> code is especially written with Python3 compatability or just a short
> snippet, it's actually quite unlikely that it will run.

You describe taking a full day to upgrade a 150 line PyQt application. 
Only it wasn't a 150 line application, was it? By your own admission, 
much of the problems were in the library, PyQt, so it was more like 
150,000 lines. (Or whatever the size of PyQt is...)

Rather than "it took a full day to upgrade 150 lines to use Python 3, 
that's terrible!", it is more like "it only took a day to upgrade my 150 
line app *and* work around a whole lot of problems with a huge library, 
that's really great!"



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#6467

From"D'Arcy J.M. Cain" <darcy@druid.net>
Date2011-05-28 08:38 -0400
Message-ID<mailman.2191.1306586307.9059.python-list@python.org>
In reply to#6449
On Sat, 28 May 2011 07:06:53 +0200
Thomas Rachel
<nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de>
wrote:
> > "Completely incompatible"? A "lie"?
> 
> Hard word, but it is true. Many things can and will fall on your feet 
> when moving.
> 
> There are very many subtle differences.

The space between "Completely incompatible" and "many subtle
differences" is about the size of the Grand Canyon.

-- 
D'Arcy J.M. Cain <darcy@druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.

[toc] | [prev] | [standalone]


Page 3 of 3 — ← Prev page 1 2 [3]

Back to top | Article view | comp.lang.python


csiph-web