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


Groups > comp.lang.python > #52010

Re: Newbie: static typing?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <joshua.landau.ws@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'static': 0.04; 'reason,': 0.07; 'arguments': 0.09; 'happen.': 0.09; 'type,': 0.09; 'python': 0.11; 'behave': 0.16; 'enlighten': 0.16; 'finney': 0.16; 'pythonic': 0.16; 'strong,': 0.16; 'thread,': 0.16; 'threw': 0.16; 'language': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; "python's": 0.19; 'typing': 0.19; 'help.': 0.21; '>>>': 0.22; 'example': 0.22; 'issue.': 0.22; 'error': 0.23; 'sort': 0.25; "i've": 0.25; 'equivalent': 0.26; 'header:In-Reply-To:1': 0.27; 'testing': 0.29; 'message-id:@mail.gmail.com': 0.30; 'writes:': 0.31; 'anyone': 0.31; 'this.': 0.32; 'bugs': 0.33; 'not.': 0.33; 'to:name:python-list': 0.33; 'trouble': 0.34; 'could': 0.34; 'problem': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'raising': 0.36; 'surely': 0.36; 'subject:?': 0.36; 'should': 0.36; 'ben': 0.38; 'handle': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'august': 0.61; 'new': 0.61; 'more': 0.64; 'it!': 0.67; 'enjoy': 0.71; 'pain': 0.84; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=A+tSFwrH3ZUdmfRxKvnHKW5OFoq8lEnA8n2jU/1rrpE=; b=NY8ekIJNmXUNPJ5f8ZfEwexqEx+lUWhtJ4vjtHZyf9jHvShXN+qKm3/nySHjjFGUVs 8oPNxgtocEmpFHiNlbHLFLTkHgnq7YMZeT2gIxwRjbb4S45shGwd4Deo81LdPoQl2sha crOeyxff7lJOApoe/6V/CnshJ95vwlVGOoFohobgywhmysP1XccQLcoRmBhOpnqwk7VK Cw1yx/JyWyZynTwQBygixErU6ZWi+Q00pDqkffv6voeffBrZrffD0ve7YFCqgg9p9qAL uY+mtb5a+gHz4wUfHwGL7ELQIbY1LQLEn8xvNr/uIsp/LkgSPWy7uLP852HmE59s+CfL QVJQ==
X-Received by 10.112.209.2 with SMTP id mi2mr791452lbc.63.1375780835969; Tue, 06 Aug 2013 02:20:35 -0700 (PDT)
MIME-Version 1.0
Sender joshua.landau.ws@gmail.com
In-Reply-To <ktqdkq$v3k$1@dont-email.me>
References <ktp2jh$3a3$1@dont-email.me> <mailman.223.1375749359.1251.python-list@python.org> <ktqdkq$v3k$1@dont-email.me>
From Joshua Landau <joshua@landau.ws>
Date Tue, 6 Aug 2013 10:19:55 +0100
X-Google-Sender-Auth kb1TViC9wAfFY5vfrA3ovYdVaRs
Subject Re: Newbie: static typing?
To python-list <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.232.1375780843.1251.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1375780843 news.xs4all.nl 15867 [2001:888:2000:d::a6]:56391
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:52010

Show key headers only | View raw


On 6 August 2013 10:01, Rui Maciel <rui.maciel@gmail.com> wrote:
> Ben Finney wrote:
>
>> Rui Maciel <rui.maciel@gmail.com> writes:
>>
>>> Is there any pythonic way to perform static typing?
>>
>> I think no; static typing is inherently un-Pythonic.
>>
>> Python provides strong, dynamic typing. Enjoy it!
>
> Bummer.

It's really not.


>>> Does anyone care to enlighten a newbie?
>>
>> Is there some specific problem you think needs static typing? Perhaps
>> you could start a new thread, giving an example where you are having
>> trouble and you think static typing would help.
>
> It would be nice if some functions threw an error if they were passed a type
> they don't support or weren't designed to handle.  That would avoid having
> to deal with some bugs which otherwise would never happen.
>
> To avoid this sort of error, I've been testing arguments passed to some
> functions based on their type, and raising TypeError when necessariy, but
> surely there must be a better, more pythonic way to handle this issue.

Unless you have a very good reason, don't do this. It's a damn pain
when functions won't accept my custom types with equivalent
functionality -- Python's a duck-typed language and it should behave
like one.

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


Thread

Newbie: static typing? Rui Maciel <rui.maciel@gmail.com> - 2013-08-05 21:46 +0100
  Re: Newbie: static typing? Gary Herron <gary.herron@islandtraining.com> - 2013-08-05 14:07 -0700
    Re: Newbie: static typing? Rui Maciel <rui.maciel@gmail.com> - 2013-08-06 10:05 +0100
      Re: Newbie: static typing? Steven D'Aprano <steve@pearwood.info> - 2013-08-06 09:26 +0000
      Re: Newbie: static typing? Joshua Landau <joshua@landau.ws> - 2013-08-06 10:29 +0100
        Re: Newbie: static typing? Rui Maciel <rui.maciel@gmail.com> - 2013-08-06 11:12 +0100
          Re: Newbie: static typing? Burak Arslan <burak.arslan@arskom.com.tr> - 2013-08-06 16:27 +0300
          Re: Newbie: static typing? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-08-06 15:57 +0200
          Re: Newbie: static typing? Chris Angelico <rosuav@gmail.com> - 2013-08-06 15:06 +0100
          Re: Newbie: static typing? "Eric S. Johansson" <esj@harvee.org> - 2013-08-06 09:58 -0400
          Re: Newbie: static typing? Chris Angelico <rosuav@gmail.com> - 2013-08-06 15:38 +0100
      Easier to Ask Forgiveness than Permission (was: Newbie: static typing?) Ben Finney <ben+python@benfinney.id.au> - 2013-08-07 08:23 +1000
  Re: Newbie: static typing? Ian Kelly <ian.g.kelly@gmail.com> - 2013-08-05 17:38 -0600
  Re: Newbie: static typing? Ben Finney <ben+python@benfinney.id.au> - 2013-08-06 10:35 +1000
    Re: Newbie: static typing? Rui Maciel <rui.maciel@gmail.com> - 2013-08-06 10:01 +0100
      Re: Newbie: static typing? Joshua Landau <joshua@landau.ws> - 2013-08-06 10:19 +0100
        Re: Newbie: static typing? Rui Maciel <rui.maciel@gmail.com> - 2013-08-06 11:07 +0100
          Re: Newbie: static typing? Rotwang <sg552@hotmail.co.uk> - 2013-08-06 15:25 +0100
          Re: Newbie: static typing? Ben Finney <ben+python@benfinney.id.au> - 2013-08-07 08:34 +1000
      Re: Newbie: static typing? Chris Angelico <rosuav@gmail.com> - 2013-08-06 10:29 +0100
        Re: Newbie: static typing? Rui Maciel <rui.maciel@gmail.com> - 2013-08-06 11:28 +0100
          Re: Newbie: static typing? Chris Angelico <rosuav@gmail.com> - 2013-08-06 11:50 +0100
          Re: Newbie: static typing? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-08-06 18:54 -0400
          Re: Newbie: static typing? Terry Reedy <tjreedy@udel.edu> - 2013-08-06 19:02 -0400
          Re: Newbie: static typing? Chris Angelico <rosuav@gmail.com> - 2013-08-07 01:16 +0100
          RE: Newbie: static typing? "Prasad, Ramit" <ramit.prasad@jpmorgan.com.dmarc.invalid> - 2013-08-08 16:46 +0000
  Re: Newbie: static typing? Steven D'Aprano <steve@pearwood.info> - 2013-08-06 05:21 +0000
    Re: Newbie: static typing? Rui Maciel <rui.maciel@gmail.com> - 2013-08-06 10:04 +0100
  Re: Newbie: static typing? Grant Edwards <invalid@invalid.invalid> - 2013-08-06 15:05 +0000

csiph-web