Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: [TYPES] The type/object distinction and possible synthesis of OOPand imperative programming languages

Reply
Thread Tools

Re: [TYPES] The type/object distinction and possible synthesis of OOPand imperative programming languages

 
 
Ned Batchelder
Guest
Posts: n/a
 
      04-19-2013
On 4/19/2013 12:16 PM, Steven D'Aprano wrote:
> On Fri, 19 Apr 2013 12:02:00 -0400, Roy Smith wrote:
>
>> PS: a great C++ interview question is, "What's the difference between a
>> class and a struct?" Amazing how few self-professed C++ experts have no
>> clue.

> I'm not a C++ expert, but I am an inquiring mind, and I want to know the
> answer!
>
>

The only difference between a class and a struct is that classes default
to "private" access for their members, and structs default to "public".

--Ned.
 
Reply With Quote
 
 
 
 
Dennis Lee Bieber
Guest
Posts: n/a
 
      04-19-2013
On Fri, 19 Apr 2013 12:02:00 -0400, Roy Smith <(E-Mail Removed)> declaimed
the following in gmane.comp.python.general:

> PS: a great C++ interview question is, "What's the difference between a
> class and a struct?" Amazing how few self-professed C++ experts have no
> clue.


It's been 15+ years but...

"class" defaults to private; " struct" defaults to public... (very
simplified <G>)
--
Wulfraed Dennis Lee Bieber AF6VN
http://www.velocityreviews.com/forums/(E-Mail Removed) HTTP://wlfraed.home.netcom.com/

 
Reply With Quote
 
 
 
 
Roy Smith
Guest
Posts: n/a
 
      04-19-2013
I wrote:
> > I suppose people who grew up learning Python as their first language
> > look at something like C++ and say, "That's not OOP because classes
> > aren't objects", or something equally silly.

>


In article <517172e7$0$29977$c3e8da3$(E-Mail Removed) om>,
Steven D'Aprano <(E-Mail Removed)> wrote:
> You might say that, but I find in my experience that Python users don't
> tend to fall for the "No True Scotsman" fallacy anywhere near as often as
> (say) Java or C++ users.


Now that I think about it, I suspect relatively few people learned
Python as their first programming language.

Java, for example, is very popular as a teaching language in colleges
and universities. There are lots of people who go through a 4-year
program, do all of their coursework in Java, and come out as one-trick
ponies.

There aren't many schools who teach Python as a first (and only
language), but I suppose it's starting to catch on. 5 years from now,
we may see waves of kids graduating from college knowing nothing but
Python, with a similarly narrow view of the universe.
 
Reply With Quote
 
Roy Smith
Guest
Posts: n/a
 
      04-19-2013
In article <(E-Mail Removed)>,
Dennis Lee Bieber <(E-Mail Removed)> wrote:

> On Fri, 19 Apr 2013 12:02:00 -0400, Roy Smith <(E-Mail Removed)> declaimed
> the following in gmane.comp.python.general:
>
> > PS: a great C++ interview question is, "What's the difference between a
> > class and a struct?" Amazing how few self-professed C++ experts have no
> > clue.

>
> It's been 15+ years but...
>
> "class" defaults to private; " struct" defaults to public... (very
> simplified <G>)


You were doing well until you added the "very simplified" part That
is indeed the only difference.

Many people are surprised that you can write member functions for
structs. Or that you can subclass (substruct?) them.
 
Reply With Quote
 
Steven D'Aprano
Guest
Posts: n/a
 
      04-19-2013
On Fri, 19 Apr 2013 19:37:38 -0400, Roy Smith wrote:

> There aren't many schools who teach Python as a first (and only
> language), but I suppose it's starting to catch on. 5 years from now,
> we may see waves of kids graduating from college knowing nothing but
> Python, with a similarly narrow view of the universe.


Send the young whipper-snappers here, we'll soon learn 'em better!



--
Steven


 
Reply With Quote
 
88888 Dihedral
Guest
Posts: n/a
 
      04-20-2013
Ned Batchelder於 2013年4月20日星期*UTC+8上午12時41分03 寫道:
> On 4/19/2013 12:16 PM, Steven D'Aprano wrote:
>
> > On Fri, 19 Apr 2013 12:02:00 -0400, Roy Smith wrote:

>
> >

>
> >> PS: a great C++ interview question is, "What's the difference between a

>
> >> class and a struct?" Amazing how few self-professed C++ experts have no

>
> >> clue.

>
> > I'm not a C++ expert, but I am an inquiring mind, and I want to know the

>
> > answer!

>
> >

>
> >

>
> The only difference between a class and a struct is that classes default
>
> to "private" access for their members, and structs default to "public".
>
>
>
> --Ned.

In python even a class can be decorated. Also features of instances
can be added at run time from programs by different programmers
or even programs from machines by the code generation scheme
used in many CAD tools.

Nowadays the concept of a structure is not clear without
specifying the language used in programming.

A list is a structure of non-homogeneous types of items in LISP,
PERL and PYTHON.

But the cases are different in C++, PASCAL, ADDA, JAVA ....
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: [TYPES] The type/object distinction and possible synthesis of OOPand imperative programming languages Ian Kelly Python 0 04-16-2013 11:52 PM
Re: [TYPES] The type/object distinction and possible synthesis of OOPand imperative programming languages Mark Janssen Python 0 04-16-2013 11:40 PM
Re: [TYPES] The type/object distinction and possible synthesis of OOPand imperative programming languages Mark Janssen Python 0 04-16-2013 11:16 PM
Re: [TYPES] The type/object distinction and possible synthesis of OOPand imperative programming languages Matthias Felleisen Python 0 04-15-2013 01:50 PM
Re: [TYPES] The type/object distinction and possible synthesis of OOPand imperative programming languages Uday S Reddy Python 0 04-15-2013 09:06 AM



Advertisments