comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: LIST "bug": .Remove on an empty list
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: LIST "bug": .Remove on an empty list [message #73992 is a reply to message #73991] Tue, 14 December 2010 07:49 Go to previous messageGo to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Dec 14, 1:35 pm, Paul van Delst <paul.vande...@noaa.gov> wrote:
> If there
> was a list "Empty" or "IsEmpty" method (like ruby's "empty?" method...for both arrays/lists and hashes), I would be more
> tempted to use it,
>
>   if ( l.isempty() ) then ...return, handle error, whatever...
>
> as opposed to the current IDL idiom,
>
>   if ( n_elements(l) eq 0 ) then ...return, handle error, whatever...
>
> For some reason I find this type of mixture of functional and object coding jarring - and this is from someone who has
> spent most of his life writing Fortran code! (I think it's also why ruby appeals to me more than python).

I agree there should be an empty() method. Besides the reason you
mentioned, it is also more direct and expressive to just test for
empty() than to do a comparison with a function call. I will add that
to the class I am writing to support assignment in arrays inside
lists.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: LIST performance
Next Topic: LIST "bug": .Remove on an empty list

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:25:04 PDT 2025

Total time taken to generate the page: 0.00453 seconds