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


Groups > comp.lang.python > #6511

Re: Beginner needs advice

References (10 earlier) <SQXDp.15309$eb4.6@newsfe02.iad> <mailman.2182.1306545444.9059.python-list@python.org> <0XbEp.24071$oq.16802@newsfe17.iad> <mailman.2198.1306612060.9059.python-list@python.org> <bPhEp.38613$Vp.24044@newsfe14.iad>
Date 2011-05-29 12:26 +1000
Subject Re: Beginner needs advice
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2211.1306635999.9059.python-list@python.org> (permalink)

Show all headers | View raw


On Sun, May 29, 2011 at 12:02 PM, harrismh777 <harrismh777@charter.net> wrote:
> Chris Angelico wrote:
>> Both versions of Python are
>> the same language, because they "think" the same way;
>     I see your point. But, knowing that 3.x "thinks" like 2.x is not helpful
> when we all know that languages don't think, people do.

I was being (deliberately) sloppy with the English language there, but
I was referring to the fundamental philosophies of Python, which are
common across both versions (and, presumably, most/all of them can be
seen in Python 1 too; I've never used Python 1).

>> Little syntactic
>> differences like whether 'print' is a function or a statement, and
>> whether the simple slash operator between two ints returns a float,
>> and the fact that Unicode is the default string type, are
>> comparatively minor; on 'most every philosophical point, the two
>> dialects agree.
>
>   Minor, yes, .... until you need to make something work--- only to be
> frustrated to find that a detail that was not expected has risen to bite a
> sensitive place...   :)

I get far worse than those when I switch between languages and forget
operator precedence, or forget that function X has its parameters the
other way around, or whatever. They are minor, and if you're not 100%
familiar with the language you're writing in, you should probably have
its docs handy anyway.

The print function will bite you instantly, you'll know what's wrong
as soon as you try to run it. Unicode strings, too, will usually throw
a nice tidy exception. The only one that's going to really sting you
is division, and it's so easy to deal with that one as you code
(always use // for flooring).

> instance, how do we reload a module in 2.x...  with, um, reload.   This has
> always been the way... every book says so, and every one of us has
> re-invoked a .py file by using relaod.  Reload doesn't even work on 3.x
> without an import.

>From what I gather, Python simply isn't designed with that sort of
"live reload" in mind. Just terminate it and start over, it's easier.
If you want a system where you reload parts of it without bringing
things down, either build it manually (loading another piece of code,
and maybe reassigning some state variables that have your functions),
or pick a different language - Pike does this excellently. That's not
an indictment of Python; it's simply that Python is not everything.

> Some of the posts here are referring to the two languages as partially
> incompatible....   reminds me of that line from Princess Bride... "... he's
> not dead, hes only mostly dead!... and mostly dead is partly alive!"  To say
> that 3.x is partly compatible with 2.x is silly, but to say that 3.x
> 'thinks' the same way as 2.x is almost pythonesque...  I almost like that...

Mostly compatible is still partly incompatible? Sure. But "mostly
compatible" is Python 2.6.6 and Python 2.7.1, too. It's easy to write
one codebase that runs under multiple Python versions; certainly it's
a lot easier than writing one source file that's both Python and C,
for instance. And the same lines of code will be doing the same work
(unlike most polyglottisms, where one language's code is another
language's comments). There is a subset of Python 2 that is also a
subset of Python 3, and this intersection is quite large.

Chris Angelico

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web