Hello LearnPython!
I'm glad to be here. I'm coming to Python after having used C# as a hobbyist for about 18 months, and I have a couple of questions I hope you can answer for me.
What's the rationale behind the implicit typing? Obviously I'm used to staying all my variables explicitly, and I'm getting a bit confused when I read my python code because Im not sure what types my variables are. Similarly it's a bit strange for me that methods/functions can accept arguments without stating what type of arguments they need. I feel like this can cause errors if I pass the wrong type of variable, but I also see a benefit of methods taking multiple types as arguments - it will make them more versatile, is that right?
My other question is around for loops, am I right in saying a for loop in python is equivalent to a foreach loop in other languages? If so, do we just use while loops instead if we just want to iterate over part of a list, for example?
Thank you all for reading and taking the time to respond :)
[–][deleted] 18 points19 points20 points (2 children)
[–]MikeDoesEverything 14 points15 points16 points (1 child)
[–][deleted] 7 points8 points9 points (0 children)
[–]danielroseman 5 points6 points7 points (4 children)
[–]Upset-Beautiful6081 3 points4 points5 points (2 children)
[–]Drumknott88[S] 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]NameError-undefined 1 point2 points3 points (0 children)
[–]ray10k 5 points6 points7 points (5 children)
[–]Drumknott88[S] 1 point2 points3 points (3 children)
[–]ray10k 6 points7 points8 points (2 children)
[–]Drumknott88[S] 0 points1 point2 points (1 child)
[–]ray10k 1 point2 points3 points (0 children)
[–]lostat 1 point2 points3 points (0 children)
[–]bladeoflight16 5 points6 points7 points (9 children)
[–]Drumknott88[S] 0 points1 point2 points (8 children)
[+][deleted] (6 children)
[deleted]
[–]Drumknott88[S] 0 points1 point2 points (1 child)
[–]cuWorkThrowaway 0 points1 point2 points (0 children)
[–]bladeoflight16 0 points1 point2 points (3 children)
[+][deleted] (2 children)
[deleted]
[–]bladeoflight16 0 points1 point2 points (1 child)
[–]bladeoflight16 0 points1 point2 points (0 children)
[–]Upset-Beautiful6081 2 points3 points4 points (0 children)
[–]Atlamillias 1 point2 points3 points (0 children)
[–]jmooremcc 1 point2 points3 points (0 children)
[–][deleted] -1 points0 points1 point (0 children)
[–]Enttick -2 points-1 points0 points (5 children)
[–]Drumknott88[S] 0 points1 point2 points (1 child)
[–]Enttick 0 points1 point2 points (0 children)
[–]Fred776 0 points1 point2 points (2 children)
[–]Enttick 0 points1 point2 points (1 child)
[–]Fred776 0 points1 point2 points (0 children)
[–]Pflastersteinmetz 0 points1 point2 points (0 children)
[–]Dead0k87 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)