Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Checking the number of arguments a function takes
Post: RE: Checking the number of arguments a function ta...

Thanks deanhystad and Gribouillis I found both your suggestions helpful
Chirumer General Coding Help 3 2,172 Jul-06-2021, 04:56 PM
    Thread: Checking the number of arguments a function takes
Post: Checking the number of arguments a function takes

user_func is a function with either 1 or 2 parameters. What's the best way to call the function with 2 parameters if it supports it, or call it with 1 parameter if not? Here is one way I found.. def ...
Chirumer General Coding Help 3 2,172 Jul-06-2021, 04:18 PM
    Thread: Floor division return value
Post: RE: Floor division return value

(Nov-26-2020, 09:29 AM)perfringo Wrote: You have changed your original post but your claim was that in Python 3 floor division returns float and Python 2 floor division returns integer. Quote:Bette...
Chirumer General Coding Help 8 3,807 Nov-26-2020, 10:12 AM
    Thread: Floor division return value
Post: RE: Floor division return value

I'm very very sorry. I meant to write 10//4.0 Why does 10//4.0 return 2.0 and not simply 2? The fractional part is truncated anyway, so why does 10//4.0 evaluate to a float and not an int?
Chirumer General Coding Help 8 3,807 Nov-26-2020, 10:05 AM
    Thread: Floor division return value
Post: Floor division return value

10//4 evaluates to 2.0 Why is it evaluated as 2.0 and not just 2? The result is an integer after all, isn't it better to store an integer in an int? Why is it stored as a floating when the fractional...
Chirumer General Coding Help 8 3,807 Nov-26-2020, 09:04 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020