Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.mixmin.net!feed.xsnews.nl!border-1.ams.xsnews.nl!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'explicitly': 0.04; 'subject:Python': 0.05; 'run-time': 0.05; '(especially': 0.07; 'compile-time': 0.07; 'correct.': 0.07; 'linear': 0.07; 'puts': 0.07; 'python': 0.09; "object's": 0.09; 'objects.': 0.09; 'runtime': 0.09; 'subclass': 0.09; 'typed': 0.09; 'weak': 0.09; 'cc:addr:python-list': 0.10; 'static': 0.13; 'yet.': 0.13; 'language': 0.14; '(the': 0.15; '"here': 0.16; 'enough.': 0.16; 'filename:fname piece:signature': 0.16; 'sorts': 0.16; 'subject:Objects': 0.16; 'view)': 0.16; 'string': 0.17; 'wrote:': 0.17; 'pointed': 0.17; 'typing': 0.17; 'variables': 0.17; '(in': 0.18; '(or': 0.18; 'java': 0.21; 'latter': 0.22; 'void': 0.22; 'cc:2**0': 0.23; 'example': 0.23; 'programming': 0.23; 'class.': 0.23; 'statement': 0.23; "haven't": 0.23; 'raise': 0.24; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In- Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'first,': 0.27; 'instead.': 0.27; 'strongly': 0.27; 'structures': 0.27; 'actual': 0.28; 'post': 0.28; 'implicitly': 0.29; 'respects': 0.29; 'second,': 0.29; 'case,': 0.29; 'probably': 0.29; "i'm": 0.29; '(from': 0.30; 'checks': 0.30; 'e.g.': 0.30; 'ease': 0.30; 'point': 0.31; '(and': 0.32; 'says': 0.33; 'code:': 0.33; 'languages': 0.33; "can't": 0.34; 'list': 0.35; 'ben': 0.35; 'replaced': 0.35; 'said,': 0.35; 'pm,': 0.35; 'sometimes': 0.35; 'there': 0.35; 'add': 0.36; 'really': 0.36; 'but': 0.36; 'others.': 0.36; 'useful': 0.36; 'should': 0.36; 'possible': 0.37; 'two': 0.37; 'rather': 0.37; 'subject:: ': 0.38; 'perform': 0.38; 'object': 0.38; 'some': 0.38; 'things': 0.38; 'sure': 0.38; 'instead': 0.39; 'takes': 0.39; 'where': 0.40; 'skip:" 10': 0.40; 'think': 0.40; 'your': 0.60; 'most': 0.61; 'you.': 0.61; "you've": 0.61; 'first': 0.61; 'kind': 0.61; 'between': 0.63; 'respect': 0.63; 'different': 0.63; 'more': 0.63; 'show': 0.63; 'here': 0.65; "'foo'": 0.84; '*really*': 0.84; 'distinguish': 0.84; 'me;': 0.84; 'pierce': 0.84; 'to:addr:yahoo.co.uk': 0.84; 'analyses': 0.91; 'kat': 0.91; 'imagine': 0.96 Date: Wed, 22 Aug 2012 14:03:30 -0500 From: Evan Driscoll User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.6esrpre) Gecko/20120714 Thunderbird/10.0.6 MIME-Version: 1.0 To: lipska the kat Subject: Re: Re: Objects in Python References: <18409992-1e28-4721-8e64-60c69668da4e@googlegroups.com> In-Reply-To: X-Enigmail-Version: 1.4 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigCB12A05320373DCF5D93DC8D" Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 98 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1345662881 news.xs4all.nl 6874 [2001:888:2000:d::a6]:46136 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27675 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigCB12A05320373DCF5D93DC8D Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 08/22/2012 12:46 PM, lipska the kat wrote: > If you can show me a 'type' that cannot be assigned to >=20 > a >=20 > in the same scope then I would be most interested to know, I haven't > found one yet. As other people have said, you've just pointed out the difference between static typing and dynamic typing -- and how the former types variables (or "names") and the latter types objects. I just have a few things to add to your post and others. First, from some point of view, you're correct. From a type theory point of view "dynamically typed" is an oxymoron, because *by definition* (from this point of view) types are a property of variables (and expressions). For example, Ben Pierce says (in "Types and Programming Languages"): The word "static" is sometimes added explicitly...to distinguish the sorts of compile-time analyses we are considering here from the dynamic or latent typing found in languages such as Scheme, where run-time type tags are used to distinguish different kinds of structures in the heap. Terms like "dynamically typed" are arguably misnomers and should probably be replaced by "dynamically checked," but the usage is standard. (And the usage is standard because it's just really useful to be able to say "dynamically-typed" instead of "uni-typed with runtime checks of things that act like types". (I don't think Pierce's "dynamically checked" is specific enough. :-)) Second, this concept isn't *so* unfamiliar to you. If I give you the following Java code: void foo(Object o) { ... } and ask what type 'o' is, there are kind of two answers. The first is that 'o' is an 'Object'. But you can't make an Object -- that's an abstract class. (IIRC. If it's not then just bear with me; you get the idea. :-)) So from a strictly static type-theory point of view, 'foo' is unusable because it takes a type which you can never create. But of course that's not the case, because in actual Java 'o' has some dynamic type which is a subclass of 'Object'. Though I'm sure this statement will be *really* popular with this list , if it puts your mind at ease a little, you can imagine that there are no primitive types and Python names all have type 'Object', but that you can refer to the functions in an object's dynamic type without explicitly downcasting. (The analogy isn't perfect.) On 08/22/2012 01:15 PM, Ian Kelly wrote: > The classic example of weak typing is concatenation of strings and > numbers, e.g. ("abc" + 123). Weakly typed languages like JavaScript > will implicitly coerce the number to a string and perform the > concatenation. Strongly typed languages like Python will raise a > TypeError instead. I would also say don't get *too* caught up in categorizing everything into "strong" and "weak"; that's a spectrum, and where things fall is a lot more interesting than just "here or there". Really it's even more complex than just a linear spectrum -- Language A can be stronger than Language B in one respect but weaker in another. In particular, it's possible to have rather stronger typing than Python (especially with respect to Booleans, but in some other respects as well)= =2E Evan --------------enigCB12A05320373DCF5D93DC8D Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEVAwUBUDUtCAOzoR8eZTzgAQI5fQf+JGJGss3/zHa80wTS64z5suZAzdPJ2DKx o9OqXuA1Z+eL7xe4bztFVelEKM2cycAdZXuGX1oURzlK8TPWygCSm0a9PmS8zXxG 1LTCUCJSDon9iyUFmX3GJJf+bK3cQVXQj+ZYKHWxwI70AV6h9SgC4MFhamY0Itm/ NuUPn5cjiYh2j5C6klYYyQXFHIH2Eqh8PhRTrHnXQlhQmCQNvbMPvxNXB2Xo8sFT mlPXCvl/jA1GxDhmdVCNjuwMqrsu3gqu6wHFdGPO89+JV9epwH+41tM1vo/a8IEf UYuLtV/SwRori5ZiBkb/0SZhBrCJc7wAC6LxC3cl4VOefTTQE9PBRw== =zsXj -----END PGP SIGNATURE----- --------------enigCB12A05320373DCF5D93DC8D--