b = a.append(3)
I mean: why b = a.append(something) is the None type, and how to make a new list that contains all the items from a and some new items?
Happy New Year, everybody!
I'm new in the Python List, new in Python world, and new in coding.
A few days (weeks?) ago, I faced a problem trying to write a program for an exercise. I asked for help and nobody answered.
In the meantime, I found a part of the solution, but a part still remains a mystery for me. Please run this small snippet, and help.
Thanks
a = [1, 2]
print()
print("a ==", a)
print("type(a) is", type(a))
b = a.append(3)
print("b ==", b)
print("type(b) is", type(b))
A few days (weeks?) ago,
I mean: why b = a.append(something) is the None type,
how to make a new list that contains all the items from a
and some new items?
Happy New Year, everybody!append is not used that way, append is a method, not a function.
I'm new in the Python List, new in Python world, and new in coding.
A few days (weeks?) ago, I faced a problem trying to write a program for an exercise. I asked for help and nobody answered.
In the meantime, I found a part of the solution, but a part still remains a mystery for me. Please run this small snippet, and help.
Thanks
a = [1, 2]
print()
print("a ==", a)
print("type(a) is", type(a))
b = a.append(3)
print("\nb =", "a.append(3)")
print("b ==", b)
print("type(b) is", type(b))
c = ['1', '2']
print("\nc ==", c)
print("type(c) is", type(c))
d = c.append('3')
print("\nd =", "c.append('3')")
print("d ==", d)
print("type(d) is", type(d))
"""
I mean: why b = a.append(something) is the None type, and how to make a new list
that contains all the items from a and some new items?
I wasn't able to solve it in a few hours :(
Now I know:
"""
crta = '='
print('\n', 4 * ' ', crta * (len('The solution:')), sep='')
print(3 * ' ', 'The solution:')
print(4 * ' ', crta * (len('The solution:')), sep='')
print('\nThe solution is the slice, an element of Python syntax that
allows')
print('to make a brand new copy of a list, or parts of a list.')
print('The slice actually copies the list\'s contents, not the list\'s name:')
print()
a = [1, 2]
print("a ==", a)
print("type(a) is", type(a))
b = a[:]
print("\nb = a[:]")
print("b ==", b)
b.append(3)
print("\nb =", "b.append(3)")
print("b ==", b)
print("type(b) is", type(b))
print("\na ==", a)
print('But I still don't know why "b = a.append(something)" is the None type.')
print('Is there anybody out there?!')
Happy New Year, everybody!
I'm new in the Python List, new in Python world, and new in coding.
A few days (weeks?) ago, I faced a problem trying to write a program for an exercise. I asked for help and nobody answered.
In the meantime, I found a part of the solution, but a part still remains a mystery for me. Please run this small snippet, and help.
Thanks
a = [1, 2]
print()
print("a ==", a)
print("type(a) is", type(a))
b = a.append(3)
print("\nb =", "a.append(3)")
print("b ==", b)
print("type(b) is", type(b))
c = ['1', '2']
print("\nc ==", c)
print("type(c) is", type(c))
d = c.append('3')
print("\nd =", "c.append('3')")
print("d ==", d)
print("type(d) is", type(d))
"""
I mean: why b = a.append(something) is the None type, and how to make a new list
that contains all the items from a and some new items?
I wasn't able to solve it in a few hours :(
Now I know:
"""
crta = '='
print('\n', 4 * ' ', crta * (len('The solution:')), sep='')
print(3 * ' ', 'The solution:')
print(4 * ' ', crta * (len('The solution:')), sep='')
print('\nThe solution is the slice, an element of Python syntax that
allows')
print('to make a brand new copy of a list, or parts of a list.')
print('The slice actually copies the list\'s contents, not the list\'s name:')
print()
a = [1, 2]
print("a ==", a)
print("type(a) is", type(a))
b = a[:]
print("\nb = a[:]")
print("b ==", b)
b.append(3)
print("\nb =", "b.append(3)")
print("b ==", b)
print("type(b) is", type(b))
print("\na ==", a)
print('But I still don't know why "b = a.append(something)" is the None type.')
print('Is there anybody out there?!')
Happy New Year, everybody!
I'm new in the Python List, new in Python world, and new in coding.
A few days (weeks?) ago, I faced a problem trying to write a program for an exercise. I asked for help and nobody answered.
In the meantime, I found a part of the solution, but a part still remains a mystery for me. Please run this small snippet, and help.
Thanks
a = [1, 2]
print()
print("a ==", a)
print("type(a) is", type(a))
b = a.append(3)
print("\nb =", "a.append(3)")
print("b ==", b)
print("type(b) is", type(b))
c = ['1', '2']
print("\nc ==", c)
print("type(c) is", type(c))
d = c.append('3')
print("\nd =", "c.append('3')")
print("d ==", d)
print("type(d) is", type(d))
"""
I mean: why b = a.append(something) is the None type, and how to make a new list
that contains all the items from a and some new items?
I wasn't able to solve it in a few hours :(
Now I know:
"""
crta = '='
print('\n', 4 * ' ', crta * (len('The solution:')), sep='')
print(3 * ' ', 'The solution:')
print(4 * ' ', crta * (len('The solution:')), sep='')
print('\nThe solution is the slice, an element of Python syntax that
allows')
print('to make a brand new copy of a list, or parts of a list.')
print('The slice actually copies the list\'s contents, not the list\'s name:')
print()
a = [1, 2]
print("a ==", a)
print("type(a) is", type(a))
b = a[:]
print("\nb = a[:]")
print("b ==", b)
b.append(3)
print("\nb =", "b.append(3)")
print("b ==", b)
print("type(b) is", type(b))
print("\na ==", a)
print('But I still don't know why "b = a.append(something)" is the None type.')
print('Is there anybody out there?!')
A few days (weeks?) ago, I faced a problem trying to write a program for an exercise. I asked for help and nobody answered.
A few days (weeks?) ago, I faced a problem trying to write a program
for an exercise. I asked for help and nobody answered.
On 31/12/2022 18.45, Goran Ikac wrote:
...
A few days (weeks?) ago, I faced a problem trying to write a program
for an
exercise. I asked for help and nobody answered.
Looking back over the last six months of List-Archives, your name does
not appear against a single post. This may explain why "nobody answered".
However, ten hours after the above/first message, you posted again. This
time as "Thomas Passin".
That was followed an hour-or-so later, with a
reply-to-self saying: "Everyone's answer to date has been too
complicated", and then basically repeating the information previously-provided by a number of contributors.
It then goes on to talk about copying, sorting, adding, and even sets.
Much of which you had earlier said: "I know". Was there a further
question in there?
Which part of which answer did you find "too complicated"?
Did you try the experiments suggested, and read the references-provided?
Please ask a further question detailing what you have understood, and
what is still mystifying. Folk here endeavor to be helpful (see also,
earlier reference to the Python-Tutor list).
When asking a question here, please try to reduce the problem to its
simplest form, so that you're not asking volunteers to read
multiple-screens of irrelevant code. It will help to ask one question at
a time, or to carefully separate multiple questions.
Yes, this can be difficult when one is learning. That said, we all
started somewhere and are happy to help you to become a valued colleague!
And, of course, we had the philosophical question of why the feature was designed to not return anything ... rather than return the changed
object.
And, of course, we had the philosophical question of why the feature
was designed to not return anything ... rather than return the changed object.
Had a language like that been created today, I wonder if some designs might have looked a bit different so that some functions could be called with optional arguments that specified what the user wanted returned.
Had a language like that been created today, I wonder if some designsreturned.
might have looked a bit different so that some functions could be
called with optional arguments that specified what the user wanted
Chris,
There is much to say about consistent behavior as compared to flexibility
and convenience.
I have seen other languages provide functions for example, where the result can vary and often cause confusion. R had a function that would sometimes notice the result could be simplified and return that. Guess what? It caused lots of problems and an option was added that said it should NOT simplify
and always return the same kind of thing.
As a dumb example, what does a simple function like max() return if fed just integers, just floating point or a combination of both? It seems to return whatever type the maximum indicates. But it also accepts characters and
sorts them appropriately returning type 'str' and probably accepts and returns all kinds of objects if you specify a key function.
Is that so much different than we are discussing in that there isn't any absolute consistency and things can go various ways in terms of return
value? Heck, I can even make max() return None!
Guido had been working on the ABC language for some years before he
developed Python. ABC was intended mainly as a teaching and prototyping >language.
Agreed, there are lots of pro/con arguments and the feature is what it is historically and not trivial to change. Inline changes to an object make sense to just be done "silently" and if there are errors, they propagate the usual way.
As Guido was a major influence at that time, one view was seen as more important and prevailed.
Had a language like that been created today, I wonder if some designs might have looked a bit different so that some functions could be called with optional arguments that specified what the user wanted returned.
In particular, besides a function where you add a value returning nothing/None, there may be room for other choices and any choice hard-wired in would eleicit complaints from others.
lst.add("Value")
could also return one of several other things such as a pointer to the upgraded object but also of a pointer to the object as it looked before the change (not a serious proposal) or a True/False value specifying if the change was able to be completed (such as running out of memory, or the addition not being something you can put in the object) or even return what was added or how many objects are now in the object at the top level, or how many times the method was called so far!
I suspect, at the expense of some overhead, you could just add an argument
to many kinds of methods or even functions such as returning='option' that guides what you want returned, with the default often being what Guido and others currently have set.
Python already allows functions to return anything they feel like, so this probably would not break many things.
Of course there are other paths in that direction, such as setting an attribute of the list/object first that affects how things get returned but that seems more cumbersome and makes all kinds of errors more likely. Still, that is a path often used by some Python modules where objects are created and then tweaked to behave in various ways when later methods are invoked.
But is any of it needed? The current system generally works fine and we have seen many ways to get other results without tampering with the current implementation.
This may be yet another example of people who come to python with pre-existing bias, such as insisting it work like another language they have used, or wanting the computer to do what they MEANT rather than what they explicitly or implicitly programmed!
-----Original Message-----
From: Python-list <python-list-bounces+avi.e.gross=gmail.com@python.org> On Behalf Of Greg Ewing
Sent: Saturday, December 31, 2022 7:21 PM
To: python-list@python.org
Subject: Re: NoneType List
On 1/01/23 11:36 am, avi.e.gross@gmail.com wrote:
And, of course, we had the philosophical question of why the feature
was designed to not return anything ... rather than return the changed
object.
My understanding is that Guido designed it that way to keep a clear separation between mutating and non-mutating methods, and to help catch mistakes resulting from mixing them up.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
Thomas Passin <list1@tompassin.net> writes:
Guido had been working on the ABC language for some years before he
developed Python. ABC was intended mainly as a teaching and prototyping
language.
In those days, there used to be a language called "Pascal".
Pascal had a dichotomy between "functions" and "procedures".
A call to a function was intended to have a value.
A call to a procedure was intended to have an effect.
For some beginners, the difference between a value and
and effect can be hard to grasp. So, Pascal's distinction
helps to hammer that home.
Experienced programmers know the difference and do no longer
require the effort of the language to teach it to them.
The time when someone is a beginner and still struggles
to understand the difference between values and effects
usually is significantly shorter than the later time
where he has understood it and is programming productively,
so it might be better when the language is adapted to
people who already have understood the difference.
Guido had been working on the ABC language for some years before he
developed Python. ABC was intended mainly as a teaching and
prototyping language.
Several of you have mentioned the role of history in the development of languages and what the founders of a language were trying to improve.
As noted with PASCAL, some earlier languages strived to be different things and in a certain sense, their procedures were perhaps seen as a safer and better way to do things that languages like BASIC hade done with a GOSUB.
On
top of that, there were concerns in a compiled language such as not leaving an unused result on the stack when a function returned and even efficiency considerations of several kinds. If a function returns a value, that value has to persist beyond the lifetime of the function. It has to be in a kind
of memory different than where you can store values that go away. In a procedure call, the compiler could use the fact that nothing is returned other than through external variables.
As noted, Guido started various languages, including Python, in a
historical
context where he was not yet seeing things as "objects" in the way we often do now. And he was trying to avoid some features often used in languages
like C for various reasons while keeping or extending others. I am not sure about timing, but there have been many debates in the field about things
like programming without side effects and some insist that changing things
IN PLACE is a poor way to do things and instead things should be copied
when
modified and so on.
So it well may be that allowing an inline sort or addition to a list was added carefully in a way that made it very clear what you were doing and seeing it more as a procedure call than a function that returned a value of itself as Stefan points out.
But Python evolved and keeps evolving and like many biological organisms,
to
some extent, ontogeny recapitulates phylogeny. It is really hard to get rid of some early design choices even when a brand new design might allow a cleaner design with more advantages. Python is becoming more like other languages as it borrows from them and they borrow from it, and all borrow
or
adapt from yet others. The result, frankly, can be a tad hard to understand as the languages both converge and diverge only to converge again and some simply go extinct or get totally re-done to adapt ...
-----Original Message-----
From: Python-list <python-list-bounces+avi.e.gross=gmail.com@python.org>
On
Behalf Of Stefan Ram
Sent: Sunday, January 1, 2023 8:47 AM
To: python-list@python.org
Subject: Re: NoneType List
Thomas Passin <list1@tompassin.net> writes:
Guido had been working on the ABC language for some years before he >developed Python. ABC was intended mainly as a teaching and
prototyping language.
In those days, there used to be a language called "Pascal".
Pascal had a dichotomy between "functions" and "procedures".
A call to a function was intended to have a value.
A call to a procedure was intended to have an effect.
For some beginners, the difference between a value and
and effect can be hard to grasp. So, Pascal's distinction
helps to hammer that home.
Experienced programmers know the difference and do no longer
require the effort of the language to teach it to them.
The time when someone is a beginner and still struggles
to understand the difference between values and effects
usually is significantly shorter than the later time
where he has understood it and is programming productively,
so it might be better when the language is adapted to
people who already have understood the difference.
--
https://mail.python.org/mailman/listinfo/python-list
--
https://mail.python.org/mailman/listinfo/python-list
Thomas Passin <list1@tompassin.net> writes:
Guido had been working on the ABC language for some years before he
developed Python. ABC was intended mainly as a teaching and
prototyping language.
In those days, there used to be a language called "Pascal".
Pascal had a dichotomy between "functions" and "procedures".
A call to a function was intended to have a value.
A call to a procedure was intended to have an effect.
For some beginners, the difference between a value and
and effect can be hard to grasp. So, Pascal's distinction
helps to hammer that home.
Experienced programmers know the difference and do no longer
require the effort of the language to teach it to them.
The time when someone is a beginner and still struggles
to understand the difference between values and effects
usually is significantly shorter than the later time
where he has understood it and is programming productively,
so it might be better when the language is adapted to
people who already have understood the difference.
Thomas,
I used PASCAL before C and I felt like I was wearing a straitjacket
at times in PASCAL when I was trying to write encryption/decryption
functions and had to find ways to fiddle with bits. Similar things
were easy in C, and are even easier in many more recent languages
such as Python.
The distinction between teaching a first language, or one that is so
cautious as to catch and prevent all mistakes it can, is not for
people willing to be bolder or work faster or write routines that can
be used more generally.
What has not been mentioned is that languages like python go a step
further and allow a function to return many arguments and even a
varying number of arguments, as well as none at all. To do anything
like that in PASCAL
took some thought on how to make some structure you could fill out
then return as a single value that the receiving code had to sort of
decode and perhaps deal with parts that could hold a union of several
things. Can a compiler or interpreter easily verify you did something reasonable, as compared to say python that allows something like:
(res1, res2, _, res4, _, rest) = f(x)
The above tells the interpreter you expect perhaps 6 or more results
and what to do with them.
-----Original Message----- From: Python-list <python-list-bounces+avi.e.gross=gmail.com@python.org> On Behalf Of
Thomas Passin Sent: Sunday, January 1, 2023 1:03 PM To: python-list@python.org Subject: Re: NoneType List
On 1/1/2023 8:47 AM, Stefan Ram wrote:
Thomas Passin <list1@tompassin.net> writes:
Guido had been working on the ABC language for some years before
he developed Python. ABC was intended mainly as a teaching and
prototyping language.
In those days, there used to be a language called "Pascal". Pascal
had a dichotomy between "functions" and "procedures". A call to a
function was intended to have a value. A call to a procedure was
intended to have an effect.
Wirth developed Pascal as a teaching language. IIRC, originally it
was taught to students before there were any implementations. I did
most of my programming with Turbo Pascal for many years. Just to
clarify what you wrote above, in Pascal a "procedure" does not return anything while a "function" does.
I really liked (Turbo) Pascal and I hated C back then. No wonder I
like Python so much. It must be something about how my mind works.
For some beginners, the difference between a value and and effect
can be hard to grasp. So, Pascal's distinction helps to hammer that
home.
Experienced programmers know the difference and do no longer
require the effort of the language to teach it to them.
The time when someone is a beginner and still struggles to
understand the difference between values and effects usually is
significantly shorter than the later time where he has understood
it and is programming productively, so it might be better when the
language is adapted to people who already have understood the
difference.
-- https://mail.python.org/mailman/listinfo/python-list
Thomas,
I used PASCAL before C and I felt like I was wearing a straitjacket at
times in PASCAL when I was trying to write encryption/decryption
functions and had to find ways to fiddle with bits. Similar things
were easy in C, and are even easier in many more recent languages such
as Python.
The distinction between teaching a first language, or one that is so
cautious as to catch and prevent all mistakes it can, is not for
people willing to be bolder or work faster or write routines that can
be used more generally.
What has not been mentioned is that languages like python go a step
further and allow a function to return many arguments and even a
varying number of arguments, as well as none at all. To do anything
like that in PASCAL
took some thought on how to make some structure you could fill out
then return as a single value that the receiving code had to sort of
decode and perhaps deal with parts that could hold a union of several
things. Can a compiler or interpreter easily verify you did something reasonable, as compared to say python that allows something like:
(res1, res2, _, res4, _, rest) = f(x)
The above tells the interpreter you expect perhaps 6 or more results
and what to do with them.
-----Original Message----- From: Python-list <python-list-bounces+avi.e.gross=gmail.com@python.org> On Behalf Of
Thomas Passin Sent: Sunday, January 1, 2023 1:03 PM To: python-list@python.org Subject: Re: NoneType List
On 1/1/2023 8:47 AM, Stefan Ram wrote:
Thomas Passin <list1@tompassin.net> writes:
Guido had been working on the ABC language for some years before he
developed Python. ABC was intended mainly as a teaching and
prototyping language.
In those days, there used to be a language called "Pascal". Pascal
had a dichotomy between "functions" and "procedures". A call to a
function was intended to have a value. A call to a procedure was
intended to have an effect.
Wirth developed Pascal as a teaching language. IIRC, originally it was
taught to students before there were any implementations. I did most
of my programming with Turbo Pascal for many years. Just to clarify
what you wrote above, in Pascal a "procedure" does not return anything
while a "function" does.
I really liked (Turbo) Pascal and I hated C back then. No wonder I
like Python so much. It must be something about how my mind works.
For some beginners, the difference between a value and and effect can
be hard to grasp. So, Pascal's distinction helps to hammer that home.
Experienced programmers know the difference and do no longer require
the effort of the language to teach it to them.
The time when someone is a beginner and still struggles to understand
the difference between values and effects usually is significantly
shorter than the later time where he has understood it and is
programming productively, so it might be better when the language is
adapted to people who already have understood the difference.
-- https://mail.python.org/mailman/listinfo/python-list
I used PASCAL before C and I felt like I was wearing a straitjacket at times in PASCAL when I was trying to write encryption/decryption functions and had to find ways to fiddle with bits. Similar things were easy in C, and are
even easier in many more recent languages such as Python.
Not to wax poetic about our pasts, Thomas, but I do did not start with
PASCAL and used quite a few languages before and plenty after. At the time
it had interesting contrasts to languages like BASIC, FORTRAN and LISP and
I
tended to use whatever was available on the machines I was using. My first computer job (other than in grad school itself) was using OMSI PASCAL. I
even wrote my thesis as a PASCAL program containing comments that included typesetting instructions in a language called RUNOFF while the PASCAL
program itself was a set of comments as far as RUNOFF was concerned. So it compiled or was typeset and printed from the same source.
But my next job after graduation was for Bell Labs and I had to forget all the mainframe or DEC systems and adapt to UNIX, and of course C and later
C++ and the various other little languages that came with that such as AWK and PERL ...
There is no one right language but there often is a small set of right languages given your circumstances, such as what your employer has everyone using and especially in group projects.
To be fair, languages like Python and R seem to keep having parts rewritten in C or C++ to make some things run faster and can include libraries
written
ages ago in languages like FORTRAN that have been finely tuned. Under the hood, these languages often hide parts so that developing a new python (or
R
or ...) module/package can start by writing it all in that language and
then
taking some functionality and rewriting it in the other language for
critical regions where a slower interpreted method may be speeded up.
But for prototyping, or when speed is not a big deal, I really prefer
Python
to ...
-----Original Message-----
From: Python-list <python-list-bounces+avi.e.gross=gmail.com@python.org>
On
Behalf Of Thomas Passin
Sent: Sunday, January 1, 2023 10:15 PM
To: python-list@python.org
Subject: Re: NoneType List
On 1/1/2023 9:14 PM, avi.e.gross@gmail.com wrote:
Thomas,
I used PASCAL before C and I felt like I was wearing a straitjacket at times in PASCAL when I was trying to write encryption/decryption
functions and had to find ways to fiddle with bits. Similar things
were easy in C, and are even easier in many more recent languages such
as Python.
PASCAL was not the first language I learned. I won't pretend I had to do anything very complicated, or do much bit-twiddling. It was, though, the first one (except probably for FORTH) I enjoyed programming with more than
I
disliked the boiler-plate formalities.
The distinction between teaching a first language, or one that is so cautious as to catch and prevent all mistakes it can, is not for
people willing to be bolder or work faster or write routines that can
be used more generally.
What has not been mentioned is that languages like python go a step
further and allow a function to return many arguments and even a
varying number of arguments, as well as none at all. To do anything
like that in PASCAL
(or C, for that matter)
took some thought on how to make some structure you could fill out
then return as a single value that the receiving code had to sort of
decode and perhaps deal with parts that could hold a union of several things. Can a compiler or interpreter easily verify you did something reasonable, as compared to say python that allows something like:
(res1, res2, _, res4, _, rest) = f(x)
Yes, that's one of the good things about Python, how it makes working with tuples so easy and natural. OTOH, harking back to PASCAL for a minute, it had enumerations and sets long before Python got them.
The above tells the interpreter you expect perhaps 6 or more results
and what to do with them.
-----Original Message----- From: Python-list <python-list-bounces+avi.e.gross=gmail.com@python.org> On Behalf Of
Thomas Passin Sent: Sunday, January 1, 2023 1:03 PM To: python-list@python.org Subject: Re: NoneType List
On 1/1/2023 8:47 AM, Stefan Ram wrote:
Thomas Passin <list1@tompassin.net> writes:
Guido had been working on the ABC language for some years before he
developed Python. ABC was intended mainly as a teaching and
prototyping language.
In those days, there used to be a language called "Pascal". Pascal
had a dichotomy between "functions" and "procedures". A call to a
function was intended to have a value. A call to a procedure was
intended to have an effect.
Wirth developed Pascal as a teaching language. IIRC, originally it was taught to students before there were any implementations. I did most
of my programming with Turbo Pascal for many years. Just to clarify
what you wrote above, in Pascal a "procedure" does not return anything while a "function" does.
I really liked (Turbo) Pascal and I hated C back then. No wonder I
like Python so much. It must be something about how my mind works.
For some beginners, the difference between a value and and effect can
be hard to grasp. So, Pascal's distinction helps to hammer that home.
Experienced programmers know the difference and do no longer require
the effort of the language to teach it to them.
The time when someone is a beginner and still struggles to understand
the difference between values and effects usually is significantly
shorter than the later time where he has understood it and is
programming productively, so it might be better when the language is
adapted to people who already have understood the difference.
-- https://mail.python.org/mailman/listinfo/python-list
--
https://mail.python.org/mailman/listinfo/python-list
--
https://mail.python.org/mailman/listinfo/python-list
On 02/01/2023 02:14, avi.e.gross@gmail.com wrote:
I used PASCAL before C and I felt like I was wearing a straitjacket at times >> in PASCAL when I was trying to write encryption/decryption functions and had >> to find ways to fiddle with bits. Similar things were easy in C, and are
even easier in many more recent languages such as Python.
That's true of pure Pascal. But Thomas was talking about Turbo Pascal
which had extra functions and features for all those "real world" type things. (And you could insert some inline assembler if all else failed)
It also relaxed the ludicrously strict typing slightly. Turbo Pascal
made Pascal a joy and I still use Delphi for Windows programming today.
TP also introduced classes to Pascal (although Apple had already done
so for the Mac and Borland basically ported the syntax to the PC).
I used PASCAL before C and I felt like I was wearing a straitjacket at
times in PASCAL when I was trying to write encryption/decryption
functions and had to find ways to fiddle with bits. Similar things
were easy in C, and are even easier in many more recent languages such as Python.
I used PASCAL before C and I felt like I was wearing a straitjacket at times in PASCAL when I was trying to write encryption/decryption functions and had to find ways to fiddle with bits. Similar things were easy in C, and are
even easier in many more recent languages such as Python.
On 02/01/2023 02:14, avi.e.gross@gmail.com wrote:
I used PASCAL before C and I felt like I was wearing a straitjacket at times >> in PASCAL when I was trying to write encryption/decryption functions and had >> to find ways to fiddle with bits. Similar things were easy in C, and are
even easier in many more recent languages such as Python.
That's true of pure Pascal. But Thomas was talking about Turbo Pascal
which had extra functions and features for all those "real world" type things. (And you could insert some inline assembler if all else failed)
It also relaxed the ludicrously strict typing slightly. Turbo Pascal
made Pascal a joy and I still use Delphi for Windows programming today.
TP also introduced classes to Pascal (although Apple had already done
so for the Mac and Borland basically ported the syntax to the PC).
On 2023-01-02, Alan Gauld <learn2program@gmail.com> wrote:
On 02/01/2023 02:14, avi.e.gross@gmail.com wrote:
I used PASCAL before C and I felt like I was wearing a straitjacket at times
in PASCAL when I was trying to write encryption/decryption functions and had
to find ways to fiddle with bits. Similar things were easy in C, and are >>> even easier in many more recent languages such as Python.
That's true of pure Pascal. But Thomas was talking about Turbo Pascal
which had extra functions and features for all those "real world" type
things. (And you could insert some inline assembler if all else failed)
It also relaxed the ludicrously strict typing slightly. Turbo Pascal
made Pascal a joy and I still use Delphi for Windows programming today.
TP also introduced classes to Pascal (although Apple had already done
so for the Mac and Borland basically ported the syntax to the PC).
TP was indeed a joy to work with. It made it trivial to do simple
graphics on an IBM-PC and it was FAST -- both to write in, to debug,
and in raw execution speed.
Yonks ago (early 80s), I used Pascal to write an RTOS kernel and call processing firmware for a cell-site radio running a 16-bit
microprocessor (Z8000). It worked great. However, that Pascal compiler
had a few extensions designed specifically to support embedded systems
use on bare metal -- things like specific length signed/unsigned
interger types (with binary operations), pointers to raw memory and configurable bounds-checking.
On 02/01/2023 02:14, avi.e.gross@gmail.com wrote:
I used PASCAL before C and I felt like I was wearing a straitjacket at times >> in PASCAL when I was trying to write encryption/decryption functions and had >> to find ways to fiddle with bits. Similar things were easy in C, and are
even easier in many more recent languages such as Python.
That's true of pure Pascal. But Thomas was talking about Turbo Pascal
which had extra functions and features for all those "real world" type things. (And you could insert some inline assembler if all else failed)
It also relaxed the ludicrously strict typing slightly. Turbo Pascal
made Pascal a joy and I still use Delphi for Windows programming today.
TP also introduced classes to Pascal (although Apple had already done
so for the Mac and Borland basically ported the syntax to the PC).
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 447 |
Nodes: | 16 (2 / 14) |
Uptime: | 24:20:41 |
Calls: | 9,235 |
Calls today: | 2 |
Files: | 13,496 |
Messages: | 6,063,716 |