On 04/28/2015 05:53 PM, Stefano Forli wrote:

> Modifying what you're iterating is a terrible practice most of the
> times, and punishment is deserved.

C++ iterators are pointers, modifying them is how it works. It's python
that's horrible.

... Nevertheless that's valid Python
> code, and the segmentation fault could a bit too much.

Nope. "for i in (1,2,3) : i = 4" does nothing because i is a copy of a
value on the stack. "for i in (a, b, c) : i.x = 4" will modify i.x just
fine because i is a copy of a pointer to an object on the heap.

It's one of the side-effects of garbage collection they don't tell you
about unless you're a Comp.Sci. student.

If you use a garbage-collected language as front-end to
non-garbage-collected library code, all bets are off.

-- 
Dimitri Maziuk
Programmer/sysadmin
BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to