in reply to Re: Python 'is' command
in thread Python 'is' command
... 'is' ... is overkill ...
I strongly agree! What's the point of bringing Scalar::Util::refaddr() et al to the party when == != (and all the other numeric comparators, in the unlikely event they would be of any use) seem to manage just fine:
c:\@Work\Perl\monks>perl use strict; use warnings; use Test::Simple tests => 4; 1..4 sub is { $_[0] == $_[1] } my $x = 3; my $y = 3; my $x_ref = \$x; my $test_ref_1 = \$x; my $test_ref_2 = \$y; ok( is($test_ref_1, $x_ref), 'is Same' ); ok( !is($test_ref_2, $x_ref), 'is Different' ); ok( $test_ref_1 == $x_ref, '==' ); ok( $test_ref_2 != $x_ref, '!=' ); __END__ ok 1 - is Same ok 2 - is Different ok 3 - == ok 4 - !=
Give a man a fish: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Python 'is' command
by haukex (Archbishop) on Aug 14, 2019 at 19:33 UTC | |
by AnomalousMonk (Archbishop) on Aug 15, 2019 at 02:43 UTC | |
by haukex (Archbishop) on Aug 15, 2019 at 06:46 UTC | |
|
Re^3: Python 'is' command
by BillKSmith (Monsignor) on Aug 14, 2019 at 20:22 UTC | |
|
Re^3: Python 'is' command
by bliako (Abbot) on Aug 14, 2019 at 21:17 UTC |