title: C++ shared_ptr vs. Python object
body: <p>AFAIK, the use of shared_ptr is often discouraged because of potential bugs caused by careless usage of them (unless you have a really good explanation for significant benefit and carefully checked design).</p>
  
  <p>On the other hand, Python objects seem to be essentially shared_ptrs (ref_count and garbage collection).</p>
  
  <p>I am wondering what makes them work nicely in Python but potentially dangerous in C++. In other words, what are the differences between Python and C++ in dealing with shared_ptr that makes their usage discouraged in C++ but not causing similar problems in Python?</p>
  
  <p>I know e.g. Python automatically detects cycles between objects which prevents memory leaks that dangling cyclic shared_ptrs can cause in C++.</p>