ACME-QuoteDB

 view release on metacpan or  search on metacpan

lib/ACME/QuoteDB.pm  view on Meta::CPAN

1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
  "Quote", "Attribution Name", "Attribution Source", "Category", "Rating"
  
  for example:
  "Quote", "Attribution Name", "Attribution Source", "Category", "Rating"
  "I hope this has taught you kids a lesson: kids never learn.","Chief Wiggum","The Simpsons","Humor",9
  "Sideshow Bob has no decency. He called me Chief Piggum. (laughs) Oh wait, I get it, he's all right.","Chief Wiggum","The Simpsons","Humor",8
 
=item 1 if these dont suit your needs, ACME::QuoteDB::LoadDB is sub-classable,
 
  so one can extract data anyway they like and populate the db themselves.
  (there is a test that illustrates overriding the stub method, 'dbload')
 
   you need to populate a record data structure:
 
    $self->set_record(quote  => q{}); # mandatory
    $self->set_record(name   => q{}); # mandatory
    $self->set_record(source => q{}); # optional but useful
    $self->set_record(catg   => q{}); # optional but useful
    $self->set_record(rating => q{}); # optional but useful
 
   # then to write the record you call

lib/ACME/QuoteDB.pm  view on Meta::CPAN

1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
=head2 Quote
 
=head2 Catg
 
=head2 QuoteCatg
 
=end comment
 
=head1 DIAGNOSTICS
 
An error such as:
 
C<DBD::SQLite::db prepare_cached failed: no such table: ,...>
 
probably means that you do not have a database created in the correct format.
 
basically, you need to create the database, usually, on a first run
 
you need to add the flag (to the loader):
 
create_db => 1, # first run, create the db

lib/ACME/QuoteDB.pm  view on Meta::CPAN

1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
 
=head1 AUTHOR
 
David Wright, C<< <david_v_wright at yahoo.com> >>
 
=head1 TODO
 
=over 2
 
=item 1 if the database cannot be found, no error is printed!!!
 
or if you have no write access to it!
"you'll just get 'no attribute can be found,,...", which is cryptic to say
the least!
 
=item 1 add a dump backup to csv
 
a backup mechanism for your db to a regular text csv file.
 
=item 1 clean up tests 'skip if module X' not installed

lib/ACME/QuoteDB/LoadDB.pm  view on Meta::CPAN

246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
      $self->write_record;
  }
  close $source or carp $!;
 
  return $self;
}
 
# sub class this - i.e. provide this method in your code (see test
# 01-load_quotes.t)
sub dbload {
  croak 'Override this. Provide this method in a sub class (child) of this object';
  # see tests: t/01-load_quotes.t for examples
}
 
sub _to_utf8 {
    my ($self) = @_;
 
    RECORD:
    foreach my $r (@QUOTE_FIELDS){
        my $val = $self->{record}->{$r};
        if (ref $val eq 'ARRAY'){

lib/ACME/QuoteDB/LoadDB.pm  view on Meta::CPAN

469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
#sub create_db_mysql {
#    my ($self) = @_;
#
#     # hmmmm, what about priv's access, etc
#     # maybe user need to supply a db, they have
#     # access to, already created (just the db though)
#     ## create our db
#     #my $dbhc = DBI->connect('DBI:mysql:database=mysql;host='
#     #                           .$self->{host}, $self->{user}, $self->{pass})
#     #      || croak "db cannot be accessed $! $DBI::errstr";
#
#     #my $dbn = $self->{db};
#     #my $db = qq(CREATE DATABASE $dbn CHARACTER SET utf8 COLLATE utf8_general_ci);
#     # eval {
#     #     $dbhc->do($db) or croak $dbhc->errstr;
#     # };
#     # $@ and croak 'Cannot create database!';
#     # $dbhc->disconnect; $dbhc = undef;
#
#     my $drh = DBI->install_driver('mysql');
#     my $rc = $drh->func("dropdb", $self->{db},
#                    [$self->{host}, $self->{user}, $self->{password}],
#                    'admin'
#                );
#

lib/ACME/QuoteDB/LoadDB.pm  view on Meta::CPAN

499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
#}
 
# XXX refactor with sqlite
sub create_db_tables_mysql {
    my ($self) = @_;
 
     # connect to our db
     my $c = $self->{db}.';host='.$self->{host};
     my $dbh = DBI->connect(
             "DBI:mysql:database=$c", $self->{user}, $self->{pass})
               || croak "db cannot be accessed $! $DBI::errstr";
 
    eval {
        $dbh->do('DROP TABLE IF EXISTS quote;') or croak $dbh->errstr;
 
        $dbh->do('CREATE TABLE IF NOT EXISTS quote (
            quot_id        INTEGER NOT NULL AUTO_INCREMENT,
            attr_id        INTEGER,
            quote          TEXT,
            source         TEXT,
            rating         REAL,
            PRIMARY KEY(quot_id)
            );')
            #)CHARACTER SET utf8 COLLATE utf8_general_ci;
            #) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;
            or croak $dbh->errstr;
 
        $dbh->do('DROP TABLE IF EXISTS attribution;') or croak $dbh->errstr;
 
        $dbh->do('CREATE TABLE IF NOT EXISTS attribution (
            attr_id  INTEGER NOT NULL AUTO_INCREMENT,
            name     TEXT,
            PRIMARY KEY(attr_id)
            );') or croak $dbh->errstr;
 
        $dbh->do('DROP TABLE IF EXISTS category;') or croak $dbh->errstr;
 
        $dbh->do('CREATE TABLE IF NOT EXISTS category (
            catg_id    INTEGER NOT NULL AUTO_INCREMENT,
            catg       TEXT,
            PRIMARY KEY(catg_id)
            );') or croak $dbh->errstr;
 
        $dbh->do('DROP TABLE IF EXISTS quote_catg;') or croak $dbh->errstr;
 
        $dbh->do('CREATE TABLE IF NOT EXISTS quote_catg (
            id    INTEGER NOT NULL AUTO_INCREMENT,
            catg_id    INTEGER,
            quot_id    INTEGER,
            PRIMARY KEY(id)
            );') or croak $dbh->errstr;
 
 
       $dbh->disconnect or warn $dbh->errstr;
 
       $dbh = undef;
    };
 
    return $@ and croak 'Cannot create database tables!';
 
}
 
sub create_db_tables_sqlite {
 
     my $db = QDBI->get_current_db_path;
 
     #XXX is there really no way to do this with the existing
     # connection?!(class dbi)
     my $dbh = DBI->connect('dbi:SQLite:dbname='.$db, '', '')
       || croak "$db cannot be accessed $! $DBI::errstr";
 
    #-- sqlite does not have a varchar datatype: VARCHAR(255)
    #-- A column declared INTEGER PRIMARY KEY will autoincrement.
    eval {
        $dbh->do('DROP TABLE IF EXISTS quote;') or croak $dbh->errstr;
 
        $dbh->do('CREATE TABLE IF NOT EXISTS quote (
            quot_id        INTEGER PRIMARY KEY,
            attr_id        INTEGER,
            quote          TEXT,
            source         TEXT,
            rating         REAL
            );')
            or croak $dbh->errstr;
 
        $dbh->do('DROP TABLE IF EXISTS attribution;') or croak $dbh->errstr;
 
        $dbh->do('CREATE TABLE IF NOT EXISTS attribution (
            attr_id  INTEGER PRIMARY KEY,
            name     TEXT
            );') or croak $dbh->errstr;
 
        $dbh->do('DROP TABLE IF EXISTS category;') or croak $dbh->errstr;
 
        $dbh->do('CREATE TABLE IF NOT EXISTS category (
            catg_id    INTEGER PRIMARY KEY,
            catg       TEXT
            );') or croak $dbh->errstr;
 
        $dbh->do('DROP TABLE IF EXISTS quote_catg;') or croak $dbh->errstr;
 
        $dbh->do('CREATE TABLE IF NOT EXISTS quote_catg (
            id         INTEGER PRIMARY KEY,
            catg_id    INTEGER,
            quot_id    INTEGER
            );') or croak $dbh->errstr;
 
        $dbh->disconnect or carp $dbh->errstr;
 
        $dbh = undef;
    };
 
    return $@ and croak 'Cannot create database tables!';
 
}
 
q(My cat's breath smells like cat food. --Ralph Wiggum);

lib/ACME/QuoteDB/LoadDB.pm  view on Meta::CPAN

661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
* csv file (pre determined format)
 
     pros: quick and easy to load.
     cons: getting the quotes data into the correct format need by this module
 
=item 2
 
* any source.
 
    One can take quote data from any source, override
    L<ACME::QuoteDB::LoadDB/dbload> loader methods to populate a record
    and write it to the db.
     pros: can get any quote data into the db.
     cons: you supply the method. depending on the complexity of the data
           source and munging required this will take longer then the other
           methods.
 
=back
 
=head3 load from csv file

lib/ACME/QuoteDB/LoadDB.pm  view on Meta::CPAN

698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
     
   $load_db->data_to_db;
 
   if (!$load_db->success){print 'failed'}
 
 
=head3 load from any source
 
If those dont catch your interest, ACME::QuoteDB::LoadDB is sub-classable,
so one can extract data anyway they like and populate the db themselves.
(there is a test that illustrates overriding the stub method, 'dbload')
 
you need to populate a record data structure:
 
    $self->set_record(quote  => q{}); # mandatory
    $self->set_record(name   => q{}); # mandatory
    $self->set_record(source => q{}); # optional but useful
    $self->set_record(catg   => q{}); # optional but useful
    $self->set_record(rating => q{}); # optional but useful
 
    # then to write the record you call

lib/ACME/QuoteDB/LoadDB.pm  view on Meta::CPAN

899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
=head2 dbload
 
if your file format is set to 'html' or 'custom' you must
define this method to do your parsing in a sub class.
 
Load from html is not supported because there are too many
ways to represt the data. (same with 'custom')
(see tests for examples - there is a test for loading a 'fortune' file format)
 
One can subclass ACME::QuoteDB::LoadDB and override dbload,
to do our html parsing
 
=head2 debug_record
 
dump record (show what is set on the internal data structure)
 
e.g. Data::Dumper
 
=head2 set_record

lib/ACME/QuoteDB/LoadDB.pm  view on Meta::CPAN

973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
   
=head2 write_record
 
takes the data structure 'record' '$self->get_record'
(which must exist). checks if attribution name ($self->get_record('name')) exists,
if so, uses existing attribution name, otherwsie creates a new one
 
Load from html is not supported because there are too many
ways to represt the data. (see tests for examples)
 
One can subclass ACME::QuoteDB::LoadDB and override dbload,
to do our html parsing
 
=head2 create_db_tables
  
create an empty quotes database (with correct tables).
 
(usually only performed the first time you load data)
 
B<NOTE: will overwrite ALL existing data>

lib/ACME/QuoteDB/LoadDB.pm  view on Meta::CPAN

1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
    know about them, so I will obfuscate them here
 
=head2 create_db_tables_sqlite
 
=head2 create_db_tables_mysql
 
=end comment
 
=head1 DIAGNOSTICS
 
An error such as:
 
C<DBD::SQLite::db prepare_cached failed: no such table: ,...>
 
probably means that you do not have a database created in the correct format.
 
basically, you need to create the database, usually, on a first run
 
you need to add the flag:
 
create_db => 1, # first run, create the db

t/01-load_quotes.t  view on Meta::CPAN

122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
           'Grandpa Simpson',
           'Ralph Wiggum',
          );
   
  is( $sq->list_attr_names, join("\n", sort(@expected_attribution_list)));
}
 
{ # load from html is not supported because there are too many
  # ways to represt the data.
  # this is an example of extracting quotes from html:
  # subclass ACME::QuoteDB::LoadDB and override dbload,
  # to do our html parsing
  package LoadQuoteDBFromHtml;
  use base 'https://metacpan.org/pod/ACME::QuoteDB::LoadDB">ACME::QuoteDB::LoadDB';
  use Carp qw/croak/;
  use Data::Dumper qw/Dumper/;
 
    sub dbload {
      my ($self, $file) = @_;

t/01-load_quotes.t  view on Meta::CPAN

244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
'From Kim "Howard" Johnson\'s',
'Gareth McCaughan',
'Gordon McMillan',
'Guido van Rossum',
'GvR',
'Jack Jansen',
'Jeremy Hylton',
'Jim Ahlstrom',
'Jim Fulton and Paul Everitt on the Bobo list',
'Jim Fulton and Tim Peters',
'John Eikenberry on the Bobo list',
'John Holmgren',
'John J. Lehmann',
'John Redford',
'Joseph Strout',
"Kristj\x{E1}n J\x{F3}nsson",
'Larry Wall',
'Mark Jackson',
'Matthew Lewis Carroll Smith',
'Michael Palin',
'Mike Meyer',

t/01-load_quotes.t  view on Meta::CPAN

276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
            'Told by Nick Leaton',
            'Tom Christiansen',
            'Vladimir Marangozov and Tim Peters',
        );
   
  is( $sq->list_attr_names, join "\n", sort @expected_attribution_list);
}
 
{ # prove load a fortune format file
  # this is an example of importing a file in the 'fortune' format
  # subclass ACME::QuoteDB::LoadDB and override dbload, to do our parsing
  package Fortune2QuoteDB;
  use base 'https://metacpan.org/pod/ACME::QuoteDB::LoadDB">ACME::QuoteDB::LoadDB';
  use Carp qw/croak/;
  use Data::Dumper qw/Dumper/;
 
  sub dbload {
    my ($self, $file) = @_;
 
    open my $source, '<:encoding(utf8)', $file || croak $!;

t/data/python_quotes.txt  view on Meta::CPAN

88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
One of the things that makes it interesting, is exactly how much Guido has
managed to exploit that *one* implementation trick of 'namespaces'.
      -- Steven D. Majewski, 17 Sep 1993
 
Anyone familiar with Modula-3 should appreciate the difference between a
layered approach, with generic Rd/Wr types, and the Python 'C with foam
padding' approach.
      -- John Redford, 24 Nov 1993
 
People simply will not agree on what should and shouldn't be "an error", and
once exception-handling mechanisms are introduced to give people a choice, they
will far less agree on what to do with them.
      -- Tim Peters, 17 Dec 1993
 
Note that because of its semantics, 'del' *can't* be a function: "del a"
deletes 'a' from the current namespace. A function can't delete something from
the calling namespace (except when written by Steve Majewski :-).
      -- Guido van Rossum, 1 Aug 1994
 
    I don't know a lot about this artificial life stuff -- but I'm suspicious

t/data/python_quotes.txt  view on Meta::CPAN

263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
I mean, just take a look at Joe Strout's brilliant little "python for
beginners" page. Replace all print-statements with sys.stdout.write(
string.join(map(str, args)) + "\n") and you surely won't get any new beginners.
And That Would Be A Very Bad Thing.
      -- Fredrik Lundh, 27 Aug 1996
 
Ya, ya, ya, except ... if I were built out of KSR chips, I'd be running at 25
or 50 MHz, and would be wrong about ALMOST EVERYTHING almost ALL THE TIME just
due to being a computer! Think about it -- when's the last time you spent 20
hours straight debugging your son/wife/friend/neighbor/dog/ferret/snake? And
they *still* fell over anyway? Except in a direction you've never seen before
each time you try it? The easiest way to tell you're dealing with a computer is
when the other side keeps making the same moronic misteakes over and misteakes
over and misteakes over and misteakes over and misteakes over and misteakes
CTRL-C again.
      -- Tim Peters, 30 Apr 1997
 
BTW, a member of the ANSI C committee once told me that the only thing rand is
used for in C code is to decide whether to pick up the axe or throw the dwarf,
and if that's true I guess "the typical libc rand" is adequate for all but the

t/data/python_quotes.txt  view on Meta::CPAN

438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
of it, it probably was. Hee hee.
      -- Gordon McMillan, 8 Jun 1998
 
The majority of programmers aren't really looking for flexibility. Most
languages that enjoy huge success seem to do so not because they're flexible,
but because they do one particular thing *extremely* well. Like Fortran for
fast number-crunching in its day, or Perl for regexps, or C++ for compatibility
with C, or C for ... well, C's the exception that proves the rule.
      -- Tim Peters, 11 Jun 1998
 
It has also been referred to as the "Don Beaudry *hack*," but that's a
misnomer. There's nothing hackish about it -- in fact, it is rather elegant and
deep, even though there's something dark to it.
      -- Guido van Rossum, _Metaclass Programming in Python 1.5_
 
Just point your web browser at http://www.python.org/search/ and look for
"program", "doesn't", "work", or "my". Whenever you find someone else whose
program didn't work, don't do what they did. Repeat as needed.
      -- Tim Peters, on python-help, 16 Jun 1998
 
Now some people see unchecked raw power and flee from perceived danger, while

t/data/python_quotes.txt  view on Meta::CPAN

526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
far it appears to be a beast that's compatible with cuddly pythons.
      -- Tim Peters, 6 Aug 1998
 
I wonder what Guido thinks he might do in Python2 (assuming, of course, that he
doesn't hire a bus to run over him before then <wink>).
      -- Tim Peters, 26 Aug 1998
 
After writing CGI scripts the traditional way for a few years, it is taking
awhile to reshape my thinking. No sledgehammer to the head yet, but lots of
small sculpting hammers...
      -- John Eikenberry on the Bobo list, 27 Aug 1998
 
I believe sometimes numbers creep into my programs as strings, so '4'/2 needs
to also be 2. Other languages do this. Since this is due in part to user input,
I guess 'four'/2, 'quattro/2', 'iv/2' etc. need to be 2 as well; don't know any
other language that does so, but Python could take the lead here in software
reliability. Any white space should be ignored, including between my ears. I
don't have time to write any useful software, so I've decided to devote myself
to proposing various changes to the Python interpreter.
      -- Donn Cave uses sarcasm with devastating effect, 28 Aug 1998

t/data/python_quotes.txt  view on Meta::CPAN

838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
    "Can we kill this thread? The only thing it does as far as I'm concerned is
increase the posting statistics. :-)"
    "don't-open-cans-of-worms-unless-you're-looking-for-a-new-diet-ly y'rs"
      -- Guido van Rossum and Tim Peters, 6 Jan 1999
 
    Hey, that was the first truly portable laptop! Of course I'm nostalgic.
Came with a mighty 24Kb RAM standard, & I popped the extra $80 to max it out at
32Kb. Much of Cray's register assigner was developed on that beast: unlike the
prototype Crays of the time, the M100 was always available and never crashed.
Even better, I could interrupt it any time, poke around, and resume right where
it left off <wink>.
    m100-basic-reminded-me-a-lot-of-python-except-that-it-sucked-ly y'rs
      -- Tim Peters remembering the Model 100, 10 Jan 1999
 
    "Heh -- all it really broke so far was my resistance to installing Tk. I
suppose wizardry is inevitable after one installs something, though <wink>."
    "Spoken like a truly obsessive-compulsive wizard! It-takes-one-to-know
-one..."
      -- Tim Peters and Guido van Rossum, 6 Jan 1999

t/data/python_quotes.txt  view on Meta::CPAN

1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
and prototype, until you've got clean separation of the system into managable
pieces, then code in whatever language most suits the need of each piece.
      -- Gordon McMillan, 15 Dec 1999
 
When Jim [Fulton] says "tricky" it means your brain could explode.
      -- Michel Pelletier, 15 Dec 1999
 
You have start-tags, attributes, end-tags and character data. We have all seen
"XML applications" and "XML parsers" which handle this gang- of-four concepts.
... Now we can peer over the parapet and shout "your parser smells of
elderberries" or "I wave my mixed content at your ankles", as long as we like
but the simple gang-of-four base apps will not go away.
      -- Sean McGrath, 19 Dec 1999
 
Abstraction is one of those notions that Python tosses out the window, yet
expresses very well.
      -- Gordon McMillan, 6 Jan 2000
 
The set of naming conventions has a cardinality equal to the number of Python
users.
      -- Gordon McMillan, 6 Jan 2000

t/data/python_quotes.txt  view on Meta::CPAN

1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
The way to build large Python applications is to componentize and
loosely-couple the hell out of everything.
      -- Aahz Maruch, 6 Jan 2000
 
It's not the mail volume that bothers me -- I can ignore 100s of messages a day
very quickly. It's the time it takes to respond to all of them.
      -- Guido van Rossum, 20 Jan 2000
 
This is the way of Haskell or Design by Contract of Eiffel. This one is like
wearing a XV century armor, you walk very safely but in a very tiring way.
      -- Manuel Gutierrez Algaba, 26 Jan 2000
 
Life's better without braces.
      -- Unofficial motto of IPC8, coined by Bruce Eckel
 
"Aggressive" means "sometimes wrong".
      -- John Aycock at IPC8, during his "Agressive Type Inferencing" talk
 
Do I do everything in C++ and teach a course in advanced swearing?
      -- David Beazley at IPC8, on choosing a language for teaching

t/data/python_quotes.txt  view on Meta::CPAN

1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
dictator, but also wants to treat people like grownups. This probably worked
better before Python got a large American audience <0.9 wink>.
      -- Tim Peters, 10 Feb 2000
 
I have formal proofs that any change of the indentation rules results in 35%
increase of the page faults for only 63.7% of the cache misses. The net effect
is an overall slowdown of 10%.
      -- Vladimir Marangozov after Yet Another indentation flamewar, 16 Feb
         2000
 
... let me just say that my least-favourite Python error message is
"SyntaxError: invalid syntax", which somehow manages to be both overly terse
and redundant at the same time.
      -- Greg Ward, 15 Feb 2000
 
    See, functional programmers are an insular lot. You rarely see them in
public, except at parades when they all have antler- hats and silly shoes on.
So they completely missed the infamous "goto considered harmful" thread and
didn't even realize they were doing anything wrong.
    Now, let's pretend you're writing a 'bot that can pass as a functional
programmer. There's a complex protocol here. When two functional programmers

t/data/python_quotes.txt  view on Meta::CPAN

1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
You didn't say what you want to accomplish. If the idea of "provably correct"
programs appeals to you, Eiffel will give you more help than any other
practical language I know of. But since your post didn't lay out your
assumptions, your goals, or how you view language characteristics as fitting in
with either, you're not a *natural* candidate for embracing Design by Contract
<0.6 wink>.
      -- Tim Peters, 3 Jun 2001
 
    The static people talk about rigorously enforced interfaces, correctness
proofs, contracts, etc. The dynamic people talk about rigorously enforced
testing and say that types only catch a small portion of possible errors. The
static people retort that they don't trust tests to cover everything or not
have bugs and why write tests for stuff the compiler should test for you, so
you shouldn't rely on *only* tests, and besides static types don't catch a
small portion, but a large portion of errors. The dynamic people say no program
or test is perfect and static typing is not worth the cost in language
complexity and design difficulty for the gain in eliminating a few tests that
would have been easy to write anyway, since static types catch a small portion
of errors, not a large portion. The static people say static types don't add
that much language complexity, and it's not design "difficulty" but an
essential part of the process, and they catch a large portion, not a small
portion. The dynamic people say they add enormous complexity, and they catch a
small portion, and point out that the static people have bad breath. The static
people assert that the dynamic people must be too stupid to cope with a real
language and rigorous requirements, and are ugly besides.
    This is when both sides start throwing rocks.
      -- Quinn Dunkan, 13 Jul 2001
 
I am becoming convinced that Unicode is a multi-national plot to take over the

t/data/www.amk.ca/quotations/python-quotes/index.html  view on Meta::CPAN

155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<p class='source'>Tim Peters, 16 Sep 1993</p>
<p class='quotation' id='q17'>One of the things that makes it
interesting, is exactly how much Guido has managed to exploit that
<em>one</em> implementation trick of 'namespaces'.</p>
<p class='source'>Steven D. Majewski, 17 Sep 1993</p>
<p class='quotation' id='q18'>Anyone familiar with Modula-3 should
appreciate the difference between a layered approach, with generic
Rd/Wr types, and the Python 'C with foam padding' approach.</p>
<p class='source'>John Redford, 24 Nov 1993</p>
<p class='quotation' id='q19'>People simply will not agree on what
should and shouldn't be "an error", and once exception-handling
mechanisms are introduced to give people a choice, they will far
less agree on what to do with them.</p>
<p class='source'>Tim Peters, 17 Dec 1993</p>
<p class='quotation' id='q20'>Note that because of its semantics,
'del' <em>can't</em> be a function: "del a" deletes 'a' from the
current namespace. A function can't delete something from the
calling namespace (except when written by Steve Majewski :-).</p>
<p class='source'>Guido van Rossum, 1 Aug 1994</p>
<p class='quotation' id='q21'>I don't know a lot about this
artificial life stuff -- but I'm suspicious of anything Newsweek

t/data/www.amk.ca/quotations/python-quotes/page-2.html  view on Meta::CPAN

127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
Strout's brilliant little "python for beginners" page. Replace all
print-statements with <code>sys.stdout.write( string.join(map(str,
args)) + "\n")</code> and you surely won't get any new beginners.
And That Would Be A Very Bad Thing.</p>
<p class='source'>Fredrik Lundh, 27 Aug 1996</p>
<p class='quotation' id='q43'>Ya, ya, ya, except ... if I were
built out of KSR chips, I'd be running at 25 or 50 MHz, and would
be wrong about ALMOST EVERYTHING almost ALL THE TIME just due to
being a computer! Think about it -- when's the last time you spent
20 hours straight debugging your
son/wife/friend/neighbor/dog/ferret/snake? And they <em>still</em>
fell over anyway? Except in a direction you've never seen before
each time you try it? The easiest way to tell you're dealing with a
computer is when the other side keeps making the same moronic
misteakes over and misteakes over and misteakes over and misteakes
over and misteakes over and misteakes CTRL-C again.</p>
<p class='source'>Tim Peters, 30 Apr 1997</p>
<p class='quotation' id='q44'>BTW, a member of the ANSI C committee
once told me that the only thing rand is used for in C code is to
decide whether to pick up the axe or throw the dwarf, and if that's
true I guess "the typical libc rand" is adequate for all but the

t/data/www.amk.ca/quotations/python-quotes/page-3.html  view on Meta::CPAN

97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
come to think of it, it probably was. Hee hee.</p>
<p class='source'>Gordon McMillan, 8 Jun 1998</p>
<p class='quotation' id='q71'>The majority of programmers aren't
really looking for flexibility. Most languages that enjoy huge
success seem to do so not because they're flexible, but because
they do one particular thing <em>extremely</em> well. Like Fortran
for fast number-crunching in its day, or Perl for regexps, or C++
for compatibility with C, or C for ... well, C's the exception that
proves the rule.</p>
<p class='source'>Tim Peters, 11 Jun 1998</p>
<p class='quotation' id='q72'>It has also been referred to as the
"Don Beaudry <em>hack</em>," but that's a misnomer. There's nothing
hackish about it -- in fact, it is rather elegant and deep, even
though there's something dark to it.</p>
<p class='source'>Guido van Rossum, <cite>Metaclass Programming in
Python 1.5</cite></p>
<p class='quotation' id='q73'>Just point your web browser at
http://www.python.org/search/ and look for "program", "doesn't",
"work", or "my". Whenever you find someone else whose program
didn't work, don't do what they did. Repeat as needed.</p>
<p class='source'>Tim Peters, on python-help, 16 Jun 1998</p>

t/data/www.amk.ca/quotations/python-quotes/page-3.html  view on Meta::CPAN

193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
pythons.</p>
<p class='source'>Tim Peters, 6 Aug 1998</p>
<p class='quotation' id='q86'>I wonder what Guido thinks he might
do in Python2 (assuming, of course, that he doesn't hire a bus to
run over him before then &lt;wink&gt;).</p>
<p class='source'>Tim Peters, 26 Aug 1998</p>
<p class='quotation' id='q87'>After writing CGI scripts the
traditional way for a few years, it is taking awhile to reshape my
thinking. No sledgehammer to the head yet, but lots of small
sculpting hammers...</p>
<p class='source'>John Eikenberry on the Bobo list, 27 Aug 1998</p>
<p class='quotation' id='q88'>I believe sometimes numbers creep
into my programs as strings, so '4'/2 needs to also be 2. Other
languages do this. Since this is due in part to user input, I guess
'four'/2, 'quattro/2', 'iv/2' etc. need to be 2 as well; don't know
any other language that does so, but Python could take the lead
here in software reliability. Any white space should be ignored,
including between my ears. I don't have time to write any useful
software, so I've decided to devote myself to proposing various
changes to the Python interpreter.</p>
<p class='source'>Donn Cave uses sarcasm with devastating effect,



( run in 0.960 second using v1.01-cache-2.11-cpan-cba739cd03b )