-----Original Message----- From: python-list-bounces+ramit.prasad=jpmchase....@python.org [mailto:python-list-bounces+ramit.prasad=jpmchase....@python.org] On Behalf Of Gregory Ewing Sent: Sunday, July 24, 2011 7:05 PM To: python-list@python.org Subject: Re: Convert '165.0' to int
Frank Millman wrote: > I know I am flogging a dead horse here, but IMHO, '165', '165.', > '165.0', and '165.00' are all valid string representations of the > integer 165.[1] > > Therefore, for practical purposes, it would not be wrong for python's > 'int' function to accept these without complaining. How far would you go with that? Would you also accept '1.65e2' as a valid representation of the integer 165? -- Greg -- ================================ No, YAGNI (You Aren't Going To Need It). Do the minimum that works for your use case. If you only expect ###.# then code for that. Avoid trying to over-engineer your solution. *If* you think you are going to receive information that might be like '1.65e2' then code for it, otherwise spend your time working on other problems. Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main Street | Houston, TX 77002 work phone: 713 - 216 - 5423 This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email. -- http://mail.python.org/mailman/listinfo/python-list