code review

Martin P. Hellwig martin.hellwig at gmail.com
Fri Jun 29 16:27:54 EDT 2012


On Friday, 29 June 2012 20:41:11 UTC+1, Alister  wrote:
> On Fri, 29 Jun 2012 09:03:22 -0600, Littlefield, Tyler wrote:
> 
> > On 6/29/2012 1:31 AM, Steven D'Aprano wrote:
> >> On Thu, 28 Jun 2012 20:58:15 -0700, alex23 wrote:
> >>
> >>> On Jun 29, 12:57 pm, "Littlefield, Tyler" <ty... at tysdomain.com> wrote:
> >>>> I was curious if someone wouldn't mind poking at some code. The
> >>>> project page is at:http://code.google.com/p/pymud Any information is
> >>>> greatly appreciated.
> >>> I couldn't find any actual code at that site, the git repository is
> >>> currently empty.
> > 
> > OOPS, sorry. Apparently I'm not as good with git as I thought.
> > Everything's in the repo now.
> 
> I am no expert but from what have picked up so far
> 
> from x import 
> 
>  is frowned upon in most cases 

from x import * is frowned upon, however, from x import y is fine IMHO.
> 
> also this section in main strikes me as a bit odd and convoluted
> 
>     w = world()
>     serv = server(client)
>     w.server = serv
>     serv.world = w
> 
> I think you are cross referencing classes & would be better to 
> investigate inheritance.
> 

Generally speaking, read PEP8 and apply it please, there are tools like pylint that can help you with that. It also seems you are doing things quite java like, but I guess that is just a thing of getting used to python.

If you are planning to let your code being used like a framework that is extended by others, try to avoid more advanced functions just because they seem handy, always ask yourself is it clearer?

Try to unit-test your code and try to gain some decent code coverage, that will increase maturity of your code rather quickly.

But for the rest it looks like you are good in organizing it all in sub-modules, which is a very nice thing to see.

Good luck!

-- 
mph



More information about the Python-list mailing list