Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'prevents': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'typed': 0.09; 'python': 0.11; '[1].': 0.16; '[2].': 0.16; 'expecting': 0.16; 'integer,': 0.16; 'objects.': 0.16; 'ought': 0.16; 'overriding': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'variables,': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'integer': 0.24; 'pass': 0.26; 'header:X-Complaints-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'accidentally': 0.31; 'objects': 0.35; 'there': 0.35; 'c++': 0.36; 'raising': 0.36; 'method': 0.36; 'list': 0.37; 'to:addr:python-list': 0.38; 'list,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'called': 0.40; 'different': 0.65; 'risk': 0.72; 'subject:This': 0.74; "class's": 0.84; 'float,': 0.84; 'hopes': 0.91; 'mistakenly': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Sturla Molden Subject: Re: OT: This Swift thing Date: Thu, 5 Jun 2014 23:08:19 +0000 (UTC) References: <87tx7zi0i1.fsf@dpt-info.u-strasbg.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 109-130-11.connect.netcom.no User-Agent: NewsTap/4.0.1 (iPad) X-: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1402009809 news.xs4all.nl 2833 [2001:888:2000:d::a6]:37708 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:72786 Chris Angelico wrote: > "Type safety" means many different things to different people. What > Python has is untyped variables, and hierarchically typed objects. > It's impossible to accidentally treat an integer as a float, and have > junk data [1]. It's impossible to accidentally call a base class's > method when you ought to have called the overriding method in the > subclass, which is a risk in C++ [2]. Exactly. I have no hopes that those who claim Python lacks type safety will understand this, however. > If you mistakenly pass a list to > a function that was expecting an integer, that function will *know* > that it got a list, because objects in Python are rigidly typed. And then there is nothing that prevents the function from raising a TypeError. Sturla