[Tutor] Need help in making this code more pythonic

ammar azif ceasar102 at yahoo.com
Sun Jul 26 13:35:18 CEST 2009


Sorry I forgot to attach the code file.
Here it is.


--- On Sun, 7/26/09, ammar azif <ceasar102 at yahoo.com> wrote:

From: ammar azif <ceasar102 at yahoo.com>
Subject: [Tutor] Need help in making this code more pythonic
To: tutor at python.org
Date: Sunday, July 26, 2009, 6:23 AM

Hello,

I need some suggestions on how to make this code pythonic. The program basically runs a simulation of an object that moves on a 2D plane. The object keeps on moving from its current coordinate to  randomly picked adjacent coordinates with the object is not allowed to move move to a previously covered coordinate point as the rule. If the object is unable to move the program will terminate. Some of the concerns I have in mind is the code in the move method in Person class. I am sure there are some built-in methods or features in python that I could use to improve the implementation of that method. Hope you guys can enlighten me.





      
-----Inline Attachment Follows-----

_______________________________________________
Tutor maillist  -  Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090726/da358a92/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: personmoving.py
Type: text/x-python
Size: 2493 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/tutor/attachments/20090726/da358a92/attachment.py>


More information about the Tutor mailing list