[pyar] [Consulta]Programación: constante

Ricardo Araoz ricaraoz en gmail.com
Lun Mar 5 19:40:04 ART 2012


El 05/03/12 07:09, John Rowland Lenton escribió:
> On Mon, 5 Mar 2012 01:05:48 -0300, Lucio Torre <lucio.torre en gmail.com> wrote:
>> 2012/3/5 Facundo Batista <facundobatista en gmail.com>:
>>> Ejemplo:
>>>
>>>  PI = 3.14
>>>
>>> Si vos ves eso en el código, esperás que PI siempre valga 3.14, y que
>>> el código lo use, pero que jamás lo cambie. Es una convención. Python
>>> te trata como un adulto responsable capaz de seguir tal.
>> Que mal ejemplo :)
>>
>> In [1]: import math
>> In [2]: math.pi
>> Out[2]: 3.1415926535897931
> no, qué *buen* ejemplo
>
>>>> import math
>>>> math.pi
> 4.0

Cómo???

PyCrust 0.9.5 - The Flakiest Python Shell
Python 2.6.6 (r266:84292, Feb  4 2012, 06:09:35)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> math.pi
3.1415926535897931
>>>




More information about the pyar mailing list