Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #94925
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.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 | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.022 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; 'subject:Python': 0.05; '*not*': 0.07; 'suppress': 0.07; 'cc:addr:python-list': 0.09; 'none"': 0.09; 'python': 0.10; 'def': 0.13; '7:58': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hint': 0.16; 'integers.': 0.16; 'wrote:': 0.16; 'instance,': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'aug': 0.20; 'explicit': 0.22; 'code.': 0.23; 'third-party': 0.23; 'this:': 0.23; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'message-id:@mail.gmail.com': 0.27; 'function': 0.28; 'cases.': 0.29; 'dictionary': 0.29; 'allows': 0.30; 'that.': 0.30; 'code': 0.30; 'branch': 0.30; "i'd": 0.31; 'another': 0.32; 'maybe': 0.33; 'run': 0.33; 'common': 0.33; 'received:google.com': 0.35; 'maps': 0.35; 'possible,': 0.35; 'returning': 0.35; 'quite': 0.35; "isn't": 0.35; 'but': 0.36; 'should': 0.36; 'there': 0.36; 'cases': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'method': 0.37; 'things': 0.38; 'no,': 0.38; 'anything': 0.38; 'end': 0.39; 'means': 0.39; 'enough': 0.39; 'easily': 0.39; 'where': 0.40; 'still': 0.40; 'some': 0.40; 'easy': 0.60; 'your': 0.60; "you'll": 0.61; 'more': 0.63; 'guides': 0.72; 'checker': 0.84; 'chrisa': 0.84; 'subject:Become': 0.84; 'to:none': 0.91; 'subject:Now': 0.91; 'suffer': 0.93; 'thing,': 0.93 |
| 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; bh=C4eAWkXKyviB0Xsc3Cm+Dro9tbsEWyjDaSLCpofIztg=; b=Z8l5s7nZGLGE8JAnyk3n+men1/dP4fi93Io4ag3D8uZPQoFDbjVmxn1f9QjiFVb2zv IrCV1OMx4nT42jsS/bYKbXx+XpNNhHIcu12dexSa6STNdS/y2/wnIPPVmshCUs2sEiU3 Fk8rSpsLc2aEf9f/cw1Bmmnm9srS14susnYJ2ihRyMJHvJnjaTUh7zeW/fMkXXWHpK8O mZzrBfp8HLJlCY3hg/V4Mzuz5UJuCdoNpa8/cUvZjV+rX5S0Fc/SwDXmh3XnF0CyUuZV iKm17mtlHb7eYLcjUreEukB+Gs+GRgQsbfwiheZ2KirjQ9D82ZC5a1ZmpIPvNt+r3/rA zgTw== |
| MIME-Version | 1.0 |
| X-Received | by 10.107.12.141 with SMTP id 13mr18076434iom.157.1438597701995; Mon, 03 Aug 2015 03:28:21 -0700 (PDT) |
| In-Reply-To | <427038102.1314110.1438595894636.JavaMail.root@sequans.com> |
| References | <mpmcdb$eek$1@ger.gmane.org> <427038102.1314110.1438595894636.JavaMail.root@sequans.com> |
| Date | Mon, 3 Aug 2015 20:28:21 +1000 |
| Subject | Re: Python 3 May Become Relevant Now |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| 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.1175.1438597704.3674.python-list@python.org> (permalink) |
| Lines | 33 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1438597704 news.xs4all.nl 2942 [2001:888:2000:d::a6]:41365 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:94925 |
Show key headers only | View raw
On Mon, Aug 3, 2015 at 7:58 PM, Jean-Michel Pichavant
<jeanmichel@sequans.com> wrote:
> But if I get things right, with python 3.5 type hint checker, I'd be screwed, as it is spefificaly designed to track this kind of "problem".
> What's the use of None then ? Any method returning None can only return None or suffer the type checker retribution.
1) Python 3.5 will not include a type checker. All it'll include is
enough stubs that your code will run correctly; plus it has a set of
specifications for how third-party checkers should be advised, which
means you'll be able to use any such checker with the same code. But
nothing will happen till you actually run such a checker.
2) Since "returns X or None" is such a common thing, it's very easy to
spell. More complicated things are possible, too, but less cleanly.
Python still allows you to return anything from anything, and that
isn't changing; but there are a number of common cases - for instance,
this function might always return a number, or maybe it'll always
return a dictionary that maps strings to integers. Those are easily
spelled.
So no, a method that can return None is most definitely *not* required
to return None in all cases. Although you may find that some linters
and code style guides object to code like this:
def some_function(some_arg):
if some_condition:
return some_expression
where one branch has an explicit 'return' and another doesn't. That's
a quite reasonable objection, and an explicit "return None" at the end
will suppress the warning, by being more explicit that this might
return this or that.
ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Python 3 May Become Relevant Now Chris Angelico <rosuav@gmail.com> - 2015-08-03 20:28 +1000
csiph-web