-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/26/2010 01:41 AM, Eduardo Matus wrote:
> cuidado con los caracteres especiales
>  def age(self):
>        diff = (datetime.date.today() - self.birth_date).days
>        years = str(int(diff/365))
>        return unicode(years + ' años')

¿Y los años bisiestos?.

Lo más obvio sería restar los años, y luego sumarle uno si el día y mes
actual es igual o superior al día y mes de nacimiento. Así es como lo
hacemos los humanos.

- -- 
Jesus Cea Avion                         _/_/      _/_/_/        _/_/_/
j...@jcea.es - http://www.jcea.es/     _/_/    _/_/  _/_/    _/_/  _/_/
jabber / xmpp:j...@jabber.org         _/_/    _/_/          _/_/_/_/_/
.                              _/_/  _/_/    _/_/          _/_/  _/_/
"Things are not so easy"      _/_/  _/_/    _/_/  _/_/    _/_/  _/_/
"My name is Dump, Core Dump"   _/_/_/        _/_/_/      _/_/  _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQCVAwUBS4daMJlgi5GaxT1NAQItfAP+IBP53rS+5GG/QYUDn9ohqEx8BdQuSvN4
eLfNfviHbXTXYdyoS0bpRFGxo18KRhm8Pv/JiXYMbt5hDgCHAw+NvOK+eyqiB99V
P5BY/ZrU5dUEQNhgx+vgSGU0MAoQfb5pZWR5rEQyw8xgoCst3+tyhqTR75xTSG+d
yaL1gj26cMg=
=gHdi
-----END PGP SIGNATURE-----
_______________________________________________
Python-es mailing list
Python-es@python.org
http://mail.python.org/mailman/listinfo/python-es
FAQ: http://python-es-faq.wikidot.com/

Responder a