Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #72815
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!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.006 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'true,': 0.05; 'assign': 0.07; 'float': 0.07; 'url:activestate': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'c-level': 0.16; 'fiddle': 0.16; 'foo()': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'it".': 0.16; 'exception': 0.16; 'language': 0.16; 'wrote:': 0.18; "python's": 0.19; '>>>': 0.22; 'memory': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'class.': 0.26; 'long,': 0.26; 'shown': 0.26; 'header:In-Reply- To:1': 0.27; 'specifically': 0.29; 'chris': 0.29; 'feature': 0.29; 'am,': 0.29; 'url:code': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'types.': 0.31; 'fri,': 0.33; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'instances': 0.36; 'possible': 0.36; 'clear': 0.37; 'pm,': 0.38; 'rather': 0.38; 'changed': 0.39; 'how': 0.40; 'around.': 0.60; 'back': 0.62; 'different': 0.65; 'within': 0.65; 'real-world': 0.68; 'subject:This': 0.74; '3.4': 0.84; '9:02': 0.84; 'limits,': 0.84; 'win32:': 0.84; 'to:none': 0.92 |
| 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=CL498L66k++oLIG34nlwt6EOcXW9U6SrVRrCwOfTokM=; b=q81KJ87k4/r1y2bxbEAgaQTRXNerZY/e0tWM8Un1LqTJ66pwrveiS0lyvThf3nEdKH dGjAtcYjJjHC7h04gu+ZhYZf3765u0LM4BU2vRJv9Bpd8TkLOllDFLUBPV68KEBgfSp2 TFLKbc4B1Qtf+It27P58p5cWwR7gxak7ChY9FHmSP4eyJi3ZaB9kLOl+YHNMvqDDwSQC BcJ3FXUymxlCMKJ07u3By3IIy957bx82J50thQ5EMLZOzTQZwIlulcEnDj32/AtHEld7 sQ2J0Xlb6emWno9SboCm093OqIuS/HFGHaRIDcfQEibyJDf0+mJO5GRdZwdgE7GYEEFf LIxw== |
| MIME-Version | 1.0 |
| X-Received | by 10.220.92.135 with SMTP id r7mr1687533vcm.11.1402025247469; Thu, 05 Jun 2014 20:27:27 -0700 (PDT) |
| In-Reply-To | <53913292$0$29978$c3e8da3$5496439d@news.astraweb.com> |
| References | <87tx7zi0i1.fsf@dpt-info.u-strasbg.fr> <252650940423701065.252693sturla.molden-gmail.com@news.gmane.org> <mailman.10786.1402010495.18130.python-list@python.org> <53913292$0$29978$c3e8da3$5496439d@news.astraweb.com> |
| Date | Fri, 6 Jun 2014 13:27:27 +1000 |
| Subject | Re: OT: This Swift thing |
| 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.15 |
| 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.10804.1402025249.18130.python-list@python.org> (permalink) |
| Lines | 39 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1402025249 news.xs4all.nl 2858 [2001:888:2000:d::a6]:43383 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:72815 |
Show key headers only | View raw
On Fri, Jun 6, 2014 at 1:16 PM, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > On Fri, 06 Jun 2014 09:21:26 +1000, Chris Angelico wrote: > >> On Fri, Jun 6, 2014 at 9:02 AM, Sturla Molden <sturla.molden@gmail.com> >> wrote: >>> You cannot spoof the type of an object in Python. >> >> Not without fiddling around. Python 3.4 on win32: > [...] >>>>> x = Foo() >>>>> x.spam() >> <__main__.Foo object at 0x0169AB10> spams >>>>> x.__class__ = Bar >>>>> x.spam() >> <__main__.Bar object at 0x0169AB10> eats spam >> >> The thing has the same id (as shown in its repr), but has changed class. > > That's not spoofing types. That is a language feature: within limits, > instances can change their type. It has been around for a long, long > time, back to Python 1.5 or older, and it has real-world use-cases: > > http://code.activestate.com/recipes/68429-ring-buffer/ True, it's not *spoofing*, in the same way that this C code is: float x = 3.14159; int y = *(int *)&x; And I'm aware that it's a language feature (why else would it be specifically limited with a clear exception when you try to assign something you can't?). So's the C-level fiddling, albeit for different reasons and in different ways. Anyway, I was broadly agreeing - Python's type system is "objects have types", rather than "stuff is in memory and data types are just how you look at it". It just happens to be possible to fiddle if you want to :) ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
OT: This Swift thing Sturla Molden <sturla.molden@gmail.com> - 2014-06-03 17:28 +0000
Re: OT: This Swift thing Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-06-05 10:14 +0200
Re: OT: This Swift thing Chris Angelico <rosuav@gmail.com> - 2014-06-05 18:38 +1000
Re: OT: This Swift thing Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-06-05 11:42 +0200
Re: OT: This Swift thing Chris Angelico <rosuav@gmail.com> - 2014-06-05 22:48 +1000
Re: OT: This Swift thing Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-06-05 22:27 +0200
Re: OT: This Swift thing Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-06-05 22:28 +0100
Re: OT: This Swift thing Sturla Molden <sturla.molden@gmail.com> - 2014-06-05 23:03 +0000
Re: OT: This Swift thing Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-06-06 13:21 +0200
Re: OT: This Swift thing Sturla Molden <sturla.molden@gmail.com> - 2014-06-07 01:54 +0000
Re: OT: This Swift thing Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-06-07 10:20 +0200
Re: OT: This Swift thing Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-06-07 09:32 +0100
Re: OT: This Swift thing Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-06-07 11:54 +0200
Re: OT: This Swift thing Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-06-15 10:55 +0200
Re: OT: This Swift thing Roy Smith <roy@panix.com> - 2014-06-07 08:52 -0400
Re: OT: This Swift thing Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-06-07 11:13 -0400
Re: OT: This Swift thing Roy Smith <roy@panix.com> - 2014-06-07 11:54 -0400
Re: OT: This Swift thing Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-06-07 17:10 -0400
Re: OT: This Swift thing Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-07 23:32 +0000
Re: OT: This Swift thing Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-06-06 00:41 +0100
Re: OT: This Swift thing Sturla Molden <sturla.molden@gmail.com> - 2014-06-06 01:54 +0200
Re: OT: This Swift thing Roy Smith <roy@panix.com> - 2014-06-05 20:13 -0400
Re: OT: This Swift thing Sturla Molden <sturla.molden@gmail.com> - 2014-06-06 02:35 +0200
Re: OT: This Swift thing Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-06 05:45 +0000
Re: OT: This Swift thing Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-06-06 13:39 +0200
Re: OT: This Swift thing Sturla Molden <sturla.molden@gmail.com> - 2014-06-07 01:54 +0000
Re: OT: This Swift thing Sturla Molden <sturla.molden@gmail.com> - 2014-06-06 02:03 +0200
Re: OT: This Swift thing wxjmfauth@gmail.com - 2014-06-05 02:09 -0700
Re: OT: This Swift thing Sturla Molden <sturla.molden@gmail.com> - 2014-06-05 16:10 +0200
Re: OT: This Swift thing Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-06-05 22:07 +0200
Re: OT: This Swift thing Chris Angelico <rosuav@gmail.com> - 2014-06-06 06:18 +1000
Re: OT: This Swift thing Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-06-05 23:12 +0200
Re: OT: This Swift thing Sturla Molden <sturla.molden@gmail.com> - 2014-06-05 23:02 +0000
Re: OT: This Swift thing Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-06-05 22:23 +0100
Re: OT: This Swift thing Marko Rauhamaa <marko@pacujo.net> - 2014-06-06 00:53 +0300
Re: OT: This Swift thing Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-06-05 23:13 +0100
Re: OT: This Swift thing Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-06 02:52 +0000
Re: OT: This Swift thing Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-06-15 11:33 +0200
Re: OT: This Swift thing Marko Rauhamaa <marko@pacujo.net> - 2014-06-15 16:10 +0300
Re: OT: This Swift thing Chris Angelico <rosuav@gmail.com> - 2014-06-06 07:36 +1000
Re: OT: This Swift thing Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-06-06 13:20 +0200
Re: OT: This Swift thing Chris Angelico <rosuav@gmail.com> - 2014-06-06 22:23 +1000
Re: OT: This Swift thing Christian Gollwitzer <auriocus@gmx.de> - 2014-06-07 09:30 +0200
Re: OT: This Swift thing Terry Reedy <tjreedy@udel.edu> - 2014-06-05 18:18 -0400
Re: OT: This Swift thing Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-06-06 13:11 +0200
Re: OT: This Swift thing Terry Reedy <tjreedy@udel.edu> - 2014-06-06 13:06 -0400
Re: OT: This Swift thing alex23 <wuwei23@gmail.com> - 2014-06-10 15:32 +1000
Re: OT: This Swift thing Sturla Molden <sturla.molden@gmail.com> - 2014-06-05 23:02 +0000
Re: OT: This Swift thing Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-05 23:08 +0000
Re: OT: This Swift thing Sturla Molden <sturla.molden@gmail.com> - 2014-06-05 23:08 +0000
Re: OT: This Swift thing Chris Angelico <rosuav@gmail.com> - 2014-06-06 09:21 +1000
Re: OT: This Swift thing Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-06 03:16 +0000
Re: OT: This Swift thing Chris Angelico <rosuav@gmail.com> - 2014-06-06 13:27 +1000
Re: OT: This Swift thing Michael Torrie <torriem@gmail.com> - 2014-06-05 08:33 -0600
Re: OT: This Swift thing Chris Angelico <rosuav@gmail.com> - 2014-06-06 01:44 +1000
Re: OT: This Swift thing Sturla Molden <sturla.molden@gmail.com> - 2014-06-05 18:09 +0200
Re: OT: This Swift thing Michael Torrie <torriem@gmail.com> - 2014-06-05 11:18 -0600
Re: OT: This Swift thing Mark H Harris <harrismh777@gmail.com> - 2014-06-05 13:49 -0500
Re: OT: This Swift thing Travis Griggs <travisgriggs@gmail.com> - 2014-06-05 23:28 -0700
Re: OT: This Swift thing Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2014-06-06 10:25 +0200
Re: OT: This Swift thing Michael Torrie <torriem@gmail.com> - 2014-06-06 20:41 -0600
Re: OT: This Swift thing Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-07 04:57 +0000
Re: OT: This Swift thing Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-06-07 11:23 -0400
Re: OT: This Swift thing Roy Smith <roy@panix.com> - 2014-06-07 11:51 -0400
Re: OT: This Swift thing Marko Rauhamaa <marko@pacujo.net> - 2014-06-07 19:18 +0300
Re: OT: This Swift thing MRAB <python@mrabarnett.plus.com> - 2014-06-08 15:10 +0100
Re: OT: This Swift thing Michael Torrie <torriem@gmail.com> - 2014-06-07 11:37 -0600
Re: OT: This Swift thing Roy Smith <roy@panix.com> - 2014-06-07 14:11 -0400
Re: OT: This Swift thing Michael Torrie <torriem@gmail.com> - 2014-06-07 13:00 -0600
Re: OT: This Swift thing Roy Smith <roy@panix.com> - 2014-06-07 15:11 -0400
Re: OT: This Swift thing Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-06-07 17:59 -0400
Re: OT: This Swift thing Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-06-08 13:25 +1200
Re: OT: This Swift thing Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-07 23:38 +0000
Re: OT: This Swift thing Roy Smith <roy@panix.com> - 2014-06-07 20:09 -0400
Re: OT: This Swift thing Chris Angelico <rosuav@gmail.com> - 2014-06-08 10:37 +1000
Re: OT: This Swift thing Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-08 03:50 +0000
Re: OT: This Swift thing Roy Smith <roy@panix.com> - 2014-06-08 10:51 -0400
Re: OT: This Swift thing Gene Heskett <gheskett@wdtv.com> - 2014-06-08 11:21 -0400
Re: OT: This Swift thing Roy Smith <roy@panix.com> - 2014-06-08 12:09 -0400
Re: OT: This Swift thing Gene Heskett <gheskett@wdtv.com> - 2014-06-08 13:14 -0400
Re: OT: This Swift thing Chris Angelico <rosuav@gmail.com> - 2014-06-09 03:25 +1000
Re: OT: This Swift thing Sturla Molden <sturla.molden@gmail.com> - 2014-06-08 18:09 +0000
Re: OT: This Swift thing Chris Angelico <rosuav@gmail.com> - 2014-06-09 04:16 +1000
Re: OT: This Swift thing Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-09 01:44 +0000
Re: OT: This Swift thing Rustom Mody <rustompmody@gmail.com> - 2014-06-08 19:24 -0700
Re: OT: This Swift thing Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-09 04:20 +0000
Re: OT: This Swift thing Rustom Mody <rustompmody@gmail.com> - 2014-06-08 23:32 -0700
Re: OT: This Swift thing Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-09 09:27 +0000
Re: OT: This Swift thing Rustom Mody <rustompmody@gmail.com> - 2014-06-09 04:51 -0700
Re: OT: This Swift thing Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-06-11 19:41 +1200
Re: OT: This Swift thing Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-11 13:44 +0000
Re: OT: This Swift thing Rustom Mody <rustompmody@gmail.com> - 2014-06-11 08:28 -0700
Re: OT: This Swift thing Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-12 02:08 +0000
Re: OT: This Swift thing Chris Angelico <rosuav@gmail.com> - 2014-06-12 12:16 +1000
Re: OT: This Swift thing Steven D'Aprano <steve@pearwood.info> - 2014-06-12 09:06 +0000
Re: OT: This Swift thing alister <alister.nospam.ware@ntlworld.com> - 2014-06-12 09:34 +0000
Re: OT: This Swift thing Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-06-12 23:32 +1200
Re: OT: This Swift thing Anssi Saari <as@sci.fi> - 2014-06-16 13:57 +0300
Re: OT: This Swift thing Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-06-17 10:12 +1200
Re: OT: This Swift thing Chris Angelico <rosuav@gmail.com> - 2014-06-17 08:34 +1000
Re: OT: This Swift thing alister <alister.nospam.ware@ntlworld.com> - 2014-06-17 11:16 +0000
Re: OT: This Swift thing Bob Martin <bob.martin@excite.com> - 2014-06-18 07:41 +0100
Re: OT: This Swift thing Rustom Mody <rustompmody@gmail.com> - 2014-06-12 05:54 -0700
Re: OT: This Swift thing Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-12 17:04 +0000
Re: OT: This Swift thing Chris Angelico <rosuav@gmail.com> - 2014-06-13 03:18 +1000
Re: OT: This Swift thing Rustom Mody <rustompmody@gmail.com> - 2014-06-12 18:59 -0700
Re: OT: This Swift thing Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-13 03:26 +0000
Re: OT: This Swift thing Gene Heskett <gheskett@wdtv.com> - 2014-06-12 14:43 -0400
Re: OT: This Swift thing albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-06-27 23:21 +0000
Re: OT: This Swift thing Joshua Landau <joshua@landau.ws> - 2014-06-15 02:51 +0100
Re: OT: This Swift thing Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-15 03:33 +0000
Re: OT: This Swift thing Gene Heskett <gheskett@wdtv.com> - 2014-06-09 10:11 -0400
Re: OT: This Swift thing Marko Rauhamaa <marko@pacujo.net> - 2014-06-09 17:27 +0300
Re: OT: This Swift thing Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-06-11 18:56 +1200
Re: OT: This Swift thing Roy Smith <roy@panix.com> - 2014-06-09 09:14 -0400
Re: OT: This Swift thing Michael Torrie <torriem@gmail.com> - 2014-06-09 07:56 -0600
Re: OT: This Swift thing Marko Rauhamaa <marko@pacujo.net> - 2014-06-09 17:30 +0300
Re: OT: This Swift thing Rustom Mody <rustompmody@gmail.com> - 2014-06-08 19:35 -0700
Re: OT: This Swift thing Chris Angelico <rosuav@gmail.com> - 2014-06-09 12:23 +1000
Re: OT: This Swift thing Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-06-11 19:50 +1200
Re: OT: This Swift thing Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-11 12:34 +0000
Re: OT: This Swift thing Roy Smith <roy@panix.com> - 2014-06-11 08:48 -0400
Re: OT: This Swift thing Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-06-11 20:17 -0400
Re: OT: This Swift thing Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-06-12 01:25 +0000
Re: OT: This Swift thing Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-06-12 14:11 +1200
Re: OT: This Swift thing Gene Heskett <gheskett@wdtv.com> - 2014-06-11 23:06 -0400
Re: OT: This Swift thing Roy Smith <roy@panix.com> - 2014-06-13 08:55 -0400
Re: OT: This Swift thing Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-06-09 21:51 -0400
Re: OT: This Swift thing Carlos Anselmo Dias <carlos@premium-sponsor.com> - 2014-06-08 18:56 +0100
Re: OT: This Swift thing Sturla Molden <sturla.molden@gmail.com> - 2014-06-08 23:34 +0000
Re: OT: This Swift thing Rustom Mody <rustompmody@gmail.com> - 2014-06-08 19:32 -0700
Re: OT: This Swift thing Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-06-08 13:09 +1200
csiph-web