some problems for an introductory python test
Dennis Lee Bieber
wlfraed at ix.netcom.com
Thu Aug 12 15:56:04 EDT 2021
On Thu, 12 Aug 2021 12:09:58 -0300, Hope Rouselle <hrouselle at jevedi.com>
declaimed the following:
>How is it possible that Microsoft would take part of the code of OS/2?
>Did IBM just hand it to them?
>
Because IBM subcontracted (IE: "paid") M$ to create an OS with XYZ
features for their latest PC (under supervision of IBM design team)..
https://en.wikipedia.org/wiki/OS/2
IBM owned the rights to OS/2, but it was written, for the most part, by
M$ in parallel with M$ own "Windows" 16-bit OS.
>
>Yeah, that's kinda nice. Isn't that a UNIX design? A file is a
>sequence of bytes? Users decide what to put in them? So OS/2 was
>taking advantage of that to integrate it well with the system. Windows
>was doing the same, but integrating the system with files in odd ways
>--- such as a registry record to inform the system which programs open
>which files? (That does sound more messy.)
>
Not really -- Have you looked at what a hash Linux graphical interfaces
require to associate file types with how to open said files?
On my Debian (VirtualBox) there is:
wulfraed at debian:~$ cat ~/.config/mimeapps.list
[Added Associations]
text/html=firefox-esr.desktop;
text/plain=gvim.desktop;
x-scheme-handler/http=exo-web-browser.desktop
x-scheme-handler/https=exo-web-browser.desktop
x-scheme-handler/mailto=exo-mail-reader.desktop
application/xml=gvim.desktop;
text/x-scheme=gvim.desktop;
application/vnd.kde.kxmlguirc=gvim.desktop;
text/x-python=gvim.desktop;
application/x-shellscript=gvim.desktop;
[Default Applications]
wulfraed at debian:~$
... and all these
wulfraed at debian:~$ ls /usr/share/applications
atril.desktop panel-desktop-handler.desktop
claws-mail.desktop panel-preferences.desktop
...
debian-uxterm.desktop python3.7.desktop
...
org.thonny.Thonny.desktop xsane.desktop
org.xfce.Parole.desktop
wulfraed at debian:~$
wulfraed at debian:~$ cat /usr/share/applications/python3.7.desktop
[Desktop Entry]
Name=Python (v3.7)
Comment=Python Interpreter (v3.7)
Exec=/usr/bin/python3.7
Icon=/usr/share/pixmaps/python3.7.xpm
Terminal=true
Type=Application
Categories=Development;
StartupNotify=true
NoDisplay=true
wulfraed at debian:~$
wulfraed at debian:~$ cat /etc/mime.types
###############################################################################
#
# MIME media types and the extensions that represent them.
#
# The format of this file is a media type on the left and zero or more
# filename extensions on the right. Programs using this file will map
# files ending with those extensions to the associated type.
#
# This file is part of the "mime-support" package. Please report a bug
using
# the "reportbug" command of the "reportbug" package if you would like new
# types or extensions to be added.
#
# The reason that all types are managed by the mime-support package
instead
# allowing individual packages to install types in much the same way as
they
# add entries in to the mailcap file is so these types can be referenced
by
# other programs (such as a web server) even if the specific support
package
# for that type is not installed.
#
# Users can add their own types if they wish by creating a ".mime.types"
# file in their home directory. Definitions included there will take
# precedence over those listed here.
#
###############################################################################
application/activemessage
application/andrew-inset ez
application/annodex anx
application/applefile
application/atom+xml atom
...
application/x-python-code pyc pyo
...
text/x-python py
...
wulfraed at debian:~$ cat /usr/share/applications/gvim.desktop
[Desktop Entry]
Name=gVim
GenericName=Text Editor
...
TryExec=gvim
Exec=gvim -f %F
Terminal=false
Type=Application
Keywords=Text;editor;
Icon=gvim
Categories=Utility;TextEditor;Development;
StartupNotify=true
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;text/x-python;text/x-python3
wulfraed at debian:~$
ALL of that is needed to link a Python source code file (.py) to GVIM
editor, when clicked on from the desktop.
>UNIX's execve() is able to read the first line of an executable and
>invoke its interpreter. I guess OS/2 was doing precisely that in a
>different way?
>
No... the UNIX/Linux shebang (and binary file equivalent magic-number)
is a deliberately written part of a file's "data" content (granted, the
linker writes it for executable binaries).
The description for OS/2 is close to the little used Windows STREAMS
feature.
https://docs.microsoft.com/en-us/windows/win32/fileio/file-streams
https://docs.microsoft.com/en-us/windows/win32/fileio/using-streams
>
>I cannot imagine. I always wondered what REXX was about --- I saw
>programs sometimes written in some website whose name is something like
>Rosetta Code. REXX looked so weird. (``Who would program in that?'')
REXX was created by an IBM researcher who wanted something better than
mainframe JCL (Job Control Language).
https://en.wikipedia.org/wiki/Rexx
>Yeah, REXX looks horrible at first. But arbitrary-precision is
>definitely very attractive. I never liked to deal with floating-point.
>
Unfortunately, the most commonly available is Regina REXX, and to my
knowledge it did not implement the arbitrary precision feature. Softrware
emulation of multprecision floating point is slooooooooooooooooooowwww!
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed at ix.netcom.com http://wlfraed.microdiversity.freeddns.org/
More information about the Python-list
mailing list