I thought that del L[i] would slide L[i+1:] one place to the left,
filling the hole, but :
>>> L
[0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
>>> id(L)
4321967496
>>> id(L[5])# address of 50 ?
4297625504
>>> del L[2]
>>> id(L[4]) # new address of 50 ?
4297625504
>>> id(L)
4321967496
So
On 7/6/2017 3:08 AM, Dan Wissme wrote:
I thought that del L[i] would slide L[i+1:] one place to the left,
filling the hole, but :
>>> L
[0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
>>> id(L)
4321967496
>>> id(L[5])# address of 50 ?
4297625504
>>> del L[2]
>>> id(L[4]) # new address
Dan Wissme writes:
> I thought that del L[i] would slide L[i+1:] one place to the left,
> filling the hole, but :
>
L
> [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
id(L)
> 4321967496
id(L[5])# address of 50 ?
> 4297625504
del L[2]
id(L[4]) # new address of 50 ?
>
On Thu, Jul 6, 2017 at 5:35 PM, Jussi Piitulainen
wrote:
> Incidentally, let no one point out that ids are not memory addresses.
> It says in the interactive help that they are (Python 3.4.0):
>
> Help on built-in function id in module builtins:
>
> id(...)
> id(object) -> integer
>
> Retu
Le 06/07/2017 à 09:29, Terry Reedy a écrit :
On 7/6/2017 3:08 AM, Dan Wissme wrote:
I thought that del L[i] would slide L[i+1:] one place to the left,
filling the hole, but :
>>> L
[0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
>>> id(L)
4321967496
>>> id(L[5])# address of 50 ?
4297625504
Le 06/07/2017 à 09:29, Terry Reedy a écrit :
On 7/6/2017 3:08 AM, Dan Wissme wrote:
I thought that del L[i] would slide L[i+1:] one place to the left,
filling the hole, but :
>>> L
[0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
>>> id(L)
4321967496
>>> id(L[5])# address of 50 ?
4297625504
Chris Angelico writes:
> On Thu, Jul 6, 2017 at 5:35 PM, Jussi Piitulainen
> wrote:
>> Incidentally, let no one point out that ids are not memory addresses.
>> It says in the interactive help that they are (Python 3.4.0):
>>
>> Help on built-in function id in module builtins:
>>
>> id(...)
>>
Chris Angelico :
> On Thu, Jul 6, 2017 at 5:35 PM, Jussi Piitulainen
> wrote:
>> Incidentally, let no one point out that ids are not memory addresses.
>> It says in the interactive help that they are (Python 3.4.0):
>> [...]
>
> Sorry, not the case.
> [...]
>
> id(...)
> Return the identity o
On Thu, 6 Jul 2017 06:51 pm, Dan Wissme wrote:
> So what 'del L[i]' do exactly in memory ? Same as L.pop(i) ? with
> complexity O(n-i) ?
It depends on what L is and what the value of i is. If L is a list, and i is the
last index of the list, then deleting it is quick. If i is 0, then Python has
t
On Thu, 6 Jul 2017 07:24 pm, Marko Rauhamaa wrote:
> While talking about addresses might or might not be constructive, let me
> just point out that there is no outwardly visible distinction between
> "address" or "identity".
Er, yes there is. Address refers to a position in space. Identity refer
Marko Rauhamaa writes:
> While talking about addresses might or might not be constructive, let
> me just point out that there is no outwardly visible distinction
> between "address" or "identity".
With a generational or otherwise compacting garbage collector there
would be. I believe that to be a
On Thu, Jul 6, 2017 at 7:24 PM, Marko Rauhamaa wrote:
> While talking about addresses might or might not be constructive, let me
> just point out that there is no outwardly visible distinction between
> "address" or "identity".
>
> Equally well, we could replace those words with:
>
>serial num
On 2017-07-06 15:29, Jussi Piitulainen wrote:
Marko Rauhamaa writes:
While talking about addresses might or might not be constructive, let
me just point out that there is no outwardly visible distinction
between "address" or "identity".
With a generational or otherwise compacting garbage coll
Jussi Piitulainen :
> Marko Rauhamaa writes:
>
>> While talking about addresses might or might not be constructive, let
>> me just point out that there is no outwardly visible distinction
>> between "address" or "identity".
>
> With a generational or otherwise compacting garbage collector there
>
Steve D'Aprano :
> On Thu, 6 Jul 2017 07:24 pm, Marko Rauhamaa wrote:
>
>> While talking about addresses might or might not be constructive, let
>> me just point out that there is no outwardly visible distinction
>> between "address" or "identity".
>
> Er, yes there is. Address refers to a positio
MRAB writes:
> On 2017-07-06 15:29, Jussi Piitulainen wrote:
>> Marko Rauhamaa writes:
>>
>>> While talking about addresses might or might not be constructive,
>>> let me just point out that there is no outwardly visible distinction
>>> between "address" or "identity".
>>
>> With a generational o
Chris Angelico :
> The formal definition is that objects have identities, and that
> assignment (including function parameters and return values) gives you
> a reference to the same object.
My example didn't contain a single assignment, but a variation of your
statement would make a good part in
On Fri, Jul 7, 2017 at 12:56 AM, MRAB wrote:
> Perhaps you should be thinking of it as passing around the end of a piece of
> string, the other end being tied to the object itself. :-)
You mean like Elbonian currency?
http://dilbert.com/strip/2008-09-15
ChrisA
--
https://mail.python.org/mailma
Marko Rauhamaa writes:
> Jussi Piitulainen:
>
>> For me it's enough to know that it's the object itself that is passed
>> around as an argument, as a returned value, as a stored value, as a
>> value of a variable. This is the basic fact that lets me understand
>> the behaviour and performance of p
On Fri, Jul 7, 2017 at 12:59 AM, Marko Rauhamaa wrote:
>> Or you are using "address" in some abstract sense so that the "address"
>> does not change when the internal representation of the object is moved
>> to another location.
>
> "Address" is just a word. In fact, I don't think there is any def
On Fri, Jul 7, 2017 at 1:21 AM, Marko Rauhamaa wrote:
> Steve D'Aprano :
>
>> On Thu, 6 Jul 2017 07:24 pm, Marko Rauhamaa wrote:
>>
>>> While talking about addresses might or might not be constructive, let
>>> me just point out that there is no outwardly visible distinction
>>> between "address" o
On Thu, Jul 6, 2017 at 9:41 AM, Marko Rauhamaa wrote:
> As a good example of the style I'm looking for, take a look at:
>
>https://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html>
Java reference types have basically the same concept of identity as
Python objects, so I dug around to find
Do you better understand what Privy is for now? If so, is there anything in
particular you think could be made more clear in the docs?
--
https://mail.python.org/mailman/listinfo/python-list
Chris Angelico :
> On Fri, Jul 7, 2017 at 1:21 AM, Marko Rauhamaa wrote:
>> What I'm looking for is snippets of Python code that illustrate the
>> difference.
>>
>> That's how you can illustrate the difference between the "==" and "is"
>> operators:
>>
>> >>> ["a"] is ["a"]
>> False
>>
On Fri, Jul 7, 2017 at 3:05 AM, Marko Rauhamaa wrote:
> Chris Angelico :
>
>> On Fri, Jul 7, 2017 at 1:21 AM, Marko Rauhamaa wrote:
>>> What I'm looking for is snippets of Python code that illustrate the
>>> difference.
>>>
>>> That's how you can illustrate the difference between the "==" and "is
On 06/07/17 17:53, [email protected] wrote:
Do you better understand what Privy is for now? If so, is there anything in
particular you think could be made more clear in the docs?
I think the point is that you failed to include any context in your
advert. An unadorned link in a post will
Ian Kelly :
> On Thu, Jul 6, 2017 at 9:41 AM, Marko Rauhamaa wrote:
>> As a good example of the style I'm looking for, take a look at:
>>
>>https://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html>
>
> Java reference types have basically the same concept of identity as
> Python objects,
Marko Rauhamaa :
> Notice that Scheme refers directory to conventional RAM:
s/directory/directly/
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, 7 Jul 2017 01:21 am, Marko Rauhamaa wrote:
> Steve D'Aprano :
>
>> On Thu, 6 Jul 2017 07:24 pm, Marko Rauhamaa wrote:
>>
>>> While talking about addresses might or might not be constructive, let
>>> me just point out that there is no outwardly visible distinction
>>> between "address" or
On 7/6/2017 11:41 AM, Marko Rauhamaa wrote:
Chris Angelico :
The formal definition is that objects have identities, and that
assignment (including function parameters and return values) gives you
a reference to the same object.
My example didn't contain a single assignment, but a variation of
Sorry, finger twitch. Wish there were a minute grace period to recall
such mistakes.
On 7/6/2017 2:16 PM, Terry Reedy wrote:
--
Terry Jan Reedy
--
https://mail.python.org/mailman/listinfo/python-list
In Python, "==" is not a reference equality operator (and I hate Java for
their misuse of the operator), so I absolutely disagree with using the Java
description to describe Python's "==" operator, primarily because, well,
it's wrong. Simple example:
With Python 3.5.2 (should hold for any version
Steve D'Aprano :
> An address is a concrete location or place, in other words a physical
> position in some space, while identity is the abstract state or
> quality of being identical (sameness), in other words a state of
> being.
Whether id() returns one such thing or not can't be discerned by a
On Fri, Jul 7, 2017 at 7:10 AM, Marko Rauhamaa wrote:
> Steve D'Aprano :
>
>> An address is a concrete location or place, in other words a physical
>> position in some space, while identity is the abstract state or
>> quality of being identical (sameness), in other words a state of
>> being.
>
> W
Chris Angelico :
> On Fri, Jul 7, 2017 at 7:10 AM, Marko Rauhamaa wrote:
>> Whether id() returns one such thing or not can't be discerned by a
>> Python program. What's more, for any compliant implementation of id(),
>> you can interpret the returned number as an address in some address
>> space
Steve D'Aprano wrote:
Address refers to a position in space.
Not always. A PO Box number can remain the same when its owner's
location in space changes. And IP addresses notoriously fail to
identify physical locations.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, Jul 7, 2017 at 10:34 AM, Gregory Ewing
wrote:
> Steve D'Aprano wrote:
>>
>> Address refers to a position in space.
>
>
> Not always. A PO Box number can remain the same when its owner's
> location in space changes. And IP addresses notoriously fail to
> identify physical locations.
A posi
I was trying to solve a problem and cannot determine how to filter 0's but not
false.
Given a list like this
["a",0,0,"b",None,"c","d",0,1,False,0,1,0,3,[],0,1,9,0,0,{},0,0,9]
I want to be able to return this list
["a","b",None,"c","d",1,False,1,3,[],1,9,{},9,0,0,0,0,0,0,0,0,0,0]
However if I f
On Wednesday, July 5, 2017 at 4:15:34 PM UTC-5, Terry Reedy wrote:
> On 7/5/2017 12:34 PM, [email protected] wrote:
>
> > I would like know dow can I select and get the value from
> > a list of values uisng widgets.
>
> One way is to learn tkinter and then learn to use the
> Listbox wid
On Thursday, July 6, 2017 at 9:29:29 PM UTC-5, Sayth Renshaw wrote:
> I was trying to solve a problem and cannot determine how to filter 0's but
> not false.
>
> Given a list like this
> ["a",0,0,"b",None,"c","d",0,1,False,0,1,0,3,[],0,1,9,0,0,{},0,0,9]
>
> I want to be able to return this list
On Thu, 06 Jul 2017 19:29:00 -0700, Sayth Renshaw wrote:
> I have tried or conditions of v == False etc but then the 0's being
> false also aren't moved. How can you check this at once?
Maybe this will help:
Python 3.5.3+ (default, Jun 7 2017, 23:23:48)
[GCC 6.3.0 20170516] on linux
I was trying to solve a problem and cannot determine how to filter 0's but
not false.
I'm typing on my phone so can't paste a session, so I will attempt to apply
the Socratic method, and ask: Do you understand why your attempts have
failed so far? In what way are False and 0 the same? In what res
On Fri, 07 Jul 2017 02:48:45 +, Stefan Ram wrote:
def isfalse( x ):
> ... return x == 0 and str( type( x )) == ""
> ...
>
Don't depend on string representations of objects, unless you know what
you're doing. Do this instead:
def isfalse(x):
return x == 0 and type(x) is b
On Friday, 7 July 2017 12:46:51 UTC+10, Rick Johnson wrote:
> On Thursday, July 6, 2017 at 9:29:29 PM UTC-5, Sayth Renshaw wrote:
> > I was trying to solve a problem and cannot determine how to filter 0's but
> > not false.
> >
> > Given a list like this
> > ["a",0,0,"b",None,"c","d",0,1,False,0
On Thursday, July 6, 2017 at 10:00:36 PM UTC-5, Sayth Renshaw wrote:
> Is there an "is not" method that's not != so I can check is not false.
Maybe. Or maybe /not/. :-P"
One way to find out would be to fire up your python
interpretor, and do some interactive testing. Here, allow me
to cinge my ey
On Thursday, July 6, 2017 at 9:57:43 PM UTC-5, Skip Montanaro wrote:
> I was trying to solve a problem and cannot determine how to filter 0's but
> not false.
>
>
> I'm typing on my phone so can't paste a session [...]
I have not tried any for myself, but there are a few Python
installations avail
On Fri, 7 Jul 2017 07:46 am, Chris Angelico wrote:
> A simple name lookup cannot, I believe, be messed with. Nor can a literal.
In principle, you could replace builtins or globals with a custom namespace that
performed some computation on name lookup. You might even be able to insert
some additio
On Fri, 7 Jul 2017 08:56 am, Marko Rauhamaa wrote:
> Google finds a Dutch master's thesis from 2009 that gives formal
> semantics to a subset of Python. I was interested in seeing how it
> treated identity. Lo and behold:
>
>The is operator determines whether its operands are the same object.
On Fri, 7 Jul 2017 10:34 am, Gregory Ewing wrote:
> Steve D'Aprano wrote:
>> Address refers to a position in space.
>
> Not always. A PO Box number can remain the same when its owner's
> location in space changes.
But the PO box itself does not change.
Pedantically, I guess it could: the post o
On Wednesday, September 22, 2010 at 4:01:04 AM UTC+5:30, Hellmut Weber wrote:
> Hi list,
> I'm looking for a possibility to access the partiton inforamtion of a
> hard disk of my computer from within a python program.
>
> Googling I found the module 'parted' but didn't see any possibility to
> get
Can I somehow check from inside a Python script if the executing Python engine
is major version v2 or v3?
I am thinking about a code similar to
if (os.python-majorversion<3)
print hello
else
print (hello)
Additional question:
Is there a way to execute a python script with v3 python engine
Steve D'Aprano :
> On Fri, 7 Jul 2017 08:56 am, Marko Rauhamaa wrote:
>
>> Google finds a Dutch master's thesis from 2009 that gives formal
>> semantics to a subset of Python. I was interested in seeing how it
>> treated identity. Lo and behold:
>>
>>The is operator determines whether its ope
On Fri, 7 Jul 2017 01:41 am, Marko Rauhamaa wrote:
> Here's how identity is dealt with in First-Order Logic:
>
>https://en.wikipedia.org/wiki/First-order_logic#Semantics>
>
> In other words, identity is mapped to the "sameness" in a domain of
> discourse.
Define "sameness".
> In Second-
On Fri, 7 Jul 2017 03:05 am, Marko Rauhamaa wrote:
> I believe the concept of an object is among the more difficult things
> for novice programmers to get.
True, but that has nothing to do with object identity. Inheritance, "is-a"
versus "has-a" relationships, when to write len(x) versus x.len()
On Fri, 7 Jul 2017 03:38 am, Marko Rauhamaa wrote:
> Notice that Scheme refers directory to conventional RAM:
>
> Variables and objects such as pairs, vectors, and strings implicitly
> denote locations
That implies that it is impossible to implement Scheme:
- using a programming language where
55 matches
Mail list logo