[Tutor] Pythonese/Efficiency/Generalese critique please
Lee Cullens
leec03273 at mac.com
Sun Jun 5 17:45:28 CEST 2005
Such would serve to pull the test and the reason for it together -
more obvious.
Which is a good point in writing code that others may read.
Thanks Liam
On Jun 5, 2005, at 9:29 AM, Liam Clarke wrote:
>
>
> > There is no need for the if(dlst); if the list is empty the
> iteration will do nothing. You can write this as
> > for dlf in os.listdir(pname):
>
> Though it is quite distant, there is an else statement which makes
> the if construct a requierement.
>
> Javier
>
>
> You could just do -
>
> if not len(dlst):
> #Your else code block here
>
> for dlf in os.listdir(pname):
>
> and so forth.
>
>
>
> --
> 'There is only one basic human right, and that is to do as you damn
> well please.
> And with it comes the only basic human duty, to take the
> consequences.'
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
More information about the Tutor
mailing list