Simple question - end a raw string with a single backslash ?

Peter J. Holzer hjp-python at hjp.at
Sat Apr 24 09:31:54 EDT 2021


On 2020-10-19 06:24:18 -0000, Mladen Gogala via Python-list wrote:
> On Mon, 19 Oct 2020 02:44:25 +0000, Stefan Ram wrote:
> > Mladen Gogala <mgogala at yahoo.com> writes:
> >>In Perl, there are no classes. 
> > 
> >   If there are no classes in Perl, then what does
> > 
> > bless REF,CLASSNAME 
> > 
> >   do?
> 
> bless \$ref will make the given reference a reference to the class. And classes is Perl
> are called "modules". However, Perl classes are not the classes in the  real sense. There 
> is no inheritance.

That's wrong. Perl classes have inheritance, and they always have had it
since they were introduced in Perl 5.0 (in 1994).


> You can have a similar thing in C: it's called "struct", it can do
> similar things like Perl modules.

Nope. C structs are data structures. Perl modules are primarily a way to
structure code.


> But C isn't object oriented. Inheritance is an essential
> characteristic of object orientation.

You can have that even in C. One of my first major C programs (back in
the 1980s) was object-oriented (including inheritance). I didn't even
know what "object oriented" meant back then, but the library we used for
the GUI stuff used that style so it felt natural to extend it to
"application level" objects.

> There were attempts to turn Perl into OO language with Moose
> (https://metacpan.org/pod/Moose)

Moose just adds syntactic sugar. It may be easier to read (especially
for people used to other OO languages) and save a bit of typing, but it
doesn't add anything you couldn't do in plain Perl5.

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp at hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://mail.python.org/pipermail/python-list/attachments/20210424/8cb3d9d0/attachment.sig>


More information about the Python-list mailing list