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


Groups > comp.lang.python > #91576 > unrolled thread

Everything is an object in python - object class and type class

Started byEddilbert Macharia <edd.cowan@gmail.com>
First post2015-05-31 07:34 -0700
Last post2015-06-03 06:17 -0700
Articles 20 on this page of 100 — 20 participants

Back to article view | Back to comp.lang.python


Contents

  Everything is an object in python - object class and type class Eddilbert Macharia <edd.cowan@gmail.com> - 2015-05-31 07:34 -0700
    Re: Everything is an object in python - object class and type class Marco Buttu <marco.buttu@gmail.com> - 2015-05-31 17:13 +0200
    Re: Everything is an object in python - object class and type class Terry Reedy <tjreedy@udel.edu> - 2015-05-31 11:37 -0400
    Re: Everything is an object in python - object class and type class Steven D'Aprano <steve@pearwood.info> - 2015-06-01 04:00 +1000
      Re: Everything is an object in python - object class and type class "Dr. Bigcock" <dreamingforward@gmail.com> - 2015-06-01 10:35 -0700
    Re: Everything is an object in python - object class and type class Eddilbert Macharia <edd.cowan@gmail.com> - 2015-05-31 17:29 -0700
      Re: Everything is an object in python - object class and type class Steven D'Aprano <steve@pearwood.info> - 2015-06-01 14:09 +1000
    Re: Everything is an object in python - object class and type class Eddilbert Macharia <edd.cowan@gmail.com> - 2015-05-31 20:09 -0700
      Re: Everything is an object in python - object class and type class Steven D'Aprano <steve@pearwood.info> - 2015-06-01 14:24 +1000
    Re: Everything is an object in python - object class and type class Eddilbert Macharia <edd.cowan@gmail.com> - 2015-06-01 05:03 -0700
      Re: Everything is an object in python - object class and type class BartC <bc@freeuk.com> - 2015-06-01 23:59 +0100
        Re: Everything is an object in python - object class and type class BartC <bc@freeuk.com> - 2015-06-02 11:45 +0100
          Re: Everything is an object in python - object class and type class Rustom Mody <rustompmody@gmail.com> - 2015-06-02 04:16 -0700
        Re: Everything is an object in python - object class and type class Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-02 09:09 -0600
      Re: Everything is an object in python - object class and type class TheDoctor <dreamingforward@gmail.com> - 2015-06-01 17:24 -0700
        Re: Everything is an object in python - object class and type class Chris Angelico <rosuav@gmail.com> - 2015-06-02 10:32 +1000
          Re: Everything is an object in python - object class and type class TheDoctor <dreamingforward@gmail.com> - 2015-06-01 18:02 -0700
            Re: Everything is an object in python - object class and type class Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-02 16:30 +1000
          Re: Everything is an object in python - object class and type class TheDoctor <dreamingforward@gmail.com> - 2015-06-01 18:15 -0700
            Re: Everything is an object in python - object class and type class Chris Angelico <rosuav@gmail.com> - 2015-06-02 11:30 +1000
            Re: Everything is an object in python - object class and type class random832@fastmail.us - 2015-06-02 00:13 -0400
            Re: Everything is an object in python - object class and type class Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-02 16:23 +1000
        Re: Everything is an object in python - object class and type class Rustom Mody <rustompmody@gmail.com> - 2015-06-01 20:15 -0700
          Re: Everything is an object in python - object class and type class Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-02 04:46 +0100
          Re: Everything is an object in python - object class and type class TheDoctor <dreamingforward@gmail.com> - 2015-06-01 21:47 -0700
            Re: Everything is an object in python - object class and type class Rustom Mody <rustompmody@gmail.com> - 2015-06-01 22:01 -0700
              Religion [was Re: Everything is an object in python - object class and type class] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-02 16:04 +1000
                Re: Religion [was Re: Everything is an object in python - object class and type class] Rustom Mody <rustompmody@gmail.com> - 2015-06-01 23:17 -0700
                Re: Religion [was Re: Everything is an object in python - object class and type class] Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-02 07:20 +0100
        Re: Everything is an object in python - object class and type class random832@fastmail.us - 2015-06-02 00:08 -0400
          Re: Everything is an object in python - object class and type class TheDoctor <dreamingforward@gmail.com> - 2015-06-01 21:54 -0700
        Re: Everything is an object in python - object class and type class Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-02 17:12 +1000
          Re: Everything is an object in python - object class and type class Rustom Mody <rustompmody@gmail.com> - 2015-06-02 00:44 -0700
            Re: Everything is an object in python - object class and type class Chris Angelico <rosuav@gmail.com> - 2015-06-02 18:37 +1000
              Re: Everything is an object in python - object class and type class Rustom Mody <rustompmody@gmail.com> - 2015-06-02 02:18 -0700
              Re: Everything is an object in python - object class and type class Marko Rauhamaa <marko@pacujo.net> - 2015-06-02 12:23 +0300
    Re: Everything is an object in python - object class and type class vern.muhr@gmail.com - 2015-06-01 14:12 -0700
    Re: Everything is an object in python - object class and type class Eddilbert Macharia <edd.cowan@gmail.com> - 2015-06-02 03:36 -0700
      Re: Everything is an object in python - object class and type class Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-02 12:11 +0100
      Re: Everything is an object in python - object class and type class Steven D'Aprano <steve@pearwood.info> - 2015-06-02 21:27 +1000
        Re: Everything is an object in python - object class and type class Rustom Mody <rustompmody@gmail.com> - 2015-06-02 04:40 -0700
          Re: Everything is an object in python - object class and type class Steven D'Aprano <steve@pearwood.info> - 2015-06-03 01:08 +1000
            Re: Everything is an object in python - object class and type class Rustom Mody <rustompmody@gmail.com> - 2015-06-02 09:14 -0700
        Re: Everything is an object in python - object class and type class BartC <bc@freeuk.com> - 2015-06-02 13:49 +0100
          Re: Everything is an object in python - object class and type class Marko Rauhamaa <marko@pacujo.net> - 2015-06-02 16:13 +0300
          Re: Everything is an object in python - object class and type class Steven D'Aprano <steve@pearwood.info> - 2015-06-03 03:00 +1000
            Re: Everything is an object in python - object class and type class BartC <bc@freeuk.com> - 2015-06-02 18:59 +0100
              Re: Everything is an object in python - object class and type class random832@fastmail.us - 2015-06-02 14:07 -0400
              Re: Everything is an object in python - object class and type class Ned Batchelder <ned@nedbatchelder.com> - 2015-06-02 11:10 -0700
                Re: Everything is an object in python - object class and type class Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-02 13:36 -0600
              Re: Everything is an object in python - object class and type class Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2015-06-02 18:10 +0000
              Re: Everything is an object in python - object class and type class "Dr. Bigcock" <dreamingforward@gmail.com> - 2015-06-02 11:22 -0700
                Re: Everything is an object in python - object class and type class Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2015-06-02 18:47 +0000
                  Re: Everything is an object in python - object class and type class "Dr. Bigcock" <dreamingforward@gmail.com> - 2015-06-02 12:00 -0700
                    Re: Everything is an object in python - object class and type class Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2015-06-02 19:31 +0000
                      Re: Everything is an object in python - object class and type class Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-02 13:50 -0600
                        Re: Everything is an object in python - object class and type class Grant Edwards <invalid@invalid.invalid> - 2015-06-02 21:19 +0000
                          Re: Everything is an object in python - object class and type class Marko Rauhamaa <marko@pacujo.net> - 2015-06-03 01:33 +0300
                            Re: Everything is an object in python - object class and type class "Dr. Bigcock" <dreamingforward@gmail.com> - 2015-06-02 15:49 -0700
                              Re: Everything is an object in python - object class and type class Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-03 18:13 +1000
                                Re: Everything is an object in python - object class and type class "Dr. Bigcock" <dreamingforward@gmail.com> - 2015-06-03 21:38 -0700
                            Re: Everything is an object in python - object class and type class Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-03 18:24 +1000
                              Re: Everything is an object in python - object class and type class Marko Rauhamaa <marko@pacujo.net> - 2015-06-03 11:57 +0300
                                Re: Everything is an object in python - object class and type class Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-03 07:57 -0600
                                Re: Everything is an object in python - object class and type class "Dr. Bigcock" <dreamingforward@gmail.com> - 2015-06-03 21:42 -0700
                      Re: Everything is an object in python - object class and type class "Dr. Bigcock" <dreamingforward@gmail.com> - 2015-06-02 12:58 -0700
                      Re: Everything is an object in python - object class and type class Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-02 22:47 +0100
                      Re: Everything is an object in python - object class and type class Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-02 18:49 -0600
                      Re: Everything is an object in python - object class and type class Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-03 18:32 +1000
                  Re: Everything is an object in python - object class and type class Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-02 13:37 -0600
              Re: Everything is an object in python - object class and type class Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-03 18:08 +1000
            Re: Everything is an object in python - object class and type class "Dr. Bigcock" <dreamingforward@gmail.com> - 2015-06-02 11:00 -0700
        Re: Everything is an object in python - object class and type class Eddilbert Macharia <edd.cowan@gmail.com> - 2015-06-02 21:16 -0700
          Re: Everything is an object in python - object class and type class Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-03 06:23 +0100
          Re: Everything is an object in python - object class and type class BartC <bc@freeuk.com> - 2015-06-03 11:20 +0100
            Re: Everything is an object in python - object class and type class Chris Angelico <rosuav@gmail.com> - 2015-06-03 20:38 +1000
              Re: Everything is an object in python - object class and type class BartC <bc@freeuk.com> - 2015-06-03 12:08 +0100
                Re: Everything is an object in python - object class and type class Marko Rauhamaa <marko@pacujo.net> - 2015-06-03 15:08 +0300
                  Re: Everything is an object in python - object class and type class BartC <bc@freeuk.com> - 2015-06-03 17:00 +0100
                    Re: Everything is an object in python - object class and type class Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-03 17:29 +0100
                      Re: Everything is an object in python - object class and type class BartC <bc@freeuk.com> - 2015-06-03 19:59 +0100
                        Re: Everything is an object in python - object class and type class Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-03 21:58 +0100
                          Re: Everything is an object in python - object class and type class BartC <bc@freeuk.com> - 2015-06-03 22:33 +0100
                            Re: Everything is an object in python - object class and type class Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-03 22:49 +0100
                              Re: Everything is an object in python - object class and type class BartC <bc@freeuk.com> - 2015-06-04 00:04 +0100
                                Re: Everything is an object in python - object class and type class Laura Creighton <lac@openend.se> - 2015-06-04 12:06 +0200
                                  Re: Everything is an object in python - object class and type class BartC <bc@freeuk.com> - 2015-06-04 13:01 +0100
                                    Re: Everything is an object in python - object class and type class Laura Creighton <lac@openend.se> - 2015-06-04 15:39 +0200
                          Re: Everything is an object in python - object class and type class "Dr. Bigcock" <dreamingforward@gmail.com> - 2015-06-03 21:50 -0700
                            Re: Everything is an object in python - object class and type class Eddilbert Macharia <edd.cowan@gmail.com> - 2015-06-03 22:43 -0700
                    Re: Everything is an object in python - object class and type class Michael Torrie <torriem@gmail.com> - 2015-06-03 10:36 -0600
                      Re: Everything is an object in python - object class and type class BartC <bc@freeuk.com> - 2015-06-03 18:26 +0100
                        Re: Everything is an object in python - object class and type class Steven D'Aprano <steve@pearwood.info> - 2015-06-05 00:11 +1000
                    Re: Everything is an object in python - object class and type class Terry Reedy <tjreedy@udel.edu> - 2015-06-03 13:17 -0400
                Re: Everything is an object in python - object class and type class Chris Angelico <rosuav@gmail.com> - 2015-06-03 22:19 +1000
                Re: Everything is an object in python - object class and type class Marco Buttu <marco.buttu@gmail.com> - 2015-06-03 14:10 +0200
            Re: Everything is an object in python - object class and type class BartC <bc@freeuk.com> - 2015-06-03 12:13 +0100
            Re: Everything is an object in python - object class and type class Terry Reedy <tjreedy@udel.edu> - 2015-06-03 13:05 -0400
      Re: Everything is an object in python - object class and type class Terry Reedy <tjreedy@udel.edu> - 2015-06-02 12:23 -0400
    Re: Everything is an object in python - object class and type class Eddilbert Macharia <edd.cowan@gmail.com> - 2015-06-03 06:17 -0700

Page 5 of 5 — ← Prev page 1 2 3 4 [5]


#91985

FromBartC <bc@freeuk.com>
Date2015-06-03 19:59 +0100
Message-ID<98Ibx.766729$kA6.22200@fx46.am4>
In reply to#91974
On 03/06/2015 17:29, Mark Lawrence wrote:
> On 03/06/2015 17:00, BartC wrote:
>> On 03/06/2015 13:08, Marko Rauhamaa wrote:
>>> BartC <bc@freeuk.com>:
>>>
>>>> To 'variable' and 'type', you might need to add 'value' to make it more
>>>> complete.
>>>
>>> 'Value' and 'object' are indeed synonymous as long as you keep in mind
>>> that:
>>>
>>>      >>> -12 == -12
>>>      True
>>>      >>> -12 is -12
>>>      False
>>>
>>> IOW, the literal expression -12 happens to construct a fresh
>>> value/object each time CPython parses it.
>>
>> That's a different matter. However, you appear to be wrong.
>>
>> print (-12 is -12)
>>
>> gives True.

> No, you don't understand how cPython does things.

Do I need to understand CPython to appreciate what difference there 
might be between variables, values and objects?

Does anyone need to understand CPython for anything?

-- 
Bartc

[toc] | [prev] | [next] | [standalone]


#91993

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2015-06-03 21:58 +0100
Message-ID<mailman.127.1433365118.13271.python-list@python.org>
In reply to#91985
On 03/06/2015 19:59, BartC wrote:

>
> Does anyone need to understand CPython for anything?
>

No you (plural) don't.  If people were to spend more time writing code 
and less time on hypothetical claptrap the amount of noise on this list 
would probably be reduced by 99%.

Then knock out those who are interested in things like rugby, with 
Haskell being an England international, my beautiful eight month old 
great niece Ruby, and various other things, we might even spend some 
time actually talking about the Python programming langauge.  Or have 
you all forgotten that that is what this list is about?  Hardly 
surprising that the bulk of the core devs left years ago, is it?

Oh, have to get in my obligatory mention of CORAL 66/250.  If you lot 
can waffle of about languages in which I've no interest on this list, 
I'll once again mention my poor old darling who gets little or no TLC.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#91999

FromBartC <bc@freeuk.com>
Date2015-06-03 22:33 +0100
Message-ID<cpKbx.674783$ob3.28981@fx47.am4>
In reply to#91993
On 03/06/2015 21:58, Mark Lawrence wrote:
> On 03/06/2015 19:59, BartC wrote:
>
>>
>> Does anyone need to understand CPython for anything?
>>
>
> No you (plural) don't.  If people were to spend more time writing code
> and less time on hypothetical claptrap the amount of noise on this list
> would probably be reduced by 99%.

Not so hypothetical in my case as I have to implement a lot of this stuff.

I'm also quite interested in how Python does things. If it's a good idea 
I'll copy it, if not I'll try and avoid it!

> Then knock out those who are interested in things like rugby, with
> Haskell being an England international, my beautiful eight month old
> great niece Ruby, and various other things, we might even spend some
> time actually talking about the Python programming langauge.  Or have
> you all forgotten that that is what this list is about?  Hardly
> surprising that the bulk of the core devs left years ago, is it?

(I'm accessing the 'list' (whatever that is) via usenet. Usenet itself 
is slowly dying. However I don't believe there weren't pointless 
discussions that went around in circles years ago too!)

-- 
Bartc

[toc] | [prev] | [next] | [standalone]


#92002

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2015-06-03 22:49 +0100
Message-ID<mailman.131.1433368169.13271.python-list@python.org>
In reply to#91999
On 03/06/2015 22:33, BartC wrote:
> On 03/06/2015 21:58, Mark Lawrence wrote:
>
> Not so hypothetical in my case as I have to implement a lot of this stuff.
>
> I'm also quite interested in how Python does things. If it's a good idea
> I'll copy it, if not I'll try and avoid it!

Which implementation, cPython, Jython, IronPython...???

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#92011

FromBartC <bc@freeuk.com>
Date2015-06-04 00:04 +0100
Message-ID<EJLbx.765869$qW.326303@fx20.am4>
In reply to#92002
On 03/06/2015 22:49, Mark Lawrence wrote:
> On 03/06/2015 22:33, BartC wrote:
>> On 03/06/2015 21:58, Mark Lawrence wrote:
>>
>> Not so hypothetical in my case as I have to implement a lot of this
>> stuff.
>>
>> I'm also quite interested in how Python does things. If it's a good idea
>> I'll copy it, if not I'll try and avoid it!
>
> Which implementation, cPython, Jython, IronPython...???

Mainly the language itself. But I've also been looking at the workings 
of CPython. (Also PyPy but obviously I'm not going to get anywhere 
there, although RPython sounds intriguing.)

(To be clear, I'm not implementing Python, but designing and 
implementing a separate language.

I did try tinkering with CPython, but the only thing I discovered, 
regarding its performance, is that the Windows version is probably 14% 
slower than it need be. I think due to using MS' C compiler which 
doesn't have gcc's computed gotos. But I think few people here use 
Windows so that's probably of little interest. It's not so easy to fix 
either.)

-- 
Bartc

[toc] | [prev] | [next] | [standalone]


#92042

FromLaura Creighton <lac@openend.se>
Date2015-06-04 12:06 +0200
Message-ID<mailman.155.1433412387.13271.python-list@python.org>
In reply to#92011
In a message of Thu, 04 Jun 2015 00:04:04 +0100, BartC writes:
>Mainly the language itself. But I've also been looking at the workings 
>of CPython. (Also PyPy but obviously I'm not going to get anywhere 
>there, although RPython sounds intriguing.)

Why not?  We built the thing for people like you who want to design
their own language.  This makes me sad.  What are we doing wrong
that you think you won't get anywhere there?

Laura

[toc] | [prev] | [next] | [standalone]


#92045

FromBartC <bc@freeuk.com>
Date2015-06-04 13:01 +0100
Message-ID<16Xbx.946577$396.102361@fx12.am4>
In reply to#92042
On 04/06/2015 11:06, Laura Creighton wrote:
> In a message of Thu, 04 Jun 2015 00:04:04 +0100, BartC writes:
>> Mainly the language itself. But I've also been looking at the workings
>> of CPython. (Also PyPy but obviously I'm not going to get anywhere
>> there, although RPython sounds intriguing.)
>
> Why not?  We built the thing for people like you who want to design
> their own language.

(I thought you wrote bookkeeping systems?)

> This makes me sad.  What are we doing wrong
> that you think you won't get anywhere there?

It's not that you're doing anything wrong. I'm just used to using my own 
languages and to implementing 100% of them myself. (I have one that does 
the job of C, and another that takes over the role of Python, which are 
the two I'd otherwise be using.)

In the case of the interpreted one, I write streamlined but otherwise 
unremarkable bytecode interpreters that can (when I add a bit of ASM) 
just about compete with PyPy on small benchmarks.

(It is this latter language that I am upgrading to be more dynamic, to 
make the comparisons fairer, and see if I can still maintain 
performance. But I do believe a lot can be achieved with a more careful 
language design.)

To make use of PyPy, I understand that I have to code my interpreter in 
RPython, with various hints, and it is the execution paths in this code 
that are somehow optimised at runtime.

However, I've seen at the video someone posted of the keynote talk about 
PyPy (https://youtu.be/l_HBRhcgeuQ), and it does look a rather 
intimidating process (apparently taking several hours to compile the 
smallest code tweak; currently it takes me about 1 second to try 
something new).

Also, I'm using Windows where even ordinary Python development doesn't 
really work; I had to use Ubuntu (a completely alien environment to me) 
to attempt compiling Cpython).

-- 
Bartc

[toc] | [prev] | [next] | [standalone]


#92050

FromLaura Creighton <lac@openend.se>
Date2015-06-04 15:39 +0200
Message-ID<mailman.158.1433425154.13271.python-list@python.org>
In reply to#92045
In a message of Thu, 04 Jun 2015 13:01:00 +0100, BartC writes:
>On 04/06/2015 11:06, Laura Creighton wrote:
>> In a message of Thu, 04 Jun 2015 00:04:04 +0100, BartC writes:
>>> Mainly the language itself. But I've also been looking at the workings
>>> of CPython. (Also PyPy but obviously I'm not going to get anywhere
>>> there, although RPython sounds intriguing.)
>>
>> Why not?  We built the thing for people like you who want to design
>> their own language.
>
>(I thought you wrote bookkeeping systems?)

Yes, but I have to do something for fun, now, too don't I?  There is only
so much fun you can get out of a bookkeeping system.

>> This makes me sad.  What are we doing wrong
>> that you think you won't get anywhere there?

snip

>To make use of PyPy, I understand that I have to code my interpreter in 
>RPython, with various hints, and it is the execution paths in this code 
>that are somehow optimised at runtime.
>
>However, I've seen at the video someone posted of the keynote talk about 
>PyPy (https://youtu.be/l_HBRhcgeuQ), and it does look a rather 
>intimidating process (apparently taking several hours to compile the 
>smallest code tweak; currently it takes me about 1 second to try 
>something new).

We have a way to run the tests without compiling the whole thing every
time.  Not quite the same, but not quite as horrible as you might imagine.
And, happy news, Armin has had a new idea.
https://mail.python.org/pipermail/pypy-dev/2015-February/013085.html
When this goes in, warmup times will get much faster, which will mean
that everyting goes a lot faster.  (We think.  In theory.  We will
see.)

>Also, I'm using Windows where even ordinary Python development doesn't 
>really work; I had to use Ubuntu (a completely alien environment to me) 
>to attempt compiling Cpython).

PyPy development on Windows has gotten a whole lot better since that
keynote -- what it took was getting some PyPy developers who use
windows.  But they are still in short supply.  And yes, it is probably
still easier for linux people.

But if one of your goals is better performance, well, python-list
isn't the place to find the people who spend most of their lives
thinking about such things.  Whereas pypy-dev is one such place.

>-- 
>Bartc
>-- 

At any rate, if there is any interest you can come visit the irc channel
on freenode, or send mail to pypy-dev, which isn't gatewayed to usenet
anywhere.  https://mail.python.org/mailman/listinfo/pypy-dev

You won't get philosophical notes about the meaning of objects
and the like there.  It's a pretty down-to-earth-and-here-is-the-code
and 'you are slow because you do X do Y instead' sort of place.  But
polite and friendly.

Laura

[toc] | [prev] | [next] | [standalone]


#92025

From"Dr. Bigcock" <dreamingforward@gmail.com>
Date2015-06-03 21:50 -0700
Message-ID<fea7e1f3-6846-42e7-a119-89c2e022c43f@googlegroups.com>
In reply to#91993
On Wednesday, June 3, 2015 at 3:58:54 PM UTC-5, Mark Lawrence wrote:
> On 03/06/2015 19:59, BartC wrote:
> > Does anyone need to understand CPython for anything?
> >
> No you (plural) don't.  If people were to spend more time writing code 
> and less time on hypothetical claptrap the amount of noise on this list 
> would probably be reduced by 99%.
>
> Then knock out those who are interested in things like rugby, with 
> Haskell being an England international, my beautiful eight month old 
> great niece Ruby, and various other things, we might even spend some 
> time actually talking about the Python programming langauge.  Or have 
> you all forgotten that that is what this list is about?  Hardly 
> surprising that the bulk of the core devs left years ago, is it?

Oh chill out Mr. Lawrence.  We all know you've got the bigcock around here.  You can stop waving it around.

*winks*,

Mark
> Oh, have to get in my obligatory mention of CORAL 66/250.  If you lot 
> can waffle of about languages in which I've no interest on this list, 
> I'll once again mention my poor old darling who gets little or no TLC.
> 
> -- 
> My fellow Pythonistas, ask not what our language can do for you, ask
> what you can do for our language.
> 
> Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#92031

FromEddilbert Macharia <edd.cowan@gmail.com>
Date2015-06-03 22:43 -0700
Message-ID<83d7d7ff-82bb-4d09-a3b3-cf6028f088df@googlegroups.com>
In reply to#92025
can you please stick to the point.take your differences else where.please.....stay on target...some of us are learning... its annoying and tiring to have to read the insults and innuendo

[toc] | [prev] | [next] | [standalone]


#91975

FromMichael Torrie <torriem@gmail.com>
Date2015-06-03 10:36 -0600
Message-ID<mailman.115.1433349421.13271.python-list@python.org>
In reply to#91972
On 06/03/2015 10:00 AM, BartC wrote:
> The others all give True in all cases. It seems that older Python 
> versions have a purer object model.

No.  It's just an under-the-hood optimization that the interpreter is
making.  It's an implementation detail that you should never rely on.
It says nothing about the purity of the object model.  Immutable objects
can be optimized ("interred" is the word often used) by reusing the same
object over and over when the interpreter can.

[toc] | [prev] | [next] | [standalone]


#91981

FromBartC <bc@freeuk.com>
Date2015-06-03 18:26 +0100
Message-ID<vNGbx.932535$396.701770@fx12.am4>
In reply to#91975
On 03/06/2015 17:36, Michael Torrie wrote:
> On 06/03/2015 10:00 AM, BartC wrote:
>> The others all give True in all cases. It seems that older Python
>> versions have a purer object model.
>
> No.  It's just an under-the-hood optimization that the interpreter is
> making.  It's an implementation detail that you should never rely on.
> It says nothing about the purity of the object model.  Immutable objects
> can be optimized ("interred" is the word often used) by reusing the same
> object over and over when the interpreter can.

But (-12 is -12) yielding False was being used to illustrate why Value 
and Object didn't mean the same thing.

Are they in fact the same, or is there something else that can be done 
more reliably to show the difference?

(However, I feel the internal representation of values shouldn't matter. 
Each type of value will have its own documented behaviour.)

-- 
Bartc

[toc] | [prev] | [next] | [standalone]


#92057

FromSteven D'Aprano <steve@pearwood.info>
Date2015-06-05 00:11 +1000
Message-ID<55705c93$0$12981$c3e8da3$5496439d@news.astraweb.com>
In reply to#91981
On Thu, 4 Jun 2015 03:26 am, BartC asked about Value and Object:

> Are they in fact the same, or is there something else that can be done
> more reliably to show the difference?

In *Python*, they are the same. All values are implemented as objects.

But, speaking generically, Value and Object are as different as Value and
String, or Value and Integer, or Value and List. Objects are a specific
kind of value. Values may be:

- simple machine-specific types like byte, int16, single (float);
- simple compound types like array, record or struct, string;
- more complex compound types, such as objects (in the Object Oriented
Programming sense).

An object in this sense is basically a record or struct with added language
semantics. So in a language like Pascal, for example, there are a bunch of
machine-specific simple unstructured types:

    Real, Boolean, Char, Integer, ...

plus machine-specific compound types:

    Array, Record, String, ...

plus Objects (at least for recent enough Pascal compilers). In Java, for
example, you have "unboxed primitives" for various integer types,
and "boxed" objects.

In Python, all values are Objects:

- ints are low-level integers wrapped in an Object;
- floats are low-level C doubles wrapped in an Object;
- strings are arrays of characters wrapped in an Object;

etc.


> (However, I feel the internal representation of values shouldn't matter.
> Each type of value will have its own documented behaviour.)

Well, sometimes it might matter. My own feeling is that languages shouldn't
lie to you. If it offers both low-level primitives for efficiency and
high-level objects for convenience, it should make the difference explicit,
like Java does, or Pascal, or C++. Javascript tries to hide the difference,
which works really well until it doesn't, and then you get weird behaviour:


js> arr = [false, Boolean(false), new Boolean(false)];
false,false,false
js> for (i = 0; i < arr.length; ++i) {
  > print(arr[i]);
  > if (arr[i]) {print("Surprise!")} }
false
false
false
Surprise!


If you can come up with a sensible justification for why Boolean(false) is
falsey, but new Boolean(false) is truthy, you're a better man than me.

 

-- 
Steven

[toc] | [prev] | [next] | [standalone]


#91980

FromTerry Reedy <tjreedy@udel.edu>
Date2015-06-03 13:17 -0400
Message-ID<mailman.118.1433351929.13271.python-list@python.org>
In reply to#91972
On 6/3/2015 12:00 PM, BartC wrote:

> That's a different matter. However, you appear to be wrong.
>
> print (-12 is -12)
>
> gives True. As does ("abc" is "abc"). I assume constructions for
> immutable values will do the same (([10,20,30] is [10,20,30]) gives
> False because the constructs are mutable, although it's difficult to see
> how in that form).
>
> (This is on 2.7, 3.1 and PyPy. On 3.4.3, (-12 is -12) gives False as you
> say, although (12 is 12) gives True, so not even Python can make up its
> mind how it's supposed to work!)

Implementation details not specified in the language definition are just 
that -- implementation details.  The 'is' operator. which is carefully 
defined in the reference, has three uses:
1. test whether an object is None, or some other specific, special object.
2. for implementation developers, test whether the implementation 
details, including optimizations, are as intended.
3. (least important, and often leading to confusion when people make 
assumptions and extrapolate limited results) for users, discover 
implementation details.

-- 
Terry Jan Reedy

[toc] | [prev] | [next] | [standalone]


#91948

FromChris Angelico <rosuav@gmail.com>
Date2015-06-03 22:19 +1000
Message-ID<mailman.102.1433333948.13271.python-list@python.org>
In reply to#91943
On Wed, Jun 3, 2015 at 9:08 PM, BartC <bc@freeuk.com> wrote:
> On 03/06/2015 11:38, Chris Angelico wrote:
>>
>> On Wed, Jun 3, 2015 at 8:20 PM, BartC <bc@freeuk.com> wrote:
>>>
>>> I have a lot of trouble with this stuff too, as my ideas are decidedly
>>> old-fashioned. (Also I'm developing a language with some OO aspects
>>> without
>>> ever having used OO!)
>>>
>>> But, it is mostly just jargon. If you go back to using 'variable' and
>>> 'type', then it becomes a bit easier:
>>>
>>> * A variable is an instance of some type.
>>>
>>> And, that's pretty much it!
>>
>>
>> If I have a list called "stuff" with three elements in it, is
>> "stuff[1]" a variable? What if I return that list from a function
>> called get_stuff()? Is get_stuff()[1] a variable? Because in Python,
>> get_stuff()[1] is certainly going to be an object.
>
>
> Come on, we're trying to keep this simple.
>
> To 'variable' and 'type', you might need to add 'value' to make it more
> complete. An old-fashioned program will be moving values around and
> constructing new ones. Some of them will be loaded from variables, and some
> might end up being stored in variables.
>
> (With the obligatory twist in Python that variable names are not directly
> attached to their values, but via a 'string'. I can introduce a new term for
> what /is/ actually stored /with/ the variable, as it's got to be something
> unless Python works by magic, but I don't want to do that.)
>
> You might call such a value an 'object'. The trouble is, Python also uses
> 'object' to mean the base class of all classes. And it seems to use it in a
> more abstract sense as well to mean pretty much everything. While other
> languages, such as C, use object in yet another way.
>
> Which is where the term breaks down as it no longer helps in understanding.
> It's become meaningless.

Right. My point is that it starts out meaningless, because "variable"
doesn't help with anything. "Value" might help, in which case what
you're saying is that every value in Python is an object (in contrast
to Java, where some aren't). But not all objects are referenced by
names, so "variable" isn't very helpful here.

ChrisA

[toc] | [prev] | [next] | [standalone]


#91958

FromMarco Buttu <marco.buttu@gmail.com>
Date2015-06-03 14:10 +0200
Message-ID<mailman.105.1433337016.13271.python-list@python.org>
In reply to#91943
On 03/06/2015 13:08, BartC wrote:

> Come on, we're trying to keep this simple.

If we really want to keep it simple, we can take this starting point:

http://en.wikipedia.org/wiki/Object_(computer_science)

If we agree with the Wikipedia definition:

``In the class-based object-oriented programming paradigm, "object" 
refers to a particular instance of a class...``

than we can say in Python everything is an object, because everything is 
an instance of a class. And  of course, object is synonimous for instance:

 >>> (1, 2, 3).foo
Traceback (most recent call last):
    ...
AttributeError: 'tuple' object has no attribute 'foo'

-- 
Marco Buttu

INAF-Osservatorio Astronomico di Cagliari
Via della Scienza n. 5, 09047 Selargius (CA)
Phone: 070 711 80 217
Email: mbuttu@oa-cagliari.inaf.it

[toc] | [prev] | [next] | [standalone]


#91944

FromBartC <bc@freeuk.com>
Date2015-06-03 12:13 +0100
Message-ID<njBbx.721610$G53.453980@fx13.am4>
In reply to#91939
On 03/06/2015 11:20, BartC wrote:

> 'genfield' is a field (attribute) that can't be resolved, but the
> possibilities have been reduced to a small, finite set which  is
> resolved at load-time (in Python, the attribute could be anything, and
> you don't even know at runtime what it might be until you actually use
> the attribute.)

(That's not right. What I call 'genfield' is also resolved at runtime at 
the point of use. But the possibilities are very small (often just two), 
and must be an attribute the compiler knew about. Python-like open-ended 
attribute names have a separate mechanism, although I haven't 
implemented it yet...)

-- 
Bartc

[toc] | [prev] | [next] | [standalone]


#91978

FromTerry Reedy <tjreedy@udel.edu>
Date2015-06-03 13:05 -0400
Message-ID<mailman.117.1433351176.13271.python-list@python.org>
In reply to#91939
On 6/3/2015 6:20 AM, BartC wrote:

> But, it is mostly just jargon. If you go back to using 'variable' and
> 'type', then it becomes a bit easier:
>
> * A variable is an instance of some type.

That is clear enough in itself, but be aware that many people use 
'variable' as a synonym for typeless names rather than typed values.

-- 
Terry Jan Reedy

[toc] | [prev] | [next] | [standalone]


#91856

FromTerry Reedy <tjreedy@udel.edu>
Date2015-06-02 12:23 -0400
Message-ID<mailman.70.1433262257.13271.python-list@python.org>
In reply to#91817
On 6/2/2015 6:36 AM, Eddilbert Macharia wrote:

> you guys are just confusing me, you are going in loops,

Ignore the troll who is trying to confuse you by slandering the rest of 
us.  I have been using python for 18 years, I believe. Current Python 
has a loop at the core

 >>> isinstance(type, object)
True
 >>> isinstance(object, type)
True

For using python, you hardly need to know this. (It obviously was not 
true before 'object' was added in 2.2.)  The interpreter creates this 
loop on startup with code similar to the following, except that it does 
so with classes rather than lists.

 >>> lob = []
 >>> l0 = []
 >>> l1 = [l0]
 >>> l0.append(l1)
 >>> l0 in l1
True
 >>> l1 in l0
True

 > and still i have understood ,what makes everything in python an object.

Guido's decision to make python be that way.

-- 
Terry Jan Reedy

[toc] | [prev] | [next] | [standalone]


#91960

FromEddilbert Macharia <edd.cowan@gmail.com>
Date2015-06-03 06:17 -0700
Message-ID<54921414-de65-4af3-bd60-7196a42ce85b@googlegroups.com>
In reply to#91576
Hello guys, 

After i read http://python-history.blogspot.com/2009/02/first-class-everything.html .

where Guidos says "One of my goals for Python was to make it so that all objects were "first class." By this, I meant that I wanted all objects that could be named in the language (e.g., integers, strings, functions, classes, modules, methods, etc.) to have equal status. That is, they can be assigned to variables, placed in lists, stored in dictionaries, passed as arguments, and so forth."

I think i was right to say:

*** in python object and instance of a class are entirely different things.

in OOP and python - object is a representation of a real thing, or a concept .e.g a person,number and the concept of classes- which is the concept of create/representing other objects using a programming language to the machine.

class - This is what is used to create/represent objects in the machine using a programming language

class instance - This is the output of the classes this is a representation of an object.

[toc] | [prev] | [standalone]


Page 5 of 5 — ← Prev page 1 2 3 4 [5]

Back to top | Article view | comp.lang.python


csiph-web