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


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

Objects in Python

Started byshaun <shaun.wiseman91@gmail.com>
First post2012-08-22 07:13 -0700
Last post2012-08-22 11:29 -0600
Articles 20 on this page of 106 — 26 participants

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


Contents

  Objects in Python shaun <shaun.wiseman91@gmail.com> - 2012-08-22 07:13 -0700
    Re: Objects in Python Joel Goldstick <joel.goldstick@gmail.com> - 2012-08-22 10:31 -0400
    Re: Objects in Python Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2012-08-22 17:31 +0300
    Re: Objects in Python Peter Otten <__peter__@web.de> - 2012-08-22 16:36 +0200
    Re: Objects in Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-22 15:59 +0100
      Re: Objects in Python MRAB <python@mrabarnett.plus.com> - 2012-08-22 16:58 +0100
        Re: Objects in Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-22 17:10 +0100
          Re: Objects in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-22 17:30 +0100
            Re: Objects in Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-22 18:06 +0100
              Re: Objects in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-22 19:07 +0100
                Re: Objects in Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-22 20:13 +0100
      Re: Objects in Python Terry Reedy <tjreedy@udel.edu> - 2012-08-22 13:01 -0400
        Re: Objects in Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-22 18:46 +0100
          Re: Objects in Python Ian Kelly <ian.g.kelly@gmail.com> - 2012-08-22 12:15 -0600
            Re: Objects in Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-22 20:03 +0100
              Re: Objects in Python Chris Angelico <rosuav@gmail.com> - 2012-08-23 12:02 +1000
                Re: Objects in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-23 04:11 +0000
                  Re: Objects in Python Chris Angelico <rosuav@gmail.com> - 2012-08-23 15:26 +1000
                  Re: Objects in Python Jan Kuiken <jan.kuiken@quicknet.nl> - 2012-08-23 20:02 +0200
                    Re: Objects in Python Ian Kelly <ian.g.kelly@gmail.com> - 2012-08-23 12:17 -0600
                      Re: Objects in Python Jan Kuiken <jan.kuiken@quicknet.nl> - 2012-08-23 22:43 +0200
                    Re: Objects in Python 88888 Dihedral <dihedral88888@googlemail.com> - 2012-08-25 23:14 -0700
          Re: Objects in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-22 19:23 +0100
          Re: Re: Objects in Python Evan Driscoll <driscoll@cs.wisc.edu> - 2012-08-22 14:03 -0500
            Re: Objects in Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-22 20:45 +0100
              Re: Objects in Python MRAB <python@mrabarnett.plus.com> - 2012-08-22 21:31 +0100
              Re: Objects in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-22 21:46 +0100
                Methods versus functions [was Re: Objects in Python] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-23 04:07 +0000
              Re: Re: Objects in Python Evan Driscoll <driscoll@cs.wisc.edu> - 2012-08-22 16:31 -0500
                Re: Objects in Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-23 10:19 +0100
                  Re: Re: Objects in Python Evan Driscoll <driscoll@cs.wisc.edu> - 2012-08-23 11:44 -0500
                    Re: Objects in Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-23 18:56 +0100
          Re: Objects in Python Ben Finney <ben+python@benfinney.id.au> - 2012-08-23 09:58 +1000
            Re: Objects in Python Ian Kelly <ian.g.kelly@gmail.com> - 2012-08-22 18:10 -0600
            Re: Re: Objects in Python Evan Driscoll <driscoll@cs.wisc.edu> - 2012-08-22 23:49 -0500
              Re: Objects in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-23 06:55 +0000
                Re: Objects in Python Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2012-08-23 11:59 +0300
                  Re: Objects in Python MRAB <python@mrabarnett.plus.com> - 2012-08-23 12:28 +0100
                  Re: Objects in Python Jerry Hill <malaclypse2@gmail.com> - 2012-08-23 10:43 -0400
                  Re: Objects in Python Evan Driscoll <driscoll@cs.wisc.edu> - 2012-08-23 12:17 -0500
                    Re: Objects in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-23 17:56 +0000
                      Variables vs names [was: Objects in Python] Evan Driscoll <driscoll@cs.wisc.edu> - 2012-08-23 14:22 -0500
                        Re: Variables vs names Ben Finney <ben+python@benfinney.id.au> - 2012-08-24 10:02 +1000
                        Re: Variables vs names [was: Objects in Python] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-25 02:05 +0000
                          Re: Variables vs names Ben Finney <ben+python@benfinney.id.au> - 2012-08-25 15:24 +1000
                      Re: Objects in Python Chris Angelico <rosuav@gmail.com> - 2012-08-24 08:00 +1000
                        Re: Objects in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-25 03:04 +0000
                          Re: Objects in Python Chris Angelico <rosuav@gmail.com> - 2012-08-25 16:34 +1000
                          Re: Objects in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-25 09:55 +0100
                          Re: Objects in Python Chris Angelico <rosuav@gmail.com> - 2012-08-25 20:23 +1000
                          Re: Objects in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-25 12:01 +0100
                          Re: Objects in Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-25 15:56 -0400
                          Re: Objects in Python Chris Angelico <rosuav@gmail.com> - 2012-08-26 09:27 +1000
                          Re: Objects in Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-25 20:43 -0400
                          Re: Re: Objects in Python Evan Driscoll <driscoll@cs.wisc.edu> - 2012-08-26 00:25 -0500
                      Re: Variables vs names [was: Objects in Python] Chris Angelico <rosuav@gmail.com> - 2012-08-24 09:34 +1000
                      Re: Objects in Python Ben Finney <ben+python@benfinney.id.au> - 2012-08-24 09:49 +1000
                      Re: Variables vs names [was: Objects in Python] Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-23 19:52 -0400
                      Re: Objects in Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-23 19:54 -0400
                      Re: Objects in Python Chris Angelico <rosuav@gmail.com> - 2012-08-24 10:01 +1000
                  Re: Objects in Python Terry Reedy <tjreedy@udel.edu> - 2012-08-23 13:17 -0400
              Re: Objects in Python Ben Finney <ben+python@benfinney.id.au> - 2012-08-24 00:16 +1000
              Re: Objects in Python Roy Smith <roy@panix.com> - 2012-08-23 20:36 -0400
                Re: Objects in Python Chris Angelico <rosuav@gmail.com> - 2012-08-24 11:34 +1000
                  Re: Objects in Python alex23 <wuwei23@gmail.com> - 2012-08-23 20:17 -0700
                    Re: Re: Objects in Python Evan Driscoll <driscoll@cs.wisc.edu> - 2012-08-24 04:14 -0500
                      Re: Objects in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-24 10:00 +0000
                        Re: Objects in Python Grant Edwards <invalid@invalid.invalid> - 2012-08-24 13:27 +0000
                          Re: Objects in Python Chris Angelico <rosuav@gmail.com> - 2012-08-25 05:18 +1000
                        Re: Re: Objects in Python Evan Driscoll <driscoll@cs.wisc.edu> - 2012-08-26 00:45 -0500
                          Re: Objects in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-26 13:43 +0000
                            Re: Objects in Python Chris Angelico <rosuav@gmail.com> - 2012-08-26 23:58 +1000
                              Re: Objects in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-26 14:18 +0000
                                Re: Objects in Python Chris Angelico <rosuav@gmail.com> - 2012-08-27 00:54 +1000
                                  Re: Objects in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-26 22:47 +0000
                            Re: Objects in Python Roy Smith <roy@panix.com> - 2012-08-26 10:02 -0400
                              Re: Objects in Python Chris Angelico <rosuav@gmail.com> - 2012-08-27 00:14 +1000
                            Re: Objects in Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-26 16:12 -0400
                              Re: Objects in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-26 23:29 +0000
                        Re: Re: Objects in Python Chris Angelico <rosuav@gmail.com> - 2012-08-26 16:22 +1000
                          Re: Objects in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-26 12:02 +0000
                            Re: Objects in Python Chris Angelico <rosuav@gmail.com> - 2012-08-26 23:34 +1000
                            Re: Objects in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-26 15:02 +0100
                            Re: Objects in Python Chris Angelico <rosuav@gmail.com> - 2012-08-27 00:05 +1000
                          Re: Objects in Python Roy Smith <roy@panix.com> - 2012-08-26 09:41 -0400
                Identity function id() [was Re: Objects in Python] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-24 10:06 +0000
            Re: Re: Objects in Python Chris Angelico <rosuav@gmail.com> - 2012-08-23 15:33 +1000
            Re: Objects in Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-23 14:30 -0400
              Re: Objects in Python Alexander Blinne <news@blinne.net> - 2012-08-24 15:23 +0200
            Re: Objects in Python Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2012-08-24 09:38 +0200
            Re: Objects in Python Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2012-08-24 10:03 +0200
          Re: Objects in Python Walter Hurry <walterhurry@lavabit.com> - 2012-08-23 01:19 +0000
            Re: Objects in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-23 04:14 +0000
              Re: Objects in Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-23 09:10 +0100
                Re: Objects in Python Ben Finney <ben+python@benfinney.id.au> - 2012-08-23 23:59 +1000
                  Re: Objects in Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-23 15:20 +0100
                    Re: Objects in Python Ben Finney <ben+python@benfinney.id.au> - 2012-08-24 00:24 +1000
            Re: Objects in Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-23 09:03 +0100
          Re: Objects in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-23 04:34 +0000
            Re: Objects in Python rusi <rustompmody@gmail.com> - 2012-08-23 10:04 -0700
    Re: Objects in Python John Gordon <gordon@panix.com> - 2012-08-22 15:03 +0000
    Re: Objects in Python shaun <shaun.wiseman91@gmail.com> - 2012-08-22 08:25 -0700
      Re: Objects in Python Chris Angelico <rosuav@gmail.com> - 2012-08-23 01:47 +1000
      Re: Objects in Python Dave Angel <d@davea.name> - 2012-08-22 11:51 -0400
      Re: Objects in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-22 17:13 +0100
      Re: Objects in Python Ian Kelly <ian.g.kelly@gmail.com> - 2012-08-22 11:29 -0600

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


#27914

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2012-08-26 12:02 +0000
Message-ID<503a105b$0$6574$c3e8da3$5496439d@news.astraweb.com>
In reply to#27905
On Sun, 26 Aug 2012 16:22:05 +1000, Chris Angelico wrote:

> On Sun, Aug 26, 2012 at 3:45 PM, Evan Driscoll <driscoll@cs.wisc.edu>
> wrote:
>> Third, and more wackily, you could technically create a C
>> implementation that works like Python, where it stores variables (whose
>> addresses aren't taken) in a dict keyed by name, and generates code
>> that on a variable access looks up the value by accessing that dict
>> using the name of the variable.
> 
> That would be a reasonable way to build a C interactive interpreter.

No it wouldn't. Without fixed addresses, the language wouldn't be able to 
implement pointers. C without pointers isn't C, it is something else. 
Possibly called Python :)

I suppose you could get pointers in Namespace-C if you somehow mapped 
names to addresses, and vice versa, but why would you do that? You end up 
with a hybrid system that doesn't give you any advantage over C but has a 
much more complicated implementation (and therefore many more new and 
exciting bugs).

But if you want me to agree that you could implement C using name 
binding, plus some weird scheme to track memory addresses, then yes, I 
suppose you could. Then the parts of C that don't rely on fixed memory 
addresses could use the name bindings (with the corresponding loss of 
performance), and the parts of C which do require them could continue to 
do so, and we'll have one more language with a confusing, unclear and 
unclean execution model. Everybody wins! For some definition of win.



-- 
Steven

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


#27919

FromChris Angelico <rosuav@gmail.com>
Date2012-08-26 23:34 +1000
Message-ID<mailman.3833.1345988100.4697.python-list@python.org>
In reply to#27914
On Sun, Aug 26, 2012 at 10:02 PM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> On Sun, 26 Aug 2012 16:22:05 +1000, Chris Angelico wrote:
>
>> On Sun, Aug 26, 2012 at 3:45 PM, Evan Driscoll <driscoll@cs.wisc.edu>
>> wrote:
>>> Third, and more wackily, you could technically create a C
>>> implementation that works like Python, where it stores variables (whose
>>> addresses aren't taken) in a dict keyed by name, and generates code
>>> that on a variable access looks up the value by accessing that dict
>>> using the name of the variable.
>>
>> That would be a reasonable way to build a C interactive interpreter.
>
> No it wouldn't. Without fixed addresses, the language wouldn't be able to
> implement pointers. C without pointers isn't C, it is something else.
> Possibly called Python :)

The insertion of a single rule will do it. Let it stand that &x is the
string "x" and there you are, out of your difficulty at once!

Okay, that may be a bit of a fairy tale ending and completely illogical.

ChrisA

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


#27923

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2012-08-26 15:02 +0100
Message-ID<mailman.3835.1345989689.4697.python-list@python.org>
In reply to#27914
On 26/08/2012 14:34, Chris Angelico wrote:
>
> Okay, that may be a bit of a fairy tale ending and completely illogical.
>
> ChrisA
>

Then stick to the thread about flexible string representation, unicode 
and typography :)

-- 
Cheers.

Mark Lawrence.

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


#27925

FromChris Angelico <rosuav@gmail.com>
Date2012-08-27 00:05 +1000
Message-ID<mailman.3836.1345989950.4697.python-list@python.org>
In reply to#27914
On Mon, Aug 27, 2012 at 12:02 AM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
> On 26/08/2012 14:34, Chris Angelico wrote:
>>
>> Okay, that may be a bit of a fairy tale ending and completely illogical.
>>
>> ChrisA
>
> Then stick to the thread about flexible string representation, unicode and
> typography :)

Hehe. Probably nobody on this list will recognize what I said, but
it's a near-quote from "Iolanthe", an opera about fairies. It's the
great denoumont, the solution to everyone's problems. And in the same
way, redefining the "take-address-of" operator could be a perfect
solution... and, just like in Iolanthe, is a rather fundamental
change, and one that would break a lot of things.

ChrisA

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


#27920

FromRoy Smith <roy@panix.com>
Date2012-08-26 09:41 -0400
Message-ID<roy-B5005E.09410726082012@news.panix.com>
In reply to#27905
In article <mailman.3830.1345962128.4697.python-list@python.org>,
 Chris Angelico <rosuav@gmail.com> wrote:

> On Sun, Aug 26, 2012 at 3:45 PM, Evan Driscoll <driscoll@cs.wisc.edu> wrote:
> > Third, and more wackily, you could technically create a C implementation
> > that works like Python, where it stores variables (whose addresses aren't
> > taken) in a dict keyed by name, and generates code that on a variable access
> > looks up the value by accessing that dict using the name of the variable.
> 
> That would be a reasonable way to build a C interactive interpreter.

Except that lots of C and C++ programs assume they know how data 
structures are laid out and can index forward and backward over them in 
ways which the language does not promise work (but are, none the less, 
useful).  Say, the sort of thinks you might use python's struct module 
for.

On the other hand, there is certainly a big subset of C that you could 
implement that way.  But it would only be useful as a simple 
instructional tool.

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


#27789 — Identity function id() [was Re: Objects in Python]

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2012-08-24 10:06 +0000
SubjectIdentity function id() [was Re: Objects in Python]
Message-ID<50375228$0$6574$c3e8da3$5496439d@news.astraweb.com>
In reply to#27774
On Thu, 23 Aug 2012 20:36:27 -0400, Roy Smith wrote:

> The id has changed!  Now, we all know that the id of an object is its
> memory address (that's not guaranteed, but in the standard C
> implementation of Python, that's what it is).

It's not only "not guaranteed", it is *explicitly* noted as an 
implementation detail. The id of the object is an arbitrary number 
guaranteed to be unique during the lifetime of that object. It just 
happens that CPython currently uses the memory address as the id. Jython 
does not:

steve@runes:~$ jython
Jython 2.5.1+ (Release_2_5_1, Aug 4 2010, 07:18:19)
[OpenJDK Client VM (Sun Microsystems Inc.)] on java1.6.0_18
Type "help", "copyright", "credits" or "license" for more information.
>>> x = 42
>>> id(x)
1


Nor does IronPython:

steve@runes:~$ ipy
IronPython 2.6 Beta 2 DEBUG (2.6.0.20) on .NET 2.0.50727.1433
Type "help", "copyright", "credits" or "license" for more information.
>>> x = 42
>>> id(x)
43



-- 
Steven

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


#27699

FromChris Angelico <rosuav@gmail.com>
Date2012-08-23 15:33 +1000
Message-ID<mailman.3695.1345700016.4697.python-list@python.org>
In reply to#27687
On Thu, Aug 23, 2012 at 2:49 PM, Evan Driscoll <driscoll@cs.wisc.edu> wrote:
> On 8/22/2012 18:58, Ben Finney wrote:
>> You haven't discovered anything about types; what you have discovered is
>> that Python name bindings are not variables.
>>
>> In fact, Python doesn't have variables – not as C or Java programmers
>> would understand the term. What it has instead are references to objects
>> (with names as one kind of reference).
>
> OK, I've seen this said a few times, and I have to ask: what do you mean
> by this? I consider myself pretty decent at Python and other languages,
> and I really don't get it.

Simple example that'll work in many languages:

x = 1;

In C, this means: Assign the integer 1 to the variable x (possibly
with implicit type casting, eg to floating point).

In Java or C++, this means: Assign the integer 1 to the variable x.
Ditto, but possibly 'x' is actually a class member etc rather than a
simple variable.

In Python, this means: Make the name x now refer to the object 1.
Whatever x had before is de-referenced by one (in a simple refcounting
situation, that may result in the object being destroyed), and the
object referred to by the literal 1 is now pointed to by x.

Names are just one kind of reference because complex objects can have
unnamed references. For instance:

foo = [1, 2, 3]
foo[1] = "Hello, world!"

The second element of foo just got rebound in exactly the same way x
did, but it doesn't have a name of its own.

Does that sort things out, or just make things more confusing?

ChrisA

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


#27756

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2012-08-23 14:30 -0400
Message-ID<mailman.3726.1345746642.4697.python-list@python.org>
In reply to#27687
On Thu, 23 Aug 2012 15:33:33 +1000, Chris Angelico <rosuav@gmail.com>
declaimed the following in gmane.comp.python.general:

> Simple example that'll work in many languages:
> 
> x = 1;
> 
> In C, this means: Assign the integer 1 to the variable x (possibly
> with implicit type casting, eg to floating point).
>
	Or, at an even lower level...

	Convert the decimal literal "1" to binary (including type casting)
to the predeclared type given to the variable "x", and store that binary
value into the predetermined memory associated with "x".

	Both the type, and the memory location, are fixed to the name "x"
 
> 
> In Python, this means: Make the name x now refer to the object 1.
> Whatever x had before is de-referenced by one (in a simple refcounting
> situation, that may result in the object being destroyed), and the
> object referred to by the literal 1 is now pointed to by x.
>
	The type, and memory location, are inherent attributes of the
integer object; "x" is just a name by which the object may be accessed.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

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


#27794

FromAlexander Blinne <news@blinne.net>
Date2012-08-24 15:23 +0200
Message-ID<50378052$0$6573$9b4e6d93@newsspool3.arcor-online.net>
In reply to#27756
On 23.08.2012 20:30, Dennis Lee Bieber wrote:
> On Thu, 23 Aug 2012 15:33:33 +1000, Chris Angelico <rosuav@gmail.com>
> declaimed the following in gmane.comp.python.general:
>> x = 1;
>>
>> In C, this means: Assign the integer 1 to the variable x (possibly
>> with implicit type casting, eg to floating point).
>>
> 	Or, at an even lower level...
> 
> 	Convert the decimal literal "1" to binary (including type casting)
> to the predeclared type given to the variable "x", and store that binary
> value into the predetermined memory associated with "x".

Not really the way i would view it. The conversion to binary of the
string "1" is part of the parsers and compilers work in order to do what
the language reference says about the meaning of x=1;. The resulting
code would simply store the binary value of an integer 1 (which is
contained in the code as is, nothing has to be converted or typecasted)
into the location corresponding to the variable x. So in C x=1; really
means store integer 1 to the variable x.

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


#27782

FromAntoon Pardon <antoon.pardon@rece.vub.ac.be>
Date2012-08-24 09:38 +0200
Message-ID<mailman.3743.1345793997.4697.python-list@python.org>
In reply to#27687
On 23-08-12 01:58, Ben Finney wrote:
>
> You haven't discovered anything about types; what you have discovered is
> that Python name bindings are not variables.
>
> In fact, Python doesn't have variables – not as C or Java programmers
> would understand the term. What it has instead are references to objects
> (with names as one kind of reference).
>
> The documentation unfortunately calls these references “variables” in
> various places, which IMO compounds the confusion in newcomers
> experienced with other languages. It's best, I think, to reject the idea
> that Python has variables, and think in terms of references instead.
>   
Why should we reject the idea that python has variables? Python
variables are a lot like scheme or smalltalk variables and I never
heard anyone having a problem considering these languages
having variables.

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


#27783

FromAntoon Pardon <antoon.pardon@rece.vub.ac.be>
Date2012-08-24 10:03 +0200
Message-ID<mailman.3744.1345795412.4697.python-list@python.org>
In reply to#27687
On 24-08-12 09:38, Antoon Pardon wrote:
> On 23-08-12 01:58, Ben Finney wrote:
>   
>> You haven't discovered anything about types; what you have discovered is
>> that Python name bindings are not variables.
>>
>> In fact, Python doesn't have variables – not as C or Java programmers
>> would understand the term. What it has instead are references to objects
>> (with names as one kind of reference).
>>
>> The documentation unfortunately calls these references “variables” in
>> various places, which IMO compounds the confusion in newcomers
>> experienced with other languages. It's best, I think, to reject the idea
>> that Python has variables, and think in terms of references instead.
>>   
>>     
> Why should we reject the idea that python has variables? Python
> variables are a lot like scheme or smalltalk variables and I never
> heard anyone having a problem considering these languages
> having variables.
>   
Never mind. I missed the reactions already dealing with this.

-- 
Antoon Pardon

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


#27689

FromWalter Hurry <walterhurry@lavabit.com>
Date2012-08-23 01:19 +0000
Message-ID<k140fl$807$1@news.albasani.net>
In reply to#27664
On Wed, 22 Aug 2012 18:46:43 +0100, lipska the kat wrote:

> Well I'm a beginner

Then maybe you should read more and write less.

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


#27695

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2012-08-23 04:14 +0000
Message-ID<5035ae3f$0$1645$c3e8da3$76491128@news.astraweb.com>
In reply to#27689
On Thu, 23 Aug 2012 01:19:49 +0000, Walter Hurry wrote:

> On Wed, 22 Aug 2012 18:46:43 +0100, lipska the kat wrote:
> 
>> Well I'm a beginner
> 
> Then maybe you should read more and write less.

I think that's uncalled for. Lipska isn't trolling. He's making 
observations as he sees them. The fact that they're sometimes wrong is 
not a reason to effectively tell him to STFU.

Better the misconception which is spoken allowed and corrected, then the 
one which is kept quiet and festers.

-- 
Steven

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


#27706

Fromlipska the kat <lipskathekat@yahoo.co.uk>
Date2012-08-23 09:10 +0100
Message-ID<4ICdnasny6sSeKjNnZ2dnUVZ8t-dnZ2d@bt.com>
In reply to#27695
On 23/08/12 05:14, Steven D'Aprano wrote:
> On Thu, 23 Aug 2012 01:19:49 +0000, Walter Hurry wrote:
>
>> On Wed, 22 Aug 2012 18:46:43 +0100, lipska the kat wrote:
>>
>>> Well I'm a beginner
>>
>> Then maybe you should read more and write less.
>
> I think that's uncalled for. Lipska isn't trolling. He's making
> observations as he sees them. The fact that they're sometimes wrong is
> not a reason to effectively tell him to STFU.
>
> Better the misconception which is spoken allowed and corrected, then the
> one which is kept quiet and festers.

Excellent advice as usual, but I'm more than capable of looking after 
myself thank you.

Nobody has ever succeeded in making me STFU yet :-)

When that day comes I'll retire to the garden

lipska

-- 
Lipska the Kat©: Troll hunter, sandbox destroyer
and farscape dreamer of Aeryn Sun

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


#27732

FromBen Finney <ben+python@benfinney.id.au>
Date2012-08-23 23:59 +1000
Message-ID<878vd51zfw.fsf@benfinney.id.au>
In reply to#27706
lipska the kat <lipskathekat@yahoo.co.uk> writes:

> On 23/08/12 05:14, Steven D'Aprano wrote:
> > I think that's uncalled for.
[…]

> Excellent advice as usual, but I'm more than capable of looking after
> myself thank you.

As is usual, it's not all about you; Steven is demonstrating that we
require civil behaviour here, for anyone who may be watching but not
saying anything.

-- 
 \             “Skepticism is the highest duty and blind faith the one |
  `\               unpardonable sin.” —Thomas Henry Huxley, _Essays on |
_o__)                                   Controversial Questions_, 1889 |
Ben Finney

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


#27737

Fromlipska the kat <lipskathekat@yahoo.co.uk>
Date2012-08-23 15:20 +0100
Message-ID<qrWdnbmeBaiyoavNnZ2dnUVZ8h-dnZ2d@bt.com>
In reply to#27732
On 23/08/12 14:59, Ben Finney wrote:
> lipska the kat<lipskathekat@yahoo.co.uk>  writes:
>
>> On 23/08/12 05:14, Steven D'Aprano wrote:
>>> I think that's uncalled for.
> […]
>
>> Excellent advice as usual, but I'm more than capable of looking after
>> myself thank you.
>
> As is usual, it's not all about you; Steven is demonstrating that we
> require civil behaviour here, for anyone who may be watching but not
> saying anything.

You 'require civil behaviour here' do you. Well so far I have been very 
civil.

This is a USENET newsgroup, it's a public forum, not your personal 
domain. Please stop all this 'it's not all about you' meaningless 
nonsense. It's pointless and wastes mine and no doubt others time.

If you want to carry this on please contact me off list.

lipska

-- 
Lipska the Kat©: Troll hunter, sandbox destroyer
and farscape dreamer of Aeryn Sun

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


#27738

FromBen Finney <ben+python@benfinney.id.au>
Date2012-08-24 00:24 +1000
Message-ID<87zk5lznwu.fsf@benfinney.id.au>
In reply to#27737
lipska the kat <lipskathekat@yahoo.co.uk> writes:

> On 23/08/12 14:59, Ben Finney wrote:
> > lipska the kat<lipskathekat@yahoo.co.uk>  writes:
> >
> >> On 23/08/12 05:14, Steven D'Aprano wrote:
> >>> I think that's uncalled for.
> > […]
> >
> >> Excellent advice as usual, but I'm more than capable of looking after
> >> myself thank you.
> >
> > As is usual, it's not all about you; Steven is demonstrating that we
> > require civil behaviour here, for anyone who may be watching but not
> > saying anything.
>
> You 'require civil behaviour here' do you. Well so far I have been
> very civil.

And I say again: it's not all about you. Steven's respons was to a
different person in this thread. Please stop reacting as if everything
said around you is directed at you.

-- 
 \        “I don't accept the currently fashionable assertion that any |
  `\       view is automatically as worthy of respect as any equal and |
_o__)                                   opposite view.” —Douglas Adams |
Ben Finney

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


#27704

Fromlipska the kat <lipskathekat@yahoo.co.uk>
Date2012-08-23 09:03 +0100
Message-ID<usudnftYUY5UfqjNnZ2dnUVZ7sidnZ2d@bt.com>
In reply to#27689
On 23/08/12 02:19, Walter Hurry wrote:
> On Wed, 22 Aug 2012 18:46:43 +0100, lipska the kat wrote:
>
>> Well I'm a beginner
>
> Then maybe you should read more and write less.

Really ? I read all the responses to my posts and learn more from them 
in less time than I ever have from reading the 'documentation'

If you don't like it then don't read it.

lipska

-- 
Lipska the Kat©: Troll hunter, sandbox destroyer
and farscape dreamer of Aeryn Sun

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


#27696

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2012-08-23 04:34 +0000
Message-ID<5035b2eb$0$1645$c3e8da3$76491128@news.astraweb.com>
In reply to#27664
On Wed, 22 Aug 2012 18:46:43 +0100, lipska the kat wrote:

> We need to separate out the 'view' from the 'implementation' here. Most
> developers I know, if looking at the code and without the possibly
> dubious benefit of knowing that in Python 'everything is an object'
> would not call this 'strong typing'

Most developers are wrong :)

A very useful resource to read is "What To Know Before Debating Type 
Systems", which was put on the internet, lost, then found and put back up 
here:

http://cdsmith.wordpress.com/2011/01/09/an-old-article-i-wrote/

I don't *quite* go so far as to agree that "strong typing" and "weak 
typing" are meaningless, but they certainly don't mean quite as much as 
people sometimes think.

It also includes this brilliant quote:

"I find it amusing when novice programmers believe their main job is 
preventing programs from crashing. ... More experienced programmers 
realize that correct code is great, code that crashes could use 
improvement, but incorrect code that doesn’t crash is a horrible 
nightmare."

In Python's case, we say:

1) objects are strongly typed -- every object has a type, which is 
usually immutable and sometimes known at compile time;

2) names (what some people insist on calling variables) are not typed at 
all (with the exception of a handful of keywords like None);

3) most Python built-ins are strongly typed, and users are discouraged 
from writing excessively weakly-typed operations (you could write an int 
subclass that can be added to a string or a list, just as you can add it 
to a float, but you shouldn't);

4) there's a culture of preferring "duck typing", which is kind of an ad 
hoc form of interfaces, over strict type testing, so users are also 
discouraged from writing excessively strongly-typed operations (if you 
just need something you can iterate over, why insist that it must be a 
list and nothing but a list?).


-- 
Steven

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


#27746

Fromrusi <rustompmody@gmail.com>
Date2012-08-23 10:04 -0700
Message-ID<7380f681-4b76-4500-a79f-83978990e7b6@xd1g2000pbc.googlegroups.com>
In reply to#27696
On Aug 23, 9:34 am, Steven D'Aprano <steve
+comp.lang.pyt...@pearwood.info> wrote:
> On Wed, 22 Aug 2012 18:46:43 +0100, lipska the kat wrote:
> > We need to separate out the 'view' from the 'implementation' here. Most
> > developers I know, if looking at the code and without the possibly
> > dubious benefit of knowing that in Python 'everything is an object'
> > would not call this 'strong typing'
>
> Most developers are wrong :)
>
> A very useful resource to read is "What To Know Before Debating Type
> Systems", which was put on the internet, lost, then found and put back up
> here:
>
> http://cdsmith.wordpress.com/2011/01/09/an-old-article-i-wrote/

Thanks for that article.
There was one by Peter Wegner -- exact one I cant find.  Here's a good
approximation:
http://analysis-of-persistence-tools.googlecode.com/files/p7-wegner.pdf

Section 5.2.1 in particular has 7 different things that the word
'type' could mean to different types(!) of programmers.

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


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

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


csiph-web