Hello,
The API is still list-based until the new year, but we are definitely
encouraging people to move code towards that point of view. I asked
Rasmus and there is probably a quick(ish) naughty way to do this, but we'd
rather not have people use naughty code because the implementation might
change in future. (So naughty code is by definition code with relies on
aspects of the implementation that are not part of the API.)
So a reasonable way to do this (and not much slower than in the existing
way) is to do:
maxResonanceSerial = root.currentNmrProject.sortedResonances()[-1].serial
so relatively painless. (You might think that x.sortedResonances() is a
lot worse than x.resonances, but the latter has to make a copy of the list
in any case, so is not much better.)
Wayne
On Tue, 12 Dec 2006, Gary S. Thompson wrote:
> Dear Delopers
>
> in some pre 1.0.12 code I had the following code:
>
> maxResonanceSerial = root.currentNmrProject.resonances[-1].serial
>
> I was then using maxResonanceSerial as a way of determining if during
> lookup of resonanced I had created any new ones [the guts of ccpn was
> creating reonances for me during a lookup but of course they were not
> initialised to what I wanted]. However, with the new set based api this
> becomes much less wieldy. Is there any simple way of looking up the
> current maximum resonance serial other than sorting all resonances by
> serial (a slow operation...)
>
> regards
> gary
>
> --
> -------------------------------------------------------------------
> Dr Gary Thompson
> Astbury Centre for Structural Molecular Biology,
> University of Leeds, Astbury Building,
> Leeds, LS2 9JT, West-Yorkshire, UK Tel. +44-113-3433024
> email: [log in to unmask] Fax +44-113-2331407
> -------------------------------------------------------------------
>
|