Re: Fwd: About the Python

2023-01-02 Thread Michael Torrie
On 1/1/23 22:27, Ramya M wrote: > This is from JNN College of Engineering, Shimoga. we are facing some > problems while using python. Please can you resolve this issue. Without any further information on your part, we can only guess at what the problems might be. Crystal ball says that Thomas' su

Re: Fwd: About the Python

2023-01-02 Thread Mats Wichmann
will not need any of the new features that 3.11 may provide. On 1/2/2023 12:27 AM, Ramya M wrote: -- Forwarded message - From: Ramya M Date: Mon, Jan 2, 2023, 9:58 AM Subject: About the Python To: This is from JNN College of Engineering, Shimoga. we are facing some problems

Re: Fwd: About the Python

2023-01-02 Thread Thomas Passin
that 3.11 may provide. On 1/2/2023 12:27 AM, Ramya M wrote: -- Forwarded message - From: Ramya M Date: Mon, Jan 2, 2023, 9:58 AM Subject: About the Python To: This is from JNN College of Engineering, Shimoga. we are facing some problems while using python. Please can you

Fwd: About the Python

2023-01-02 Thread Ramya M
-- Forwarded message - From: Ramya M Date: Mon, Jan 2, 2023, 9:58 AM Subject: About the Python To: This is from JNN College of Engineering, Shimoga. we are facing some problems while using python. Please can you resolve this issue. We are using python 3.11.1 (64 bit) for

about the function in class

2020-07-17 Thread xuanwu348
Hi, all There are some methods to define functions in a class, include member functions, static method, class method. My question is that which type of function for "decorate(f),diff_con(f)" I think these functions all were belong to member function, (f <-->self) f can be replace by sel

Re: WHY it compains about the missing argument is WHAT i don't understand

2019-10-08 Thread dieter
x27; This error indicates that `listall` is called by the `bottle` function wrapper without positional argument. > listall() is `/` route's callback function and i never inside my script i > call listall( pymydb ). > Why it compains about the missing argument is WHAT i don't

WHY it compains about the missing argument is WHAT i don't understand

2019-10-08 Thread Νίκος Βέργος
required positional argument: 'pymydb' listall() is `/` route's callback function and i never inside my script i call listall( pymydb ). Why it compains about the missing argument is WHAT i don't understand. -- https://mail.python.org/mailman/listinfo/python-list

Re: About the #python irc channel on freenode.

2019-08-13 Thread Calvin Spealman
The #python channel only allows registered Freenode users in. You can learn about registration on Freenode here: https://freenode.net/kb/answer/registration Once you've got a registered account you can join #python and should find many helpful people ready to help you. On Mon, Aug 12, 2019 at 8:0

Re: About the #python irc channel on freenode.

2019-08-12 Thread David
On Tue, 13 Aug 2019 at 10:00, Hongyi Zhao wrote: > > But I always be put into the #python-unregistered channel as follows: > > -- > Now talking on #python-unregistered > * Topic for #python-unregistered is: Welcome to #python-unregistered! > You've been put here because #python requires yo

Re: About the #python irc channel on freenode.

2019-08-12 Thread Hongyi Zhao
On Mon, 12 Aug 2019 16:13:41 -0700, Paul Rubin wrote: > It's always worked ok for me. But I always be put into the #python-unregistered channel as follows: -- Now talking on #python-unregistered * Topic for #python-unregistered is: Welcome to #python-unregistered! You've been put here b

About the #python irc channel on freenode.

2019-08-12 Thread Hongyi Zhao
Hi, Sorry for bothering here for this not technically python issue. I want to chat some issues on the #python irc channel hosted on freenode. But try so many times still cann't succeed. Could anyone here give me some hint if you can successfully do this thing? Regards -- .: Hongyi Zhao [ ho

Re: problem about the installation

2019-06-17 Thread Igor Korot
Hi, On Mon, Jun 17, 2019 at 4:43 AM David Martin wrote: > > Hello there! > > > My computer windows is 8 and the operating system is 32-bit operating > system, based upon x64 processor but I got a problem during installation, > could you please assist me about this? > I appreciate your efforts in

problem about the installation

2019-06-17 Thread David Martin
Hello there! My computer windows is 8 and the operating system is 32-bit operating system, based upon x64 processor but I got a problem during installation, could you please assist me about this? I appreciate your efforts in advance. Thanks Yours sincerely YarDel Daudy

Re: Questions about the IO modules and C-api

2019-06-03 Thread eryk sun
On 6/2/19, Windson Yang wrote: > > f = open('myfile, 'a+b') This is missing the closing quote around 'myfile'. > I added a printf statement at the beginning of _io_open_impl Repeatedly rebuilding the interpreter sounds like a frustrating learning experience, IMO. Use a debugger such as gdb

Re: Questions about the IO modules and C-api

2019-06-02 Thread Thomas Jollans
On 03/06/2019 04:02, Windson Yang wrote: > I have some questions about the IO modules. > > 1. My script: > > f = open('myfile, 'a+b') > f.close() > > I added a printf statement at the beginning of _io_open_impl > <https://github.com/pytho

Questions about the IO modules and C-api

2019-06-02 Thread Windson Yang
I have some questions about the IO modules. 1. My script: f = open('myfile, 'a+b') f.close() I added a printf statement at the beginning of _io_open_impl <https://github.com/python/cpython/blob/master/Modules/_io/_iomodule.c#L233>, the output is: _io_open

Re: Question about the @staticmethod decorator

2019-03-18 Thread Terry Reedy
On 3/17/2019 2:15 PM, Arup Rakshit wrote: I am reading a book where the author says that: In principle, it would also be possible to implement any @staticmethod completely outside of the class at module scope without any loss of functionality — so you may want to consider carefully whether a p

Re: Question about the @staticmethod decorator

2019-03-17 Thread Cameron Simpson
int("Hello", name) @staticmethod def say_hello2(name): print("Hello", name) You can call either from an instance: someone.say_hello("Arup") and get the same result. However, a linter will complain about the former say_hello() method because the parameter &q

Re: Question about the @staticmethod decorator

2019-03-17 Thread Paul Moore
On Sun, 17 Mar 2019 at 18:18, Arup Rakshit wrote: > > I am reading a book where the author says that: > > In principle, it would also be possible to implement any @staticmethod > completely outside of the class at module scope without any loss of > functionality — so you may want to consider car

Question about the @staticmethod decorator

2019-03-17 Thread Arup Rakshit
I am reading a book where the author says that: In principle, it would also be possible to implement any @staticmethod completely outside of the class at module scope without any loss of functionality — so you may want to consider carefully whether a particular function should be a module scope

Re: Question about the definition of the value of an object

2018-11-19 Thread Iwo Herka
> Attempting to define value here would be at best a massive > distraction from the concepts the documentation is trying > to get across. > There is one very simple definition of "value" which is entirely > accurate, but probably not helpful, and that is: An object's > value is whatever it is equa

Re: Question about the definition of the value of an object

2018-11-19 Thread Chris Angelico
On Tue, Nov 20, 2018 at 3:08 AM Iwo Herka wrote: > > Hello everyone, > > I've been looking for something in the documentation > (https://docs.python.org/3.8/reference/datamodel.html) recently > and I've noticed something weird. Documentation states that every > object has a value, but doesn’t prov

Re: Question about the definition of the value of an object

2018-11-19 Thread Terry Reedy
On 11/19/2018 9:08 AM, Iwo Herka wrote: Hello everyone, I've been looking for something in the documentation (https://docs.python.org/3.8/reference/datamodel.html) recently and I've noticed something weird. Documentation states that every object has a value, but doesn’t provide any definition wh

Re: Question about the definition of the value of an object

2018-11-19 Thread Rhodri James
On 19/11/2018 14:08, Iwo Herka wrote: I've been looking for something in the documentation (https://docs.python.org/3.8/reference/datamodel.html) recently and I've noticed something weird. Documentation states that every object has a value, but doesn’t provide any definition whatsoever of what th

Question about the definition of the value of an object

2018-11-19 Thread Iwo Herka
"b", "c"} or ("a", "b", "c")? In another words, does the value retain information about the order? I would think so, since "(a, b, c) != (a, c, b)" but it's not obvious if we define value as "all the data the object holds" or

Re: About the implementation of del in Python 3

2017-07-07 Thread Gregory Ewing
Random832 wrote: What's not abstract is that if an object has address X and is N bytes long, those bytes (and any larger subobjects) occupy a contiguous range of addresses between X and X+(N-1). If you're talking about Python objects, that's not necessarily true -- there's no requirement that a

Re: About the implementation of del in Python 3

2017-07-07 Thread Ian Kelly
On Fri, Jul 7, 2017 at 8:41 AM, Nathan Ernst wrote: > Looks like single expression statements are handled a bit differently than > multiple expression statements: > > Python 3.5.2 (default, Nov 17 2016, 17:05:23) > [GCC 5.4.0 20160609] on linux > Type "help", "copyright", "credits" or "license" fo

Re: About the implementation of del in Python 3

2017-07-07 Thread Ian Kelly
On Thu, Jul 6, 2017 at 12:56 PM, Nathan Ernst wrote: > 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. Si

Re: About the implementation of del in Python 3

2017-07-07 Thread Random832
On Fri, Jul 7, 2017, at 10:41, Nathan Ernst wrote: > Looks like single expression statements are handled a bit differently > than > multiple expression statements: > > Python 3.5.2 (default, Nov 17 2016, 17:05:23) > [GCC 5.4.0 20160609] on linux > Type "help", "copyright", "credits" or "license" f

Re: About the implementation of del in Python 3

2017-07-07 Thread Random832
On Fri, Jul 7, 2017, at 04:12, Gregory Ewing wrote: > Only if you interpret the word "address" very narrowly. > > By the way, even the low-level notion of "address" that C > programs deal with is, on most modern hardware, a *virtual* > address that goes through a level of translation before it > i

Re: About the implementation of del in Python 3

2017-07-07 Thread Nathan Ernst
Looks like single expression statements are handled a bit differently than multiple expression statements: Python 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> n = 4000; m = 4000; n is m True >>> n =

Re: About the implementation of del in Python 3

2017-07-07 Thread Chris Angelico
On Fri, Jul 7, 2017 at 9:48 PM, Marko Rauhamaa wrote: > Chris Angelico : > >> On Fri, Jul 7, 2017 at 7:15 PM, Marko Rauhamaa wrote: >>> You can only define the semantics of Python (in this case) by >>> providing an *arbitrary* mapping to an imaginary abstract machine. >>> There's no way to define

Re: About the implementation of del in Python 3

2017-07-07 Thread Marko Rauhamaa
Chris Angelico : > On Fri, Jul 7, 2017 at 7:15 PM, Marko Rauhamaa wrote: >> You can only define the semantics of Python (in this case) by >> providing an *arbitrary* mapping to an imaginary abstract machine. >> There's no way to define the objective abstraction. > > So aside from an artificial se

Re: About the implementation of del in Python 3

2017-07-07 Thread Chris Angelico
On Fri, Jul 7, 2017 at 7:15 PM, Marko Rauhamaa wrote: > Chris Angelico : > >> On Fri, Jul 7, 2017 at 6:43 PM, Marko Rauhamaa wrote: >>> Python's integer object 0 might be equated with the (mathematical) >>> natural number 18974387634. Python code would have no way of >>> introspecting that natura

Re: About the implementation of del in Python 3

2017-07-07 Thread Marko Rauhamaa
Chris Angelico : > On Fri, Jul 7, 2017 at 6:43 PM, Marko Rauhamaa wrote: >> Python's integer object 0 might be equated with the (mathematical) >> natural number 18974387634. Python code would have no way of >> introspecting that natural number. >> >> The execution model would determine what prope

Re: About the implementation of del in Python 3

2017-07-07 Thread Chris Angelico
On Fri, Jul 7, 2017 at 6:58 PM, Marko Rauhamaa wrote: > Steve D'Aprano : > >> But the Python virtual machine doesn't require objects to have an >> address at all. > > That's an interesting question. Is it possible to define formal > semantics for Python without the notion of an address (under some

Re: About the implementation of del in Python 3

2017-07-07 Thread Marko Rauhamaa
Steve D'Aprano : > But the Python virtual machine doesn't require objects to have an > address at all. That's an interesting question. Is it possible to define formal semantics for Python without the notion of an address (under some name)? Ultimately it seems necessary to have an enumerable set (

Re: About the implementation of del in Python 3

2017-07-07 Thread Marko Rauhamaa
t sounds to me like this has defined equality, not identity, right? > > In mathematics, I believe that equality and identity in this sense are > the same, and we could spell the mathematical operator "=" as "is" > instead. Mathematicians call the principle "exte

Re: About the implementation of del in Python 3

2017-07-07 Thread Chris Angelico
On Fri, Jul 7, 2017 at 6:43 PM, Marko Rauhamaa wrote: > Steve D'Aprano : > >> On Fri, 7 Jul 2017 07:10 am, Marko Rauhamaa wrote: >> >>> I believe identity can be defined much better, in numerous isomorphic >>> ways in fact. >>> >>> For example, we could equate each object with a sequence number >>

Re: About the implementation of del in Python 3

2017-07-07 Thread Steve D'Aprano
on interpreter in your own brain by executing in your own head some code that you read. Where in your brain do the objects (the values) live? From everything we know about the brain, they will be distributed across great big swaths of the brain, over billions of neurons, and there is nowhere we co

Re: About the implementation of del in Python 3

2017-07-07 Thread Marko Rauhamaa
Steve D'Aprano : > On Fri, 7 Jul 2017 07:10 am, Marko Rauhamaa wrote: > >> I believe identity can be defined much better, in numerous isomorphic >> ways in fact. >> >> For example, we could equate each object with a sequence number >> (unrelated with its id()). You can define that the "None" obje

Re: About the implementation of del in Python 3

2017-07-07 Thread Steve D'Aprano
On Fri, 7 Jul 2017 06:05 pm, Gregory Ewing wrote: > Steve D'Aprano wrote: >> In practice, identity is hardly important in Python, except for a few limited >> cases, and the prohibition against using `is` when you mean `==`. > > On the contrary, it's a very important concept needed to make > sense

Re: About the implementation of del in Python 3

2017-07-07 Thread Steve D'Aprano
e that equality and identity in this sense are the same, and we could spell the mathematical operator "=" as "is" instead. Mathematicians normally use the word "identity" to refer to things like the identity function f(x) -> x, or the identity matrix [1 0][0 1] say, or th

Re: About the implementation of del in Python 3

2017-07-07 Thread Steve D'Aprano
On Fri, 7 Jul 2017 05:29 pm, Dan Wissme wrote: > Strange behavior in Python 3.6.0 > >>> i = 3000 > >>> j = 3000 > >>> i is j > False > >>> n = 4000 ; m = 4000 ; n is m > True The Python interpreter is allowed to cache integers and reuse them. The interactive interpreter sometimes does so: if you

Re: About the implementation of del in Python 3

2017-07-07 Thread Gregory Ewing
Steve D'Aprano wrote: That implies that it is impossible to implement Scheme: - using a programming language where variables and objects may move during their lifetime; - or using a computing device without conventional memory, e.g. implementing Scheme using hydraulics, DNA computing, clockwork

Re: About the implementation of del in Python 3

2017-07-07 Thread Gregory Ewing
Marko Rauhamaa wrote: In Second-Order Logic, you can define identity directly: ∀x ∀y x = y ↔ ∀P (P(x) ↔ P(y)) That looks more like a definition of *equality* to me. In mathematics, everything is immutable, so there isn't really any distinction between equality and identity. -- Greg -- ht

Re: About the implementation of del in Python 3

2017-07-07 Thread Gregory Ewing
Steve D'Aprano wrote: In practice, identity is hardly important in Python, except for a few limited cases, and the prohibition against using `is` when you mean `==`. On the contrary, it's a very important concept needed to make sense of the way things behave when mutation is involved. Witness

Re: About the implementation of del in Python 3

2017-07-07 Thread Chris Angelico
On Fri, Jul 7, 2017 at 5:29 PM, Dan Wissme wrote: > Strange behavior in Python 3.6.0 i = 3000 j = 3000 i is j > False n = 4000 ; m = 4000 ; n is m > True Firstly, remember that immutables are allowed, but not required, to be shared. So this kind of "strange behaviour" is compl

Re: About the implementation of del in Python 3

2017-07-07 Thread Chris Angelico
On Fri, Jul 7, 2017 at 4:43 PM, Steve D'Aprano wrote: > On Fri, 7 Jul 2017 01:41 am, Marko Rauhamaa wrote: >> In Second-Order Logic, you can define identity directly: >> >> ∀x ∀y x = y ↔ ∀P (P(x) ↔ P(y)) > > Translating to English: > > For all x, for all y, x equals y if and only if for all P

Re: About the implementation of del in Python 3

2017-07-07 Thread Robin Becker
On 07/07/2017 07:42, Steve D'Aprano wrote: On Fri, 7 Jul 2017 03:05 am, Marko Rauhamaa wrote: ... [1] It may actually be instinctive -- there are studies that show that even young babies express surprise when they see something that violates the intuitive properties of identity. For e

Re: About the implementation of del in Python 3

2017-07-07 Thread Dan Wissme
Le 06/07/2017 à 20:56, Nathan Ernst a écrit : 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:

Re: About the implementation of del in Python 3

2017-07-07 Thread Steve D'Aprano
On Fri, 7 Jul 2017 07:10 am, Marko Rauhamaa wrote: > I believe identity can be defined much better, in numerous isomorphic > ways in fact. > > For example, we could equate each object with a sequence number > (unrelated with its id()). You can define that the "None" object is in > fact the natura

Re: About the implementation of del in Python 3

2017-07-07 Thread Steve D'Aprano
On Fri, 7 Jul 2017 07: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. > > Wh

Re: About the implementation of del in Python 3

2017-07-07 Thread Marko Rauhamaa
Steve D'Aprano : > 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: > > - us

Re: About the implementation of del in Python 3

2017-07-06 Thread Steve D'Aprano
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

Re: About the implementation of del in Python 3

2017-07-06 Thread Steve D'Aprano
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()

Re: About the implementation of del in Python 3

2017-07-06 Thread Steve D'Aprano
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-

Re: About the implementation of del in Python 3

2017-07-06 Thread Marko Rauhamaa
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

Re: About the implementation of del in Python 3

2017-07-06 Thread Steve D'Aprano
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

Re: About the implementation of del in Python 3

2017-07-06 Thread 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 operands are the same object.

Re: About the implementation of del in Python 3

2017-07-06 Thread Steve D'Aprano
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

Re: About the implementation of del in Python 3

2017-07-06 Thread Chris Angelico
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

Re: About the implementation of del in Python 3

2017-07-06 Thread Gregory Ewing
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

Re: About the implementation of del in Python 3

2017-07-06 Thread Marko Rauhamaa
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

Re: About the implementation of del in Python 3

2017-07-06 Thread Chris Angelico
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

Re: About the implementation of del in Python 3

2017-07-06 Thread Marko Rauhamaa
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

Re: About the implementation of del in Python 3

2017-07-06 Thread Nathan Ernst
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

Re: About the implementation of del in Python 3

2017-07-06 Thread Terry Reedy
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

Re: About the implementation of del in Python 3

2017-07-06 Thread Terry Reedy
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

Re: About the implementation of del in Python 3

2017-07-06 Thread Steve D'Aprano
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

Re: About the implementation of del in Python 3

2017-07-06 Thread Marko Rauhamaa
Marko Rauhamaa : > Notice that Scheme refers directory to conventional RAM: s/directory/directly/ -- https://mail.python.org/mailman/listinfo/python-list

Re: About the implementation of del in Python 3

2017-07-06 Thread Marko Rauhamaa
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,

Re: About the implementation of del in Python 3

2017-07-06 Thread Chris Angelico
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

Re: About the implementation of del in Python 3

2017-07-06 Thread Marko Rauhamaa
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 >>

Re: About the implementation of del in Python 3

2017-07-06 Thread 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, so I dug around to find

Re: About the implementation of del in Python 3

2017-07-06 Thread Chris Angelico
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

Re: About the implementation of del in Python 3

2017-07-06 Thread Chris Angelico
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

Re: About the implementation of del in Python 3

2017-07-06 Thread Jussi Piitulainen
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

Re: About the implementation of del in Python 3

2017-07-06 Thread Chris Angelico
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

Re: About the implementation of del in Python 3

2017-07-06 Thread Marko Rauhamaa
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

Re: About the implementation of del in Python 3

2017-07-06 Thread Jussi Piitulainen
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

Re: About the implementation of del in Python 3

2017-07-06 Thread Marko Rauhamaa
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

Re: About the implementation of del in Python 3

2017-07-06 Thread Marko Rauhamaa
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 >

Re: About the implementation of del in Python 3

2017-07-06 Thread MRAB
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

Re: About the implementation of del in Python 3

2017-07-06 Thread Chris Angelico
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

Re: About the implementation of del in Python 3

2017-07-06 Thread 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 would be. I believe that to be a

Re: About the implementation of del in Python 3

2017-07-06 Thread 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 position in space. Identity refer

Re: About the implementation of del in Python 3

2017-07-06 Thread Steve D'Aprano
then Python has to copy the entire list over by one slot, which will probably be O(n) slow. If you care about the performance of this, then you probably shouldn't use a list. Consider using collections.deque, which is optimized to be fast to insert or delete items at both ends. (But it is s

Re: About the implementation of del in Python 3

2017-07-06 Thread Marko Rauhamaa
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

Re: About the implementation of del in Python 3

2017-07-06 Thread Dan Wissme
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

Re: About the implementation of del in Python 3

2017-07-06 Thread Jussi Piitulainen
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(...) >>

Re: About the implementation of del in Python 3

2017-07-06 Thread Dan Wissme
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

Re: About the implementation of del in Python 3

2017-07-06 Thread 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): > > Help on built-in function id in module builtins: > > id(...) > id(object) -> integer > > Retu

Re: About the implementation of del in Python 3

2017-07-06 Thread Jussi Piitulainen
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 ? >

Re: About the implementation of del in Python 3

2017-07-06 Thread Terry Reedy
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

About the implementation of del in Python 3

2017-07-06 Thread Dan Wissme
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

Re: I am comfused about the name behavior of Python in recursion

2016-10-06 Thread alister
On Wed, 05 Oct 2016 17:30:22 -0700, 380162267qq wrote: > Google told me Python name is a label attaching to the object. > But in this recursive function,the name 'a' will point to different > number object. > > def rec(a): > a+=1 if a<10: > rec(a) > print(a) > > rec(0)

Re: I am comfused about the name behavior of Python in recursion

2016-10-05 Thread Gregory Ewing
38016226...@gmail.com wrote: def rec(a): a+=1 if a<10: rec(a) print(a) rec(0) gives me 101 normally.Why it works? Because of the stack memory management? Yes. There isn't just one 'a' here, there's a different one each time rec is called. Thank yo

Re: I am comfused about the name behavior of Python in recursion

2016-10-05 Thread Ben Finney
38016226...@gmail.com writes: > Google told me Python name is a label attaching to the object. Well, “Google told me” has no necessary bearing on whether it's true :-) so that's not a good citation to give. If you need to know what Python terminology means, the Python documentation is better.

I am comfused about the name behavior of Python in recursion

2016-10-05 Thread 380162267qq
Google told me Python name is a label attaching to the object. But in this recursive function,the name 'a' will point to different number object. def rec(a): a+=1 if a<10: rec(a) print(a) rec(0) gives me 101 normally.Why it works? Because of the stack

  1   2   3   4   5   >