[pyar] Python variables can have types as values

Claudio Omar Melendrez Baeza claudio.melendrez en gmail.com
Vie Abr 25 20:05:56 ART 2014


En realidad depende de como lo veas.
Si sos de pensar que las "variables" en python no existen en la forma de
*contenedores* sino que son solo aliases o etiquetas que podes poner y
sacar a gusto, sorprende poco esa posibilidad. O sea que "x = 3" no
significa "x vale 3", sino mas bien "x es el nombre de 3".
Asi es mas facil ver otra forma de hacer cosas, como usar dicts para mapear
funcionalidad (en lugar de *ifear* a lo loco), o las miles de cosas copadas
(e incomprensibles) que se pueden hacer con getattr...
Para mi en Python *no hay variables*, *hay sinonimos*.


On 25 April 2014 18:48, Apokalyptica Painkiller <apokalyptica79 en gmail.com>wrote:

> I came across this article by Peter Norvig<https://www.google.com/search?q=Peter+Norvig>
> :
>
> Design Patterns in Dynamic Languages <http://norvig.com/design-patterns/>
>
> (*Peter Norvig* is *Director of Search* at *Google* and a highly
> accomplished computer scientist.)
>
> Haven't read the article fully yet, but scanned it a bit, and one line in
> particular interested me:
>
> "*A variable can have a type as a value*"
>
> That line is on the page with the heading: "*First-Class Dynamic Types*"
>
> So I thought of checking this in Python - that section of the article
> seems to be about Lisp <https://www.google.com/search?q=Lisp> and Dylan
> (the programming language)<http://en.wikipedia.org/wiki/Dylan_(programming_language)>
> ).
>
> Python variables can have types<http://jugad2.blogspot.com.ar/2014/04/python-variables-can-have-types-as.html>
>
> --
> I live each day
> Like it's my last
> I live for rock and roll
> I never look back
>
> I'm a rocker
> Do as I feel as I say
> I'm a rocker
> And no one can take that away
>
>
> _______________________________________________
> pyar mailing list pyar en python.org.ar
> http://listas.python.org.ar/listinfo/pyar
>
> PyAr - Python Argentina - Sitio web: http://www.python.org.ar/
>
> La lista de PyAr esta Hosteada en USLA - Usuarios de Software Libre de
> Argentina - http://www.usla.org.ar
>
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://listas.python.org.ar/pipermail/pyar/attachments/20140425/f7e09dde/attachment.html>


More information about the pyar mailing list