Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

Jonathan Gardner jgardner at jonathangardner.net
Wed Feb 17 20:00:50 EST 2010


On Feb 17, 10:39 am, John Bokma <j... at castleamber.com> wrote:
> Jonathan Gardner <jgard... at jonathangardner.net> writes:
> > Then I looked at a stack trace from a different programming language
> > with lots of anonymous functions. (I believe it was perl.)
>
> > I became enlightened.
>
> If it was Perl [1], I doubt it. Because line numbers are reported, and
> if that doesn't help you, you can annotate anonymous functions with a
> nick name using
>
> local *__ANON__ = 'nice name';
>
> Finding an issue, and not looking for a solution is not called becoming
> enlightened ;-)
>
> ~$ perl -e '
> use Carp;
>
> my $anon = sub { local *__ANON__ = "hello, world"; croak "oops"; };
> $anon->();
> '
>
> oops at -e line 4
>         main::hello, world() called at -e line 5
>
> As you can see, and a line number is generated, and the nice name is
> shown.
>
> If you generate anonymouse functions on the fly based on parameters, you
> can encode this into the nice name, of course.
>
> Sadly, often bold statements about a language are made in ignorance.
>

$ perl -e '$a = sub () {die "it may have been javascript, but"}; $b =
sub () {die "I am pretty sure it was perl"}; $b->()'



More information about the Python-list mailing list