Liste des Groupes | Revenir à cl c |
On 20/06/2024 16:07, David Brown wrote:On 20/06/2024 15:37, bart wrote:On 20/06/2024 11:34, David Brown wrote:I've only been discussing Python as an example of how many
programming tasks are easier in high-level languages than in C.
A lot of it seems to be incantations that you can only come up as an
expert user. I wouldn't have been able to come up with even basic
file-reading; I'd have to go and look up examples, every time.
I seem to remember you getting really worked up about C programmers
using the same identifier for structs and variables!
Yes, you can have both 'struct T' and a type, variable etc called
'T'; or a type 'T' and, due to case sensitivity, a variable or
function called 't'.
But those identifiers in C are still fixed at compile-time. You can't
so this:
printf = sqrt;
In Python (not 2.x where 'print' was a reserved word), you can:
print = math.sqrt
Both have mutable elements. Neither allow arbitrary attributes (so
impossible to misspell member names). And if the FFI demands it,
pointers to structs or ints can be passed.
You can do all this with Python. I showed you how to have
structures with mutable elements - and immutable structures, and
structures with or without the ability to add new fields.
I mentioned 5 ways of doing it, you added one or two more. That is my
point: when a simple feature isn't built in, solutions have to be
provided in lots of disparate ways.
I think your last one corresponded most to what I already have in my
language, but it needed 3 special features to do it, plus maybe one
more to hide some of those workings.
Python is supposed to a good beginner's language not a DIY one.
>
Les messages affichés proviennent d'usenet.