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


Groups > comp.lang.python > #93858

Re: Improve usage of Python 3

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'anyway.': 0.04; 'subject:Python': 0.05; 'builtins': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'example:': 0.10; 'python': 0.10; 'jan': 0.11; 'def': 0.13; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'statement.': 0.16; 'subject:usage': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'changes': 0.20; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'chris': 0.26; 'said,': 0.27; '**kwargs)': 0.29; '**kwargs):': 0.29; 'print': 0.30; 'probably': 0.31; 'add': 0.34; 'something': 0.35; 'but': 0.36; 'project': 0.36; 'there': 0.36; 'to:addr :python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'anything': 0.38; 'means': 0.39; 'to:addr:python.org': 0.40; 'here': 0.66; 'decided': 0.66; 'about,': 0.84; 'received:fios.verizon.net': 0.91; 'many,': 0.93; 'refuse': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: Improve usage of Python 3
Date Wed, 15 Jul 2015 05:33:31 -0400
References <55A538C9.5050509@gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-98-114-97-173.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0
In-Reply-To <55A538C9.5050509@gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
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>
Newsgroups comp.lang.python
Message-ID <mailman.533.1436952850.3674.python-list@python.org> (permalink)
Lines 47
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1436952850 news.xs4all.nl 2888 [2001:888:2000:d::a6]:45660
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:93858

Show key headers only | View raw


On 7/14/2015 12:28 PM, Marcos wrote:
> Hi!
>
> Just like many, I want the projects in which I work on to move to Python 3.
>
> And incredibly, there are a few users on the same project who refuse to
> use python 3 simply because of the print statement.
>
> That has probably already been discussed, but since I actually couldn't
> find anything relevant about, I decided to ask here anyway.
>
> What are the changes of something like
>
> from __past__ import print_statement

0

> or to make both
>
> print

This already works, like any other name
 >>> print
<built-in function print>

To add to what Chris said, this means that print can be rebound just 
like any other name.  For example:

 >>> import builtins
 >>> builtins.print
<built-in function print>
 >>> def print(*args, **kwargs):
	kwargs['sep'] = '|'
	builtins.print(*args, **kwargs)

 >>> print(1,2,3)
1|2|3

> and
>
> print()
>
> work on Python 3 ?

-- 
Terry Jan Reedy

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


Thread

Re: Improve usage of Python 3 Terry Reedy <tjreedy@udel.edu> - 2015-07-15 05:33 -0400

csiph-web