Re: coding style - where to declare variables

2018-07-23 Thread Steven D'Aprano
On Mon, 23 Jul 2018 14:39:56 +0300, Marko Rauhamaa wrote: > Steven D'Aprano : > >> Lambda calculus has the concept of a binding operator, which is >> effectively an assignment operator: it takes a variable and a value and >> binds the value to the variable, changing a free variable to a bound >>

Re: coding style - where to declare variables

2018-07-23 Thread Chris Angelico
On Mon, Jul 23, 2018 at 9:39 PM, Steven D'Aprano wrote: > [1] The CPython interpreter uses pointers; the Jython interpreter uses > whatever kind of memory indirection the JVM provides; when I emulate a > Python interpreter using pencil and paper, there's not a pointer in sight > but a lot of copyi

Re: coding style - where to declare variables

2018-07-23 Thread Steven D'Aprano
On Mon, 23 Jul 2018 09:22:55 +0300, Marko Rauhamaa wrote: > Dennis Lee Bieber : [...] >> In my world, Java and Python are the ones that are not "common". > > Yes, "boxed" is a Java term. However, the programming pattern of using > dynamic memory and pointers is ubiquitous and ancient: Not t

Re: coding style - where to declare variables

2018-07-23 Thread Marko Rauhamaa
Steven D'Aprano : > Lambda calculus has the concept of a binding operator, which is > effectively an assignment operator: it takes a variable and a value > and binds the value to the variable, changing a free variable to a > bound variable. In other words, it assigns the value to the variable, > j

Re: coding style - where to declare variables

2018-07-23 Thread Steven D'Aprano
On Mon, 23 Jul 2018 11:49:37 +0300, Marko Rauhamaa wrote: > People new to Python are unnecessarily confused by talking about names > and binding when it's really just ordinary variables and assignment. It really isn't, not to those people who expect ordinary variables and assignment to be the sa

Re: coding style - where to declare variables

2018-07-23 Thread Ben Bacarisse
Mark Lawrence writes: > On 22/07/18 14:51, Abdur-Rahmaan Janhangeer wrote: >> except local vars >> >> Abdur-Rahmaan Janhangeer >> https://github.com/Abdur-rahmaanJ >> Mauritius >> > > Python doesn't have variables, it has names. I think we should cut beginners (and probably everyone) some slack

Re: coding style - where to declare variables

2018-07-23 Thread Steven D'Aprano
On Mon, 23 Jul 2018 20:24:30 +1200, Gregory Ewing wrote: > Steven D'Aprano wrote: >> So let me see if I understand your argument... >> >> - we should stop using the term "binding", because it means >> nothing different from assignment; >> - binding (a.k.a. "assignment") comes from lambda calcul

Re: coding style - where to declare variables

2018-07-23 Thread Frank Millman
"Marko Rauhamaa" wrote in message news:87zhyitjz2@elektro.pacujo.net... People new to Python are unnecessarily confused by talking about names and binding when it's really just ordinary variables and assignment. It seems to be mostly some sort of marketing lingo that seeks to create an air

Re: coding style - where to declare variables

2018-07-23 Thread Marko Rauhamaa
Ben Finney : > Gregory Ewing writes: > >> Marko is asking us to stop using the word "binding" to refer to >> assignment because of the potential confusion with this other meaning. > > That's about as reasonable as my request that we stop using the term > “variable” for what is, in Python, an un-ty

Re: coding style - where to declare variables

2018-07-23 Thread Ben Finney
Gregory Ewing writes: > Marko is asking us to stop using the word "binding" to refer to > assignment because of the potential confusion with this other meaning. That's about as reasonable as my request that we stop using the term “variable” for what is, in Python, an un-typed reference to an obj

Re: coding style - where to declare variables

2018-07-23 Thread Gregory Ewing
Steven D'Aprano wrote: So let me see if I understand your argument... - we should stop using the term "binding", because it means nothing different from assignment; - binding (a.k.a. "assignment") comes from lambda calculus; - which has no assignment (a.k.a. "binding"). No, that's not what

Re: coding style - where to declare variables

2018-07-22 Thread Marko Rauhamaa
Dennis Lee Bieber : > On Mon, 23 Jul 2018 00:08:00 +0300, Marko Rauhamaa > declaimed the following: > >>I Java terms, all Python values are boxed. That's a very usual pattern >>in virtually all programming languages (apart from FORTRAN). > > FORTRAN, C, COBOL, BASIC, Pascal, ALGOL, BCPL, REX

Re: coding style - where to declare variables

2018-07-22 Thread Abdur-Rahmaan Janhangeer
variables here refers to the user experience of a var np, just a link to the thread/s would mark the end of it Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ Mauritius -- https://mail.python.org/mailman/listinfo/python-list

Re: coding style - where to declare variables

2018-07-22 Thread Mark Lawrence
On 22/07/18 14:51, Abdur-Rahmaan Janhangeer wrote: except local vars Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ Mauritius Python doesn't have variables, it has names. Please can we avoid a long meaningless thread on this subject as it's been discussed a trillion times befor

Re: coding style - where to declare variables

2018-07-22 Thread Steven D'Aprano
On Sun, 22 Jul 2018 17:50:06 -0400, Dennis Lee Bieber wrote: > On Mon, 23 Jul 2018 00:08:00 +0300, Marko Rauhamaa > declaimed the following: > >>I Java terms, all Python values are boxed. That's a very usual pattern >>in virtually all programming languages (apart from FORTRAN). >> >> > FOR

Re: coding style - where to declare variables

2018-07-22 Thread Steven D'Aprano
On Mon, 23 Jul 2018 00:08:00 +0300, Marko Rauhamaa wrote: > Would you call it binding in this case: > >X[0]["z"] = getit() >X[3]["q"] = X[0]["z"] >X[0]["z"].changeit() It is a binding, but it is not a *name* binding. Since we are talking about name bindings, and comparing/contrastin

Re: coding style - where to declare variables

2018-07-22 Thread Steven D'Aprano
On Sun, 22 Jul 2018 22:50:52 +0300, Marko Rauhamaa wrote: > I wish people stopped talking about "name binding" and "rebinding," > which are simply posh synonyms for variable assignment. Properly, the > term "binding" comes from lambda calculus, whose semantics is defined > using "bound" and "free"

Re: coding style - where to declare variables

2018-07-22 Thread Marko Rauhamaa
Richard Damon : >> On Jul 22, 2018, at 3:50 PM, Marko Rauhamaa wrote: >> I wish people stopped talking about "name binding" and "rebinding," >> which are simply posh synonyms for variable assignment. Properly, the >> term "binding" comes from lambda calculus, whose semantics is defined >> using "

Re: coding style - where to declare variables

2018-07-22 Thread Chris Angelico
On Mon, Jul 23, 2018 at 6:14 AM, Marko Rauhamaa wrote: > While FORTRAN or C couldn't operate on functions like this, an assembly > language program could easily. Simply compose a CPU instruction sequence > on the fly, mark it executable and use the "CALL" opcode to transfer > control to your const

Re: coding style - where to declare variables

2018-07-22 Thread Marko Rauhamaa
Bart : > If you did need one of those others to be variable, then you just assign > it to a variable the rare times you need to do that. For example: > > def fn1(): pass > def fn2(): pass > > fn = fn1 if cond else fn2 > > fn1, fn2 will always be functions. fn will always be a variable, but on

Re: coding style - where to declare variables

2018-07-22 Thread Richard Damon
> On Jul 22, 2018, at 3:50 PM, Marko Rauhamaa wrote: > I wish people stopped talking about "name binding" and "rebinding," > which are simply posh synonyms for variable assignment. Properly, the > term "binding" comes from lambda calculus, whose semantics is defined > using "bound" and "free" var

Re: coding style - where to declare variables

2018-07-22 Thread Marko Rauhamaa
r...@zedat.fu-berlin.de (Stefan Ram): >>Rebinding names is near-universal in programming, but usually names >>that are intended to be rebound, such as variables. > > To someone like me who has grown up with a LISP 1 > this is completely natural. > > |>( SETQ A ( LAMBDA () 'ALPHA )) > |(LAMBDA (

Re: coding style - where to declare variables

2018-07-22 Thread Peter J. Holzer
On 2018-07-22 09:36:13 -0400, Richard Damon wrote: > > On Jul 22, 2018, at 8:48 AM, Sharan Basappa > > wrote: > > > > In other programming languages (e.g. C, C++), as a good practice, > > variables are declared right at the start of the program, There is no "start of the program" in C or C++. I

Re: coding style - where to declare variables

2018-07-22 Thread Abdur-Rahmaan Janhangeer
except local vars Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ Mauritius -- https://mail.python.org/mailman/listinfo/python-list

Re: coding style - where to declare variables

2018-07-22 Thread Chris Angelico
On Sun, Jul 22, 2018 at 10:48 PM, Sharan Basappa wrote: > In other programming languages (e.g. C, C++), as a good practice, variables > are declared right at the start of the program, irrespective of where it is > normally used. What is the practice in Python? > > I see that, most of the code, d

Re: coding style - where to declare variables

2018-07-22 Thread Richard Damon
> On Jul 22, 2018, at 8:48 AM, Sharan Basappa wrote: > > In other programming languages (e.g. C, C++), as a good practice, variables > are declared right at the start of the program, irrespective of where it is > normally used. What is the practice in Python? > > I see that, most of the code

coding style - where to declare variables

2018-07-22 Thread Sharan Basappa
In other programming languages (e.g. C, C++), as a good practice, variables are declared right at the start of the program, irrespective of where it is normally used. What is the practice in Python? I see that, most of the code, declare variables where it is used and not at the start of the pro