[Python-talk] Can I do this in python?

Larry Keber lakkal at gmail.com
Wed Aug 26 15:17:00 EDT 2009


bruce.labitt at autoliv.com wrote:
> Simpler type question...
>
> Can one do the following?
>
> if ( function(a, b) == True ):
>         dosomething
> else:
>         dosomethingelse
>
>   

The "== True" part is redundant. You could just say:

if function(a,b):
    dostuff
else:
    dootherstuff

> What I have in mind is a function which sends data and returns True if 
> complete.
>
> Instead of an if, could I use a while?  Will the function be evaluated 
> every pass of the loop?
>
>   

The function will be executed each time. 

while function(a,b):
    dostuff

is also valid.

Larry

> Thanks!
>
> Bruce Labitt
> Autoliv Electronics
> 1011B Pawtucket Blvd, PO Box 1858
> Lowell, MA  01853
>
> Email: bruce.labitt at autoliv.com. 
> Tel:  (978) 674-6526
> Fax: (978) 674-6581 
>
> ******************************
> Neither the footer nor anything else in this E-mail is intended to or constitutes an <br>electronic signature and/or legally binding agreement in the absence of an <br>express statement or Autoliv policy and/or procedure to the contrary.<br>This E-mail and any attachments hereto are Autoliv property and may contain legally <br>privileged, confidential and/or proprietary information.<br>The recipient of this E-mail is prohibited from distributing, copying, forwarding or in any way <br>disseminating any material contained within this E-mail without prior written <br>permission from the author. If you receive this E-mail in error, please <br>immediately notify the author and delete this E-mail.  Autoliv disclaims all <br>responsibility and liability for the consequences of any person who fails to <br>abide by the terms herein. <br>
> ******************************
> _______________________________________________
> Python-talk mailing list
> Python-talk at dlslug.org
> http://dlslug.org/mailman/listinfo/python-talk
>   



More information about the Python-talk mailing list