Click here to Skip to main content
14,828,012 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: python - tail stuck under the rocks? Pin
OriginalGriff13-Jul-19 7:56
mveOriginalGriff13-Jul-19 7:56 
GeneralRe: python - tail stuck under the rocks? Pin
David O'Neil13-Jul-19 8:12
professionalDavid O'Neil13-Jul-19 8:12 
GeneralRe: python - tail stuck under the rocks? Pin
OriginalGriff13-Jul-19 8:20
mveOriginalGriff13-Jul-19 8:20 
GeneralRe: python - tail stuck under the rocks? Pin
David O'Neil13-Jul-19 11:31
professionalDavid O'Neil13-Jul-19 11:31 
GeneralRe: python - tail stuck under the rocks? Pin
Member 798912215-Jul-19 0:03
MemberMember 798912215-Jul-19 0:03 
GeneralRe: python - tail stuck under the rocks? Pin
DerekT-P16-Jul-19 23:53
professionalDerekT-P16-Jul-19 23:53 
GeneralRe: python - tail stuck under the rocks? Pin
Member 798912217-Jul-19 3:12
MemberMember 798912217-Jul-19 3:12 
GeneralRe: python - tail stuck under the rocks? Pin
GuyThiebaut13-Jul-19 23:39
professionalGuyThiebaut13-Jul-19 23:39 
Which is why I see Python as a poor choice for teaching beginners to 'code'.

Take this class definition containing a function:
class StringFormat(object):

    @staticmethod
    def FloatToStringFormat(num: float, decimalPlaces: int) -> str:
        return "{:.{}f}".format(num, decimalPlaces)

Calling it like this:
resultAsString = StringFormat.FloatToStringFormat(20.123, "2")

I would expect to get an error as I am passing in a string rather than an integer for decimalPlaces.
But no, Python happily sets resultAsString to "20.12"
“That which can be asserted without evidence, can be dismissed without evidence.”

― Christopher Hitchens

GeneralRe: python - tail stuck under the rocks? Pin
Mike Winiberg14-Jul-19 20:55
professionalMike Winiberg14-Jul-19 20:55 
GeneralRe: python - tail stuck under the rocks? Pin
GuyThiebaut14-Jul-19 21:18
professionalGuyThiebaut14-Jul-19 21:18 
GeneralRe: python - tail stuck under the rocks? Pin
Mike Winiberg14-Jul-19 21:27
professionalMike Winiberg14-Jul-19 21:27 
GeneralRe: python - tail stuck under the rocks? Pin
r_hyde13-Jul-19 7:06
Memberr_hyde13-Jul-19 7:06 
GeneralRe: python - tail stuck under the rocks? Pin
Sander Rossel13-Jul-19 9:14
professionalSander Rossel13-Jul-19 9:14 
AnswerRe: python - tail stuck under the rocks? Pin
PIEBALDconsult13-Jul-19 5:07
professionalPIEBALDconsult13-Jul-19 5:07 
AnswerRe: python - tail stuck under the rocks? Pin
Sander Rossel13-Jul-19 9:19
professionalSander Rossel13-Jul-19 9:19 
AnswerRe: python - tail stuck under the rocks? Pin
GuyThiebaut13-Jul-19 20:07
professionalGuyThiebaut13-Jul-19 20:07 
AnswerRe: python - tail stuck under the rocks? Pin
Member 798912215-Jul-19 0:37
MemberMember 798912215-Jul-19 0:37 
AnswerRe: python - tail stuck under the rocks? Pin
Member 798912215-Jul-19 1:00
MemberMember 798912215-Jul-19 1:00 
AnswerRe: python - tail stuck under the rocks? Pin
Member 787811615-Jul-19 5:28
MemberMember 787811615-Jul-19 5:28 
AnswerRe: python - tail stuck under the rocks? Pin
Asday15-Jul-19 6:09
MemberAsday15-Jul-19 6:09 
GeneralRe: python - tail stuck under the rocks? Pin
Member 798912215-Jul-19 10:29
MemberMember 798912215-Jul-19 10:29 
GeneralRe: python - tail stuck under the rocks? Pin
Asday15-Jul-19 11:13
MemberAsday15-Jul-19 11:13 
GeneralRe: python - tail stuck under the rocks? Pin
Member 798912216-Jul-19 0:28
MemberMember 798912216-Jul-19 0:28 
AnswerRe: python - tail stuck under the rocks? Pin
Ri_Ho15-Jul-19 7:39
MemberRi_Ho15-Jul-19 7:39 
AnswerRe: python - tail stuck under the rocks? Pin
rk215315-Jul-19 8:20
Memberrk215315-Jul-19 8:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.