<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: When to use del - generic question in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/when-to-use-del-generic-question/m-p/431311#M33881</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In my experience I've only &lt;/SPAN&gt;&lt;STRONG&gt;ever&lt;/STRONG&gt;&lt;SPAN&gt; used del to delete a cursor after I was done with it, just to avoid any potential schema locks down the line in the script.&amp;nbsp; If I had to give a hard and fast rule, I would say to delete the cursor when you're done with it - it's better to be safe than sorry and recreate the cursor (say, at the start of a function) every time you need it and then delete it at the end of the function.&amp;nbsp; Otherwise, if I am just writing over a variable I never bother using del because reassignment works just fine.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Apr 2012 14:19:27 GMT</pubDate>
    <dc:creator>RyanForbes1</dc:creator>
    <dc:date>2012-04-20T14:19:27Z</dc:date>
    <item>
      <title>When to use del - generic question</title>
      <link>https://community.esri.com/t5/python-questions/when-to-use-del-generic-question/m-p/431309#M33879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is a generic type question, no specific problem involved.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What is good practice in deciding when to use del in a script? For example, I use it when done with a mapping.MapDocument object, but some of the Help files in the Resource Library seem to use it on variables as well. I don't see the point of that, but not a python expert either. Is there a guide to when you should use it? I looked at the &lt;/SPAN&gt;&lt;A href="http://docs.python.org/reference/simple_stmts.html#the-del-statement"&gt;Python documentation&lt;/A&gt;&lt;SPAN&gt;, but it was kind of obscure to me, especially when the documentation contains statements like &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;"Rather than spelling it out in full details, here are some hints."&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2012 20:30:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/when-to-use-del-generic-question/m-p/431309#M33879</guid>
      <dc:creator>Zeke</dc:creator>
      <dc:date>2012-04-10T20:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: When to use del - generic question</title>
      <link>https://community.esri.com/t5/python-questions/when-to-use-del-generic-question/m-p/431310#M33880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The del command deletes a reference to say a cursor and thus frees up some memory and more importantly releases the resource being used.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Consider a script where you open am updateCursor on a featureclass and thus lock it for others and your script runs for 20+ hours but only needs to update the featureclass and then does nothing with it for the remainder of the script, you have a featurecalss now ties up for 20+ hrs, if you use del and delete the reference to it and unlock it is is available for use then and users don't have to await the script's end.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Stephen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Apr 2012 02:22:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/when-to-use-del-generic-question/m-p/431310#M33880</guid>
      <dc:creator>StephenBarrow</dc:creator>
      <dc:date>2012-04-16T02:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: When to use del - generic question</title>
      <link>https://community.esri.com/t5/python-questions/when-to-use-del-generic-question/m-p/431311#M33881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In my experience I've only &lt;/SPAN&gt;&lt;STRONG&gt;ever&lt;/STRONG&gt;&lt;SPAN&gt; used del to delete a cursor after I was done with it, just to avoid any potential schema locks down the line in the script.&amp;nbsp; If I had to give a hard and fast rule, I would say to delete the cursor when you're done with it - it's better to be safe than sorry and recreate the cursor (say, at the start of a function) every time you need it and then delete it at the end of the function.&amp;nbsp; Otherwise, if I am just writing over a variable I never bother using del because reassignment works just fine.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Apr 2012 14:19:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/when-to-use-del-generic-question/m-p/431311#M33881</guid>
      <dc:creator>RyanForbes1</dc:creator>
      <dc:date>2012-04-20T14:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: When to use del - generic question</title>
      <link>https://community.esri.com/t5/python-questions/when-to-use-del-generic-question/m-p/431312#M33882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you ever find yourself using big arrays you may find you need to delete them to free up memory.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Apr 2012 16:04:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/when-to-use-del-generic-question/m-p/431312#M33882</guid>
      <dc:creator>ChrisBater</dc:creator>
      <dc:date>2012-04-20T16:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: When to use del - generic question</title>
      <link>https://community.esri.com/t5/python-questions/when-to-use-del-generic-question/m-p/431313#M33883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks all.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Apr 2012 17:35:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/when-to-use-del-generic-question/m-p/431313#M33883</guid>
      <dc:creator>Zeke</dc:creator>
      <dc:date>2012-04-20T17:35:11Z</dc:date>
    </item>
  </channel>
</rss>

