Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Learning Python now coming from Perl

Thread Tools

Learning Python now coming from Perl

Roy Smith
Posts: n/a
Nick Craig-Wood <(E-Mail Removed)> wrote:

> > On the other hand, leaving out the parens returns the function itself,
> > which you can then call later. I've often used this to create data-driven
> > logic.

> I didn't say it wasn't useful, just that if you came from Perl like I
> did, it is an easy mistake to make


> OO lore says whenever you see a type field in an instance you've gone
> wrong - types should be represented by what sort of object you've got,
> not by a type field.

OO lore lives in an ivory tower sometimes I'm working with an existing
system, where objects are marshaled on the wire as type codes followed by a
type-specific number of bytes of data. Internally, it calls these AnyVals
and the concept is pervasive in the architecture. I could work within the
existing architecture, or I could try to fight it.

Yes, I could get rid of the dispatch table and create 20 or 30 classes to
represent all the possible types. I'd end up with several times as much
code, most of it boilerplate. Instead of having a dispatch table of
read/write functions, I'd have a dispatch table of classes, each of which
has a read method and a write method. It doesn't buy anything, and I'd
still have the type codes exposed because I need them to read and write
values to the wire.
Reply With Quote

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
General question - new, and coming up learning curve Tomr Microsoft Certification 4 01-21-2009 08:02 PM
where can I use PERL? is PERL worth learning? Perl Misc 14 04-26-2006 12:38 AM
PyCon is Coming! PyCon is Coming! Steve Holden Python 0 01-05-2006 11:53 AM
e-learning, (collaborative learning environment) collinm Java 1 09-08-2005 09:52 PM
Intuous2 coming today - learning curve? John H. Power Digital Photography 8 02-05-2004 08:21 PM