APL, i haven't thought about that in 15 years. I think it was (quad)CT
for comparison tolerance, at least in IBM APL.
Alex Martelli wrote:
> Tom Anderson <[EMAIL PROTECTED]> wrote:
>...
> > What would approximate FP equality even mean? How approximate?
>
> In APL, it meant "to within [a certa
On 25 Oct 2005 07:46:07 GMT, Duncan Booth <[EMAIL PROTECTED]> wrote:
>Tim Roberts wrote:
>
>>>
>>>- Nestable Pascal-like comments (useful): (* ... *)
>>
>> That's only meaningful in languages with begin-comment AND end-comment
>> delimiters. Python has only begin-comment. Effectively, you CAN n
Tim Roberts wrote:
>>
>>- Nestable Pascal-like comments (useful): (* ... *)
>
> That's only meaningful in languages with begin-comment AND end-comment
> delimiters. Python has only begin-comment. Effectively, you CAN nest
> comments in Python:
I believe that the OP is mistaken. In standard Pas
[EMAIL PROTECTED] wrote:
>This post comes from a boring morning, if you are busy ignore this.
>This post is only for relaxed people.
>
>I've found this page, "Syntax Across Languages", it contains many
>errors and omissions, but it's interesting.
>http://mer
Tom Anderson wrote:
> This is taken from the AI 754 standard, i take it? :)
>
> Seriously, that's horrible. Fredrik, you are a bad man, and run a bad
> railway.
>
> However, looking at the page the OP cites, the only mention of that
> operator i can find is in Dylan, and in Dylan, it's not
Dennis Lee Bieber <[EMAIL PROTECTED]> writes:
> On Sun, 23 Oct 2005 20:59:46 -0400, Mike Meyer <[EMAIL PROTECTED]> declaimed
> the following in comp.lang.python:
>
>> Hopefully user defined. Rexx has a global control that lets you set
>> the number of digits to be considered significant in doing an
Thank you for all the answers, some people have already answered for me
about most details I don't agree :-)
Mike Meyer>Rexx has a global control that lets you set the number of
digits to be considered significant in doing an FP equality test.<
Mathematica too, I think.
Tom Anderson>There are a
Tom Anderson <[EMAIL PROTECTED]> writes:
> On Sun, 23 Oct 2005, Fredrik Lundh wrote:
>> [EMAIL PROTECTED] wrote:
>>> - ~== for approximate FP equality
>> str(a) == str(b)
> This is taken from the AI 754 standard, i take it? :)
>
> Seriously, that's horrible. Fredrik, you are a bad man, and
Tom Anderson <[EMAIL PROTECTED]> wrote:
...
> What would approximate FP equality even mean? How approximate?
In APL, it meant "to within [a certain quad-global whose name I don't
recall] in terms of relative distance", i.e., if I recall correctly,
"a=b" meant something like "abs(a-b)/(abs(a)+ab
On Sun, 23 Oct 2005, Fredrik Lundh wrote:
> [EMAIL PROTECTED] wrote:
>
>> - ~== for approximate FP equality
>
> str(a) == str(b)
This is taken from the AI 754 standard, i take it? :)
Seriously, that's horrible. Fredrik, you are a bad man, and run a bad
railway.
However, looking at the
<[EMAIL PROTECTED]> wrote:
> Alex> I've seen enough occurrences of "lambda x: x" in Python code with
> Alex> a generally functional style that I'd love to have
> Alex> operator.identity (and a few more trivial functions like that) for
> Alex> readability;-)
>
> But, but, but [Skip
Alex> I've seen enough occurrences of "lambda x: x" in Python code with
Alex> a generally functional style that I'd love to have
Alex> operator.identity (and a few more trivial functions like that) for
Alex> readability;-)
But, but, but [Skip gets momentarily apoplectic, then reco
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> just curious, how can this identity function be used ? In haskell,
> because all functions are curried, I can sort of visualize/understand
> how id is used. Not quite understand how it can be used in python.
There was a very recent example posted to
<[EMAIL PROTECTED]> wrote:
...
> - Information about the current line and file as Ruby:
> __LINE__ __FILE__
> Instead of the python version:
> inspect.stack()[0][2] inspect.stack()[0][1]
__file__ is around in Python, too, but there's no __line__ (directly).
> - identity function: "identity" as
Fredrik Lundh <[EMAIL PROTECTED]> wrote:
>
>> - comparison returns 4 values (i.e. inferior, equal, superior or not
>> comparable), as in Pliant: "compare"
>
cmp("a", "b")
> -1
cmp("a", "a")
> 0
cmp("b", "a")
> 1
cmp("ä", u"ä")
> Traceback (most recent call last):
> File "", l
"beza1e1" wrote:
> It has is uses. I had some kind of parser and had a dict like this:
> {case: function, ...} It had to be a dict, because i wanted to
> dynamically add and remove cases. In some cases nothing had to be done.
> To represent this in the dict a identity function is needed.
in Pytho
just curious, how can this identity function be used ? In haskell,
because all functions are curried, I can sort of visualize/understand
how id is used. Not quite understand how it can be used in python.
beza1e1 wrote:
> >>> id("blub")
> -1210548288
>
> This is not identity in a mathematical view.
>>> id("blub")
-1210548288
This is not identity in a mathematical view.
def identity(x): return x
It has is uses. I had some kind of parser and had a dict like this:
{case: function, ...} It had to be a dict, because i wanted to
dynamically add and remove cases. In some cases nothing had to be d
[EMAIL PROTECTED] wrote:
> Thank you Fredrik Lundh for showing everybody that indeed lot of people
> feel the need of such function in Python too.
you seem to be missing the point: all those versions are highly optimized,
and tuned for the specific use-cases. a generic flatten would be useless
i
Thank you Fredrik Lundh for showing everybody that indeed lot of people
feel the need of such function in Python too.
>to create a generic version, you have to decide which sequences to treat like
>sequences<
In my version I give the function some parameter(s) to define what I
want to flatten. I
[EMAIL PROTECTED] wrote:
> >sure looks like four possible outcomes.<
>
> Right (but to me four explicit answers seem better than three answers
> and an exception still).
def cmp4(a, b):
try:
return cmp(a, b)
except:
return None
--
http://mail.python.org/mailman/listi
[EMAIL PROTECTED] wrote:
> >if you can define the semantics, it's a few lines of code. if you're not
> sure about the semantics, a built-in won't help you...<
>
> I think the language needs a fast built-in version of it. If something
> is both inside Mathematica and Ruby, then probably it can be
Thank you for the comments, Fredrik Lundh.
>(that's (mostly) CPython-dependent, and should be avoided)<
Then a non CPython-dependent way of doing it can be even more useful.
>sure looks like four possible outcomes.<
Right (but to me four explicit answers seem better than three answers
and an e
[EMAIL PROTECTED] wrote:
> - Information about the current line and file as Ruby:
> __LINE__ __FILE__
> Instead of the python version:
> inspect.stack()[0][2] inspect.stack()[0][1]
(that's (mostly) CPython-dependent, and should be avoided)
> - ~== for approximate FP equality
str(a) == str(b)
>
This post comes from a boring morning, if you are busy ignore this.
This post is only for relaxed people.
I've found this page, "Syntax Across Languages", it contains many
errors and omissions, but it's interesting.
http://merd.sourceforge.net/pixel/language-study/syntax-a
25 matches
Mail list logo