Re: at what complexity, a comparison fails ?



Stef Mientki wrote:
hello,

I had a program that worked perfectly well.
In this program modules were dynamically added,
just by putting the file in a predefined directory.

Now one of the interface mechanisms was to see if some parameter was
changed in a an instance,
by comparing the value from the instance with its previous value

This went all well, untill I added a too complex variable,
then the program stopped working, without generating exceptions.

So it seems that comparing a too complex value isn't allowed.
the variable was something like:

A = [ <ndarray>, <ndarray>, ..., [<color>,<color>,...], [<float>,
<float>, ... ] ]

So what I need was something like:
if A != A_prev :
... do something
A_prev = A

And this crashes, or at least it doesn't work but also doesn't generate
exceptions.
It does seems to work, if A only contains 1 array.

Why am I not allowed to compare A and A_prev ??
And in general, how complex might a list be to make a valid comparison,
or what are the rules ?

Remember that numpy arrays use rich comparisons. (ndarray1 != ndarray2) gives
another array, not a boolean value. The resulting array cannot be used in an
"if" clause.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

.



Relevant Pages

  • Re: Text Script
    ... more overhead than reading from an array as it is an in-memory operation. ... > Rewinding a file might indeed be instantaneous as you say, ... > comparing apples to oranges here. ... and the simplicity of using the dictionary object. ...
    (microsoft.public.windows.server.scripting)
  • Re: Roll your own std::vector ???
    ... comparing elements in one array to elements in other arrays. ... Also, if you are inserting into an array, ... linked lists. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Need help comparing Array data
    ... Need help comparing Array data ... think this is the big jump I need to making things work. ... elsif userinput1> userinput2 ... So my question is how do I go about comparing my two arrays to determine ...
    (comp.lang.ruby)
  • Re: 2D arrays simulated using lists
    ... I would be very sad to see you believe Tcl doesn't meet your ... of index, so I'm comparing the indexes at first, then I'm comparing ... using [array set] because I thought that it would make the whole ... array set ListeActuelleAgents [list ...
    (comp.lang.tcl)
  • Re: Problem displaying one column of one row from a database with PHP.
    ... You're comparing the string 'id' with what's in ... >The point of this code is to retrieve the user information to validate ... >there is an entry in the database that matches data sent in the ... >row as an array. ...
    (comp.lang.php)