On 2017-08-05, Tim Daneliuk wrote:
> On 08/05/2017 03:21 PM, Chris Angelico wrote:
>> so the object's lifetime shouldn't matter to you.
>
> I disagree with this most strongly. That's only true when the
> machine resources being consumed by your Python object are small in
>
On 08/05/2017 05:36 PM, Ned Batchelder wrote:
> On 8/5/17 5:41 PM, Tim Daneliuk wrote:
>> On 08/05/2017 11:16 AM, Ned Batchelder wrote:
>>> It uses
>>> reference counting, so most objects are reclaimed immediately when their
>>> reference count goes to zero, such as at the end of local scopes.
>>
On 08/05/2017 05:36 PM, Ned Batchelder wrote:
> On 8/5/17 5:41 PM, Tim Daneliuk wrote:
>> On 08/05/2017 11:16 AM, Ned Batchelder wrote:
>>> It uses
>>> reference counting, so most objects are reclaimed immediately when their
>>> reference count goes to zero, such as at the end of local scopes.
>>
On 08/05/2017 05:58 PM, Chris Angelico wrote:
> On Sun, Aug 6, 2017 at 7:32 AM, Tim Daneliuk wrote:
>> On 08/05/2017 03:21 PM, Chris Angelico wrote:
>>> After a 'with' block,
>>> the object *still exists*, but it has been "exited" in some way
>>> (usually by closing/releasing
On 08/05/2017 05:58 PM, Chris Angelico wrote:
> On Sun, Aug 6, 2017 at 7:32 AM, Tim Daneliuk wrote:
>> On 08/05/2017 03:21 PM, Chris Angelico wrote:
>>> After a 'with' block,
>>> the object *still exists*, but it has been "exited" in some way
>>> (usually by closing/releasing
On Sun, Aug 6, 2017 at 7:32 AM, Tim Daneliuk wrote:
> On 08/05/2017 03:21 PM, Chris Angelico wrote:
>> After a 'with' block,
>> the object *still exists*, but it has been "exited" in some way
>> (usually by closing/releasing an underlying resource).
>
> The containing object
On 8/5/17 5:41 PM, Tim Daneliuk wrote:
> On 08/05/2017 11:16 AM, Ned Batchelder wrote:
>> It uses
>> reference counting, so most objects are reclaimed immediately when their
>> reference count goes to zero, such as at the end of local scopes.
> Given this code:
>
> class SomeObject:
> .
>
On 2017-08-05 22:41, Tim Daneliuk wrote:
On 08/05/2017 11:16 AM, Ned Batchelder wrote:
It uses
reference counting, so most objects are reclaimed immediately when their
reference count goes to zero, such as at the end of local scopes.
Given this code:
class SomeObject:
.
for foo
Tim Daneliuk :
> Are you saying that each time a,b,c are reassigned to new instances of
> SomeObject the old instance counts go to 0 and are immediately - as in
> synchronously, right now, on the spot - removed from memory?
That depends on the implementation of Python.
On 08/05/2017 11:16 AM, Ned Batchelder wrote:
> It uses
> reference counting, so most objects are reclaimed immediately when their
> reference count goes to zero, such as at the end of local scopes.
Given this code:
class SomeObject:
.
for foo in somelist:
a = SomeObject(foo)
b
On 08/05/2017 03:21 PM, Chris Angelico wrote:
> After a 'with' block,
> the object *still exists*, but it has been "exited" in some way
> (usually by closing/releasing an underlying resource).
The containing object exists, but the things that the closing
logic explicitly released do not. In some
On Sun, Aug 6, 2017 at 1:23 AM, Tim Daneliuk wrote:
> On 08/04/2017 07:00 PM, Chris Angelico wrote:
>> Again, don't stress about exactly when objects get
>> disposed of; it doesn't matter.
>
>
> Respectfully, I disagree strongly. Objects get build on the heap and
> persist
On 8/5/17 11:23 AM, Tim Daneliuk wrote:
> On 08/04/2017 07:00 PM, Chris Angelico wrote:
>> Again, don't stress about exactly when objects get
>> disposed of; it doesn't matter.
>
> Respectfully, I disagree strongly. Objects get build on the heap and
> persist even when they go out of scope until
On 8/4/17 7:42 PM, Jon Forrest wrote:
> 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
>>
Tim Daneliuk :
> On 08/04/2017 07:00 PM, Chris Angelico wrote:
>> Again, don't stress about exactly when objects get disposed of; it
>> doesn't matter.
>
> Respectfully, I disagree strongly. Objects get build on the heap and
> persist even when they go out of scope until such
On 08/04/2017 07:00 PM, Chris Angelico wrote:
> Again, don't stress about exactly when objects get
> disposed of; it doesn't matter.
Respectfully, I disagree strongly. Objects get build on the heap and
persist even when they go out of scope until such time garbage
collection takes place. This
On 8/4/2017 7:11 PM, Jon Forrest wrote:
Consider the following Python shell session (Python 3.6.2, Win64):
>>> def givemetwo():
... x = 'two'
... print(id(x))
...
>>> givemetwo()
1578505988392
So far fine. My understanding of object existence made me
think that the object
On Sat, 5 Aug 2017 09:11 am, Jon Forrest wrote:
> Consider the following Python shell session (Python 3.6.2, Win64):
>
> >>> def givemetwo():
> ... x = 'two'
> ... print(id(x))
> ...
> >>> givemetwo()
> 1578505988392
>
> So far fine. My understanding of object existence made
On Sat, Aug 5, 2017 at 9:47 AM, Jon Forrest wrote:
> 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
>
On Sat, Aug 5, 2017 at 9:42 AM, Jon Forrest wrote:
> 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
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
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
'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 what would be the point to
Consider the following Python shell session (Python 3.6.2, Win64):
>>> def givemetwo():
... x = 'two'
... print(id(x))
...
>>> givemetwo()
1578505988392
So far fine. My understanding of object existence made me
think that the object referred to by x would be deleted when
the
24 matches
Mail list logo