[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Please improve these comprehensions (was meaning of [ ])

On Wed, 06 Sep 2017 01:31:56 +0000, Stefan Ram wrote:

> Steve D'Aprano <steve+python at pearwood.info> writes:
>>On Wed, 6 Sep 2017 12:19 am, Rustom Mody wrote:
>>>And how do you write even the simplest assignment statement without a
>>>(mathematical) expression on the rhs?
>>name = other_name is not a mathematical expression. Its giving something
>>a new name.
>   In mathematics, every author is free to give his own definitions to
>   concepts and create his own notation.
>   Of course, definitions of the form
> x := 2 y := x

Indeed they do. Perhaps I should have said that the Python assignment

name = other_name

is not *necessarily* a mathematical expression, but can also be used to 
give an object a new name.

We can argue whether mathematics has assignment at all, or merely has 
definitions. That's a level of hair-splitting where I'm happy to sit on 
the fence and not give an opinion as to whether the mathematical 

    y = 2

is or is not the same as the Python assignment:

    y = 2

Steven D'Aprano
?You are deluded if you think software engineers who can't write 
operating systems or applications without security holes, can write 
virtualization layers without security holes.? ?Theo de Raadt