Question About When Objects Are Destroyed (continued)

2017-08-04 Thread Jon Forrest
Perhaps the reason the variable isn't destroyed is shown by the following (again, in the same session): >>> import sys >>> sys.getrefcount(1578505988392) 3 So, maybe it's not destroyed because there are still references to it. But, what are these references? Will the reference count ever go to

Re: Question About When Objects Are Destroyed

2017-08-04 Thread Jon Forrest
On 8/4/2017 4:34 PM, gst wrote: 'two' is a so called constant or literal value .. (of that function). Why not attach it, as a const value/object, to the function itself ? So that a new string object has not to be created each time the function is called. Because anyway strings are immutable. So

Question About When Objects Are Destroyed

2017-08-04 Thread Jon Forrest
ld never work. (I'm not 100% sure my understanding of function decorators is correct since I'm still learning about them). What's the right way to think about this? Cordially, Jon Forrest -- https://mail.python.org/mailman/listinfo/python-list

Re: Is An Element of a Sequence an Object?

2017-06-03 Thread Jon Forrest
On 6/3/2017 5:23 PM, Steve D'Aprano wrote: On Sun, 4 Jun 2017 05:10 am, Jon Forrest wrote: We can fix the book's statement by changing it to: A sequence is an ordered collection of *elements* ... That's exactly what I was thinking, but then there'd have to be a clear definition

Re: Is An Element of a Sequence an Object?

2017-06-03 Thread Jon Forrest
On 6/3/2017 4:58 PM, Chris Angelico wrote: A sequence doesn't necessarily "contain" anything. Maybe not always, but doesn't "abc" contain three characters? Is 'contain' the right word? As has been mentioned, a range object is a sequence, but it creates integer objects lazily. So there

Re: Is An Element of a Sequence an Object?

2017-06-03 Thread Jon Forrest
On 6/3/2017 5:03 PM, Ben Finney wrote: Jon Forrest <nob...@gmail.com> writes: I'm learning about Python. A book I'm reading about it Can you say which book, and where in the book it says this? With all due respect, I'd rather not. The author has been very responsive when I

Re: Is An Element of a Sequence an Object?

2017-06-03 Thread Jon Forrest
tween an "object" and "element" is key here. (This might be seen as pedantic, but I think it's important to be clear, especially in a book intended for beginners, as I am. > Hope this helps. Thanks for taking the time to reply. I'm somebody who reads technical books *

Is An Element of a Sequence an Object?

2017-06-03 Thread Jon Forrest
a specific meaning in Python. Am I on the right track here? Cordially, Jon Forrest -- https://mail.python.org/mailman/listinfo/python-list