Hey there 🙂
I will be working in python for a project soon and was wondering as to the different possibilities with regards to specifying the type of variables explicitly.
Don’t get me wrong, the (blind) type inference of python can be very nice at times, but personally I prefer specifying types whenever a variable will only be one specific type.
So I was wondering what best practices and tools there are for enforcing/encouraging myself to do so?
I mean, one obvious one is ofcourse to use type hints in your function definitions (when possible), but I was wondering if there are any more tricks to it, or not 🙂
submitted by /u/scaptal
[link] [comments]
r/learnpython Hey there 🙂 I will be working in python for a project soon and was wondering as to the different possibilities with regards to specifying the type of variables explicitly. Don’t get me wrong, the (blind) type inference of python can be very nice at times, but personally I prefer specifying types whenever a variable will only be one specific type. So I was wondering what best practices and tools there are for enforcing/encouraging myself to do so? I mean, one obvious one is ofcourse to use type hints in your function definitions (when possible), but I was wondering if there are any more tricks to it, or not 🙂 submitted by /u/scaptal [link] [comments]
Hey there 🙂
I will be working in python for a project soon and was wondering as to the different possibilities with regards to specifying the type of variables explicitly.
Don’t get me wrong, the (blind) type inference of python can be very nice at times, but personally I prefer specifying types whenever a variable will only be one specific type.
So I was wondering what best practices and tools there are for enforcing/encouraging myself to do so?
I mean, one obvious one is ofcourse to use type hints in your function definitions (when possible), but I was wondering if there are any more tricks to it, or not 🙂
submitted by /u/scaptal
[link] [comments]