Python a snake in the grass...
-
Hi, I come from the C back ground, where white space is free, lines are terminated with ; & loops are in { } and all is right with the world. Moving to Python white space appears to terminate functions and loops, the structure is now a tuple. I appreciate that white space thing is easier for beginners but it's a little confusing for someone who is just trying to pick up the language quickly... :wtf:
-
Hi, I come from the C back ground, where white space is free, lines are terminated with ; & loops are in { } and all is right with the world. Moving to Python white space appears to terminate functions and loops, the structure is now a tuple. I appreciate that white space thing is easier for beginners but it's a little confusing for someone who is just trying to pick up the language quickly... :wtf:
-
Hi, I come from the C back ground, where white space is free, lines are terminated with ; & loops are in { } and all is right with the world. Moving to Python white space appears to terminate functions and loops, the structure is now a tuple. I appreciate that white space thing is easier for beginners but it's a little confusing for someone who is just trying to pick up the language quickly... :wtf:
Python is not unique in this. Haskell, F#, other FP languages... Basically, you get used to it. At least I did, pretty quickly. Because it can get fuzzy, I tend to use a blank line to separate the end of an "if" or "loop" so I know something important is happening. That, and writing very small functions in Python. I have been known to write (psuedocode example, my Python is getting rusty!)
OperateOnList(someList)
foreach(item in somelist)
DoSomething(item)Latest Article - Building a Prototype Web-Based Diagramming Tool with SVG and Javascript Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802
-
Hi, I come from the C back ground, where white space is free, lines are terminated with ; & loops are in { } and all is right with the world. Moving to Python white space appears to terminate functions and loops, the structure is now a tuple. I appreciate that white space thing is easier for beginners but it's a little confusing for someone who is just trying to pick up the language quickly... :wtf:
I recently in the last year or so had to pick up python syntax as well. I have similar background, with C, some C++/C#. I can usually read and follow other derivatives like Java as well. Python is described as being "easy" to learn for beginners, but for those of us used to "normal" languages, it's not so easy. My personal description is that it's a 'loosy, goosy' language to me. It seems that some syntax can be what ever you want, the interpreter just figures it out. The not having {} and ; chars drives me nuts. The data structures like tuples, and the fact that everything is a dict can be confusing. Add in that it's not strongly typed, and instantiates vars on the fly, and it's like a recipe for disaster for someone like me who is used to working with RULES! I know you can compile it in some cases, but the fact it's not compiled is even worse, as unless your IDE of choice is REALLY good, you can't even rely on the compiler catching trivial syntax/typo errors. I often find myself trying to do things in Python like I would do it in other languages, it works usually, but then the Python religious will call out, "but that isn't pythonic!". When was the last time you heard someone say that about C or C#?..."You can't do it that way, it's not C-thonic!" As someone who doesn't use it all the time, and still goes back and forth between Python and C languages, my only suggestion, is just "throw out what you think you know of programming, and learn Python like a beginner". While I didn't do that, my only conclusion is that it would help. Good luck, I still am not 100% comfortable with it.