Click here to Skip to main content
14,382,347 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 8:56
protectorOriginalGriff13-Jul-19 8:56 
GeneralRe: python - tail stuck under the rocks? Pin
David O'Neil13-Jul-19 9:12
professionalDavid O'Neil13-Jul-19 9:12 
GeneralRe: python - tail stuck under the rocks? Pin
OriginalGriff13-Jul-19 9:20
protectorOriginalGriff13-Jul-19 9:20 
GeneralRe: python - tail stuck under the rocks? Pin
David O'Neil13-Jul-19 12:31
professionalDavid O'Neil13-Jul-19 12:31 
GeneralRe: python - tail stuck under the rocks? Pin
Member 798912215-Jul-19 1:03
memberMember 798912215-Jul-19 1:03 
GeneralRe: python - tail stuck under the rocks? Pin
DerekT-P17-Jul-19 0:53
professionalDerekT-P17-Jul-19 0:53 
GeneralRe: python - tail stuck under the rocks? Pin
Member 798912217-Jul-19 4:12
memberMember 798912217-Jul-19 4:12 
GeneralRe: python - tail stuck under the rocks? Pin
GuyThiebaut14-Jul-19 0:39
professionalGuyThiebaut14-Jul-19 0: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 21:55
professionalMike Winiberg14-Jul-19 21:55 
GeneralRe: python - tail stuck under the rocks? Pin
GuyThiebaut14-Jul-19 22:18
professionalGuyThiebaut14-Jul-19 22:18 
GeneralRe: python - tail stuck under the rocks? Pin
Mike Winiberg14-Jul-19 22:27
professionalMike Winiberg14-Jul-19 22:27 
GeneralRe: python - tail stuck under the rocks? Pin
r_hyde13-Jul-19 8:06
memberr_hyde13-Jul-19 8:06 
GeneralRe: python - tail stuck under the rocks? Pin
Sander Rossel13-Jul-19 10:14
professionalSander Rossel13-Jul-19 10:14 
AnswerRe: python - tail stuck under the rocks? Pin
PIEBALDconsult13-Jul-19 6:07
protectorPIEBALDconsult13-Jul-19 6:07 
AnswerRe: python - tail stuck under the rocks? Pin
Sander Rossel13-Jul-19 10:19
professionalSander Rossel13-Jul-19 10:19 
AnswerRe: python - tail stuck under the rocks? Pin
GuyThiebaut13-Jul-19 21:07
professionalGuyThiebaut13-Jul-19 21:07 
AnswerRe: python - tail stuck under the rocks? Pin
Member 798912215-Jul-19 1:37
memberMember 798912215-Jul-19 1:37 
AnswerRe: python - tail stuck under the rocks? Pin
Member 798912215-Jul-19 2:00
memberMember 798912215-Jul-19 2:00 
AnswerRe: python - tail stuck under the rocks? Pin
Member 787811615-Jul-19 6:28
memberMember 787811615-Jul-19 6:28 
AnswerRe: python - tail stuck under the rocks? Pin
Asday15-Jul-19 7:09
memberAsday15-Jul-19 7:09 
GeneralRe: python - tail stuck under the rocks? Pin
Member 798912215-Jul-19 11:29
memberMember 798912215-Jul-19 11:29 
GeneralRe: python - tail stuck under the rocks? Pin
Asday15-Jul-19 12:13
memberAsday15-Jul-19 12:13 
GeneralRe: python - tail stuck under the rocks? Pin
Member 798912216-Jul-19 1:28
memberMember 798912216-Jul-19 1:28 
AnswerRe: python - tail stuck under the rocks? Pin
Ri_Ho15-Jul-19 8:39
memberRi_Ho15-Jul-19 8:39 
AnswerRe: python - tail stuck under the rocks? Pin
rk215315-Jul-19 9:20
memberrk215315-Jul-19 9: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.