Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #74831 > unrolled thread

Re: What's the proper style for a library string function?

Started byMark Lawrence <breamoreboy@yahoo.co.uk>
First post2014-07-19 20:14 +0100
Last post2014-07-19 20:14 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: What's the proper style for a library string function? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-07-19 20:14 +0100

#74831 — Re: What's the proper style for a library string function?

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2014-07-19 20:14 +0100
SubjectRe: What's the proper style for a library string function?
Message-ID<mailman.12059.1405797273.18130.python-list@python.org>
On 19/07/2014 18:38, C.D. Reimer wrote:
> Greetings,
>
> I typically write a Python 2.7 string function in my library like this:
>
>      def getCompletedTime(start, end): return "Time completed:", str(end
> - start)
>

Further to my earlier post are you aware of the behaviour of your 
"string function"?

 >>> def getCompletedTime(start, end): return "Time completed:", str(end 
- start)
...
 >>> t = getCompletedTime(0, -1)
 >>> type(t)
<class 'tuple'>
 >>> t[0]
'Time completed:'
 >>> t[1]
'-1'

Is this what you intended?

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web