Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #103106
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Guido on python3 for beginners |
| Date | Thu, 18 Feb 2016 22:07:05 +1100 |
| Lines | 44 |
| Message-ID | <mailman.245.1455793627.22075.python-list@python.org> (permalink) |
| References | <48762040-a7e0-434c-92e8-8a0969210e5b@googlegroups.com> <5d31dd14-1a60-4f80-8889-d0616f404c70@googlegroups.com> <4e902c58-3370-4adf-905d-74630a6eea90@googlegroups.com> <60036746-78f7-4f05-a6d8-04e88b09c00f@googlegroups.com> <032f0f66-34df-4325-98e0-1127025d2a94@googlegroups.com> <31a618b2-a407-4723-9a4f-9b756fc93b0b@googlegroups.com> <0a920e92-5d31-4866-815b-cae7e201e4d8@googlegroups.com> <56c568f2$0$2832$c3e8da3$76491128@news.astraweb.com> <CAPTjJmrF2=V0s=g5OzepLozhyS7KToqUiKK3A4FjzbnwuCwsnw@mail.gmail.com> <na4018$un9$1@ger.gmane.org> <CAPTjJmp_MxJLpuRt3VRtT7E3pV2Brty_U5PaXEJ4h6bnY6bS4A@mail.gmail.com> <CA790464-2C9C-4BFE-9BAC-64CBDE4799DB@gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | news.uni-berlin.de YF+Ipyc8snKndl1lrp6kMA4hsQ67MPlhBdmlNl+Y74yw== |
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'received:209.85.223': 0.03; 'root': 0.04; 'binary': 0.05; 'python3': 0.05; 'bash': 0.07; 'interpreter.': 0.07; 'cc:addr:python-list': 0.09; 'scripts': 0.09; '"python"': 0.09; 'beginners': 0.09; 'returns,': 0.09; 'python': 0.10; 'exception': 0.13; 'applies': 0.15; 'thu,': 0.15; '(also': 0.16; "(i'm": 0.16; '2016': 0.16; 'bash,': 0.16; 'deactivate': 0.16; 'echo': 0.16; 'first:': 0.16; 'fluent': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'privileges.': 0.16; 'py3': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:python3': 0.16; 'wrote:': 0.16; "wouldn't": 0.16; 'board.': 0.18; 'shell': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'users,': 0.22; 'bit': 0.23; 'feb': 0.23; 'consistent': 0.23; 'header:In-Reply-To:1': 0.24; "i've": 0.25; 'chris': 0.26; 'message-id:@mail.gmail.com': 0.27; 'about.': 0.29; 'accidentally': 0.29; 'raise': 0.29; 'asked': 0.29; 'code': 0.30; "i'd": 0.31; 'probably': 0.31; 'another': 0.32; "can't": 0.32; 'run': 0.33; 'source': 0.33; 'environment,': 0.33; 'suddenly': 0.33; 'surprised': 0.33; 'that,': 0.34; 'received:google.com': 0.35; 'activate': 0.35; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'agree': 0.37; 'environment.': 0.37; 'starting': 0.37; 'things': 0.38; 'virtual': 0.38; 'received:209': 0.38; 'stuff': 0.38; 'skip:p 20': 0.38; 'files': 0.38; 'test': 0.39; 'where': 0.40; 'your': 0.60; 'side': 0.62; 'more': 0.63; 'personal': 0.63; 'soon': 0.65; 'skip:$ 10': 0.67; 'teaching': 0.69; 'feeling': 0.72; 'chrisa': 0.84; 'confusing': 0.84; 'pip': 0.84; 'way...': 0.84; 'to:none': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type:content-transfer-encoding; bh=s7rBdQGsAlm7emmeloUBlz2nTzyAO3LS8az8+yd3PJc=; b=aYNwaS3vlIdvr7EDvFN2vSHhYhm1FZhesrPUJe8moZeTGaIweggxOEM70y5U3xJP/x 7aTBsLBmGGsoujKEn7rF+9Wc9xZx7Wfut9iuG7D8WC3uiQi6jUOA2vxfoP1J0hnSLMuq C3li5UQLI7SUHQ50zGFPdf7adjqMu14LPA4z0q1Gov2U5d9VMRfI/Vg2yzZysEBOVtvd ooRj+DZFSGPbRWwz6uhqPhSNgAc5bFhJUZ8exsfNtgAcImhKeL5PcT8SlUAKvcBryRrx 6Y2gG6hLjh9qDPicF7lh0LPbWG1p6yD6wbNc5JdBlUkbrZ47Jg2GL0eYqXKvjekVyhhU 6u2A== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc:content-type:content-transfer-encoding; bh=s7rBdQGsAlm7emmeloUBlz2nTzyAO3LS8az8+yd3PJc=; b=VTZoJie21MS9dovBVil9t3DcAVxBctmRFlpX+SS/ScMX0aNmtUVlwMK8xS9DEjQmgt yCa6iY1NG4d1PzEvXgHD3DSPLrP6fQQa8cmIxyyNoKUplPUEqM35Fhkb0WQYUNC5ytSt usHOYEpJJ3b4rMcuJzjEQRvxnU0rxfUyez6WseeNesRZKKKymCwI5Hb78CDqYi50WuDQ +AEV8H9Q2qjdGPmeGUa9OUKTNqZpyJqxbT/tpoS6258Ayf7K8x8QGQMVMKm7ZmCD//bu VXry0a3uskX/IiiZc4QCb+Q7QJjSLeuYG+Jg4qweMoP3a9qRT9jQJXJjoSUi/5MHikYB Hg1w== |
| X-Gm-Message-State | AG10YOSiHDtH8am7J4+akVAPdH9Kg2LUOsQ87192uKUcR32W3lMRRJnIxAjMyXhhhHZKyJpJP3OAcak8HdEBLQ== |
| X-Received | by 10.107.132.90 with SMTP id g87mr7736969iod.157.1455793625234; Thu, 18 Feb 2016 03:07:05 -0800 (PST) |
| In-Reply-To | <CA790464-2C9C-4BFE-9BAC-64CBDE4799DB@gmail.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.21rc2 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Xref | csiph.com comp.lang.python:103106 |
Show key headers only | View raw
On Thu, Feb 18, 2016 at 9:57 PM, Cem Karan <cfkaran2@gmail.com> wrote:
> I agree with Chris on all his points. My personal feeling is that Py3 is the way to go for teaching in the future; its just that little bit more consistent across the board. And the things that are confusing are not things that beginners will need to know about.
>
> About the only thing I've read where Py2 has a slight advantage is for scripts where you're suddenly surprised by Py2 starting up when you've been using a Py3 interactive interpreter. For me, I'd probably give my students a block of code that they are asked to copy at the start of their files to test for Py2 or Py3, and to raise an exception on Py2. After that, I just wouldn't worry about it.
>
Another solution is to have a little bit of boilerplate at the shell first:
python3 -m venv env
source env/bin/activate
Then both "python" and "python3" will run the binary from your virtual
environment, and as a side bonus, you get to use pip without root
privileges.
By the way... For bash users, adding this to .bashrc may make venvs a
bit easier to keep straight:
checkdir() {
[ -n "$VIRTUAL_ENV" ] && ! [[ `pwd` =~ `dirname $VIRTUAL_ENV`* ]]
&& echo Deactivating venv $VIRTUAL_ENV... && deactivate
[ -z "$VIRTUAL_ENV" -a -d env ] && echo Activating venv
`pwd`/env... && source env/bin/activate
}
PROMPT_COMMAND=checkdir
(I'm more fluent in Python than in bash, so this is a bit ugly.)
As soon as you change out of the directory that contains your venv,
it'll be deactivated, so you can't accidentally run stuff in the
"wrong" environment. And as soon as you change into a directory that
contains an 'env' subdir, it'll activate it. (Also applies on first
creation; as soon as "python3 -m venv env" returns, this will activate
the env.)
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Rick Johnson <rantingrickjohnson@gmail.com> - 2016-02-02 19:26 -0800
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO John Ladasky <john_ladasky@sbcglobal.net> - 2016-02-02 22:02 -0800
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Bernardo Sulzbach <mafagafogigante@gmail.com> - 2016-02-03 04:07 -0200
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Rick Johnson <rantingrickjohnson@gmail.com> - 2016-02-06 12:54 -0800
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO INADA Naoki <songofacandy@gmail.com> - 2016-02-07 12:02 +0900
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-02-07 16:59 +1100
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Paul Rubin <no.email@nospam.invalid> - 2016-02-06 23:04 -0800
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Rustom Mody <rustompmody@gmail.com> - 2016-02-06 23:31 -0800
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Paul Rubin <no.email@nospam.invalid> - 2016-02-06 23:51 -0800
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Chris Angelico <rosuav@gmail.com> - 2016-02-07 18:58 +1100
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Jason Swails <jason.swails@gmail.com> - 2016-02-08 10:20 -0500
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Christian Gollwitzer <auriocus@gmx.de> - 2016-02-07 08:44 +0100
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Chris Angelico <rosuav@gmail.com> - 2016-02-07 14:06 +1100
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Ian Kelly <ian.g.kelly@gmail.com> - 2016-02-08 08:40 -0700
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Random832 <random832@fastmail.com> - 2016-02-08 10:44 -0500
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO wxjmfauth@gmail.com - 2016-02-09 01:15 -0800
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Chris Angelico <rosuav@gmail.com> - 2016-02-09 02:46 +1100
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Random832 <random832@fastmail.com> - 2016-02-08 10:53 -0500
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Chris Warrick <kwpolska@gmail.com> - 2016-02-08 18:48 +0100
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO John Ladasky <john_ladasky@sbcglobal.net> - 2016-02-11 23:51 -0800
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Rick Johnson <rantingrickjohnson@gmail.com> - 2016-02-15 18:02 -0800
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Chris Angelico <rosuav@gmail.com> - 2016-02-16 13:30 +1100
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO John Ladasky <john_ladasky@sbcglobal.net> - 2016-02-15 21:24 -0800
Guido on python3 for beginners Rustom Mody <rustompmody@gmail.com> - 2016-02-17 00:51 -0800
Re: Guido on python3 for beginners Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-02-18 17:47 +1100
Re: Guido on python3 for beginners Ben Finney <ben+python@benfinney.id.au> - 2016-02-18 17:57 +1100
Re: Guido on python3 for beginners Paul Rubin <no.email@nospam.invalid> - 2016-02-17 22:59 -0800
Re: Guido on python3 for beginners "Sven R. Kunze" <srkunze@mail.de> - 2016-02-18 22:37 +0100
Re: Guido on python3 for beginners Random832 <random832@fastmail.com> - 2016-02-18 02:00 -0500
Re: Guido on python3 for beginners Chris Angelico <rosuav@gmail.com> - 2016-02-18 18:27 +1100
Re: Guido on python3 for beginners John Ladasky <john_ladasky@sbcglobal.net> - 2016-02-18 12:22 -0800
Re: Guido on python3 for beginners INADA Naoki <songofacandy@gmail.com> - 2016-02-18 17:00 +0900
Re: Guido on python3 for beginners Terry Reedy <tjreedy@udel.edu> - 2016-02-18 03:40 -0500
Re: Guido on python3 for beginners Steven D'Aprano <steve@pearwood.info> - 2016-02-20 18:59 +1100
Re: Guido on python3 for beginners Chris Angelico <rosuav@gmail.com> - 2016-02-18 20:57 +1100
Re: Guido on python3 for beginners Cem Karan <cfkaran2@gmail.com> - 2016-02-18 05:57 -0500
Re: Guido on python3 for beginners Chris Angelico <rosuav@gmail.com> - 2016-02-18 22:07 +1100
Re: Guido on python3 for beginners Rustom Mody <rustompmody@gmail.com> - 2016-02-18 04:25 -0800
Re: Guido on python3 for beginners Random832 <random832@fastmail.com> - 2016-02-18 10:51 -0500
Re: Guido on python3 for beginners Steven D'Aprano <steve@pearwood.info> - 2016-02-19 12:17 +1100
Re: Guido on python3 for beginners Rustom Mody <rustompmody@gmail.com> - 2016-02-18 19:39 -0800
Re: Guido on python3 for beginners Steven D'Aprano <steve@pearwood.info> - 2016-02-20 13:36 +1100
Re: Guido on python3 for beginners Larry Hudson <orgnut@yahoo.com> - 2016-02-20 00:37 -0800
Re: Guido on python3 for beginners Grant Edwards <invalid@invalid.invalid> - 2016-02-19 15:06 +0000
Re: Guido on python3 for beginners Rustom Mody <rustompmody@gmail.com> - 2016-02-18 19:32 -0800
Re: Guido on python3 for beginners Matt Wheeler <m@funkyhat.org> - 2016-02-18 16:44 +0000
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO wxjmfauth@gmail.com - 2016-02-17 08:39 -0800
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Christian Gollwitzer <auriocus@gmx.de> - 2016-02-18 22:14 +0100
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Chris Angelico <rosuav@gmail.com> - 2016-02-19 08:54 +1100
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Ian Kelly <ian.g.kelly@gmail.com> - 2016-02-18 21:07 -0700
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO wxjmfauth@gmail.com - 2016-02-19 02:18 -0800
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2016-02-03 09:27 +0100
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Grobu <snailcoder@retrosite.invalid> - 2016-02-03 09:38 +0100
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO wxjmfauth@gmail.com - 2016-02-03 09:16 -0800
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Quivis <quivis@domain.invalid> - 2016-02-06 14:59 +0000
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Ethan Furman <ethan@stoneleaf.us> - 2016-02-18 18:22 -0800
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2016-02-19 10:05 +0000
Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO Terry Reedy <tjreedy@udel.edu> - 2016-02-19 23:15 -0500
csiph-web