Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #54711
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python@mrabarnett.plus.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.053 |
| X-Spam-Evidence | '*H*': 0.90; '*S*': 0.00; 'subject:Help': 0.11; 'def': 0.12; "'c',": 0.16; "('c',": 0.16; '32)': 0.16; '32,': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'header:User- Agent:1': 0.23; 'header:In-Reply-To:1': 0.27; '>>>>': 0.31; 'writes:': 0.31; 'skip:c 30': 0.32; 'subject:with': 0.35; 'reality': 0.36; 'words,': 0.36; 'possible': 0.36; 'subject:?': 0.36; 'depends': 0.38; 'to:addr:python-list': 0.38; 'skip:- 10': 0.38; 'to:addr:python.org': 0.39; 'email addr:gmail.com': 0.63; 'such': 0.63; 'header:Reply-To:1': 0.67; 'reply-to:no real name:2**0': 0.71; 'lowest': 0.74; 'reply-to:addr:python.org': 0.84; 'temperature': 0.84 |
| X-CM-Score | 0.00 |
| X-CNFS-Analysis | v=2.1 cv=MqNrtQqe c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=0kkAYlmtguIA:10 a=4n2GFnqpZ6cA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=PZOUlmuPzJoA:10 a=pGLkceISAAAA:8 a=4ckJOhIs9rLPNs7tM4IA:9 a=wPNLvfGTeEIA:10 a=MSl-tDqOz04A:10 |
| X-AUTH | mrabarnett:2500 |
| Date | Tue, 24 Sep 2013 18:18:04 +0100 |
| From | MRAB <python@mrabarnett.plus.com> |
| User-Agent | Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Help with python functions? |
| References | <e484b709-1287-4e6a-bc43-05f02a608579@googlegroups.com> <5240489d$0$29992$c3e8da3$5496439d@news.astraweb.com> <66aa7d75-a819-4b21-9f1e-7ad265996150@googlegroups.com> <87txhap3e7.fsf@pascolo.net> |
| In-Reply-To | <87txhap3e7.fsf@pascolo.net> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| Reply-To | python-list@python.org |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.301.1380043085.18130.python-list@python.org> (permalink) |
| Lines | 26 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1380043085 news.xs4all.nl 15966 [2001:888:2000:d::a6]:47768 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:54711 |
Show key headers only | View raw
On 24/09/2013 17:53, giacomo boffi wrote:
> kjakupak@gmail.com writes:
>
>> def temp(T, from_unit, to_unit):
>> conversion_table = {('c', 'k'):lambda x: x + 273.15,
>> ('c', 'f'):lambda x: (x * (9.0/5)) + 32,
>> ('k', 'c'):lambda x: x - 273.15,
>> ('k', 'f'):lambda x: (x * (9.0/5)) - 459.67,
>> ('f', 'c'):lambda x: (x - 32) * (5.0/9),
>> ('f', 'k'):lambda x: (x + 459.67) * (5.0/9)}
>> f = conversion_table[(from_unit.lower(), to_unit.lower())]
>> return f(T)
>>
>> Would this be correct?
>
> not always:
>
>>>> temp(-300.0, 'c', 'k')
> -26.850000000000023
>>>>
>
In other words, it depends what you mean by 'correct'.
Zero Kelvin ("Absolute Zero") is the lowest possible temperature; in
reality there's no such temperature as -300°C.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Help with python functions? kjakupak@gmail.com - 2013-09-23 05:57 -0700
Re: Help with python functions? Roy Smith <roy@panix.com> - 2013-09-23 09:11 -0400
Re: Help with python functions? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-23 13:56 +0000
Re: Help with python functions? kjakupak@gmail.com - 2013-09-23 15:32 -0700
Re: Help with python functions? Terry Reedy <tjreedy@udel.edu> - 2013-09-23 18:48 -0400
Re: Help with python functions? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-24 03:08 +0000
Re: Help with python functions? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-24 03:17 +0000
Re: Help with python functions? giacomo boffi <pecore@pascolo.net> - 2013-09-24 18:53 +0200
Re: Help with python functions? MRAB <python@mrabarnett.plus.com> - 2013-09-24 18:18 +0100
Re: Help with python functions? kjakupak@gmail.com - 2013-09-23 15:55 -0700
Re: Help with python functions? Dave Angel <davea@davea.name> - 2013-09-24 00:07 +0000
Re: Help with python functions? kjakupak@gmail.com - 2013-09-23 18:23 -0700
Re: Help with python functions? Dave Angel <davea@davea.name> - 2013-09-24 03:52 +0000
Re: Help with python functions? Denis McMahon <denismfmcmahon@gmail.com> - 2013-09-24 02:12 +0000
Re: Help with python functions? kjakupak@gmail.com - 2013-09-23 19:40 -0700
Re: Help with python functions? Denis McMahon <denismfmcmahon@gmail.com> - 2013-09-24 14:51 +0000
Re: Help with python functions? Denis McMahon <denismfmcmahon@gmail.com> - 2013-09-24 19:42 +0000
Re: Help with python functions? kjakupak@gmail.com - 2013-10-01 10:53 -0700
Re: Help with python functions? random832@fastmail.us - 2013-10-01 15:02 -0400
Re: Help with python functions? Denis McMahon <denismfmcmahon@gmail.com> - 2013-10-01 21:45 +0000
Re: Help with python functions? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-10-01 19:19 -0400
Re: Help with python functions? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-24 03:15 +0000
Re: Help with python functions? Denis McMahon <denismfmcmahon@gmail.com> - 2013-09-24 15:02 +0000
csiph-web