[Tutor] beginning to code
Bill
BILL_NOSPAM at whoknows.net
Thu Sep 21 22:44:31 EDT 2017
Stefan Ram wrote:
> Bill <BILL_NOSPAM at whoknows.net> writes:
>> I understand string[::-1] after only studying python for a day or two
>> (I've only been studying it for 2 weeks at this point). A student could
>> study C++ for a semester or more and not encounter templates until they
>> studied data structures. So in short, I don't believe that the example
>> you chose from Python and the one you chose from C++, were at similar
>> levels (not even close).
> I was responding to your assertion:
>
> |It's much easier to tell what's going on, at a glance, in a
> |C++ program.
>
> and I showed a simple counterexample.
But it was *not* a simple counterexample.
> And above, now, it seems that you /agree/ that one can learn
> Python in a short time, but needs a lot longer to learn C++.
Learning to develop code, in either language, involves much more than
"learning C++" or "learning Python". I have been reading Beazley's
"Essential Reference", and I would say that Python is definitely a
bigger, and more complicated language than C++. In some aspects it has
simpler syntax. But consider all of the ways that you can pass
arguments to a function, for instance. There are definitely alot more
options than in C/C++. I like the way that both of these languages
(unlike Java) allow you to stick with the procedural paradigm if you
wish to (which I think is a natural way for a true beginner to start).
From my perspective, Python's simplicity lies in the fact that an
entire program does not have to be recompiled if a module is changed.
Since I was programming in C (and Fortran) before you were born, it's
syntax does not generally pose a hindrance to me.
>
> BTW: templates have little to do with data structures. One can
> show resonable examples for function templates that do not use
> any data structure:
You are sounding like a "know-it-all" again. I am familiar with such
examples. One could code in C++ for a long time without a definitive
need for templates. It just depends on the application. By trade, I am
more of a mathematician than a programmer but sometimes my needs and/or
interests overlap.
>
> template< typename T >
> T maximum( T const a, T const b ){ return a > b ? a : b; }
>
> . The corresponding Python def would be (untested):
>
> def maximum( a, b ): return a if a > b else b
>
> , that is, because Python is not statically typed, one does
> not need a template for a corresponding definition in Python.
>
More information about the Python-list
mailing list