Most viewed recipes tagged "name"http://code.activestate.com/recipes/tags/name/views/2014-07-02T20:54:01-07:00ActiveState Code RecipesAccessing cursors by field name (Python)
2010-04-09T22:50:04-07:00Ricardo Araozhttp://code.activestate.com/recipes/users/4173628/http://code.activestate.com/recipes/577186-accessing-cursors-by-field-name/
<p style="color: grey">
Python
recipe 577186
by <a href="/recipes/users/4173628/">Ricardo Araoz</a>
(<a href="/recipes/tags/cursor/">cursor</a>, <a href="/recipes/tags/database/">database</a>, <a href="/recipes/tags/datastructures/">datastructures</a>, <a href="/recipes/tags/field/">field</a>, <a href="/recipes/tags/name/">name</a>).
</p>
<p>This class allows you to access the rows of a cursor by field name.</p>
Make unique file name (Python)
2010-04-18T21:07:52-07:00Denis Barmenkovhttp://code.activestate.com/recipes/users/57155/http://code.activestate.com/recipes/577200-make-unique-file-name/
<p style="color: grey">
Python
recipe 577200
by <a href="/recipes/users/57155/">Denis Barmenkov</a>
(<a href="/recipes/tags/file/">file</a>, <a href="/recipes/tags/name/">name</a>, <a href="/recipes/tags/rename/">rename</a>).
Revision 2.
</p>
<p>Sometimes it is important to save data in the file but the file with the specified name already exists. This function creates a file name that is similar to the original by adding a unique numeric suffix. This avoids the renaming of existing files.</p>
Name a lambda (Python)
2014-07-02T20:54:01-07:00David Weilhttp://code.activestate.com/recipes/users/1296670/http://code.activestate.com/recipes/578902-name-a-lambda/
<p style="color: grey">
Python
recipe 578902
by <a href="/recipes/users/1296670/">David Weil</a>
(<a href="/recipes/tags/func_name/">func_name</a>, <a href="/recipes/tags/introspection/">introspection</a>, <a href="/recipes/tags/lambda/">lambda</a>, <a href="/recipes/tags/name/">name</a>, <a href="/recipes/tags/naming/">naming</a>).
</p>
<p>A very simple recipe to allow you <em>easily</em> name lambda-objects (or other kind of objects, callable, for example, partial objects) you create, with little overhead and friendly syntax.</p>
Auto Named Decriptors (Python)
2010-10-19T22:55:16-07:00Aloys Baillethttp://code.activestate.com/recipes/users/4175355/http://code.activestate.com/recipes/577426-auto-named-decriptors/
<p style="color: grey">
Python
recipe 577426
by <a href="/recipes/users/4175355/">Aloys Baillet</a>
(<a href="/recipes/tags/automatically/">automatically</a>, <a href="/recipes/tags/constants/">constants</a>, <a href="/recipes/tags/descriptors/">descriptors</a>, <a href="/recipes/tags/metaclass/">metaclass</a>, <a href="/recipes/tags/name/">name</a>, <a href="/recipes/tags/string/">string</a>).
Revision 3.
</p>
<p>Using named Descriptors? Tired of duplicating the name of the instance in a string? A small metaclass can solve this.</p>
Find a unique name based on prefix + digit in log2(n) + log2(n/2) (Python)
2011-10-31T20:30:54-07:00Garel Alexhttp://code.activestate.com/recipes/users/2757636/http://code.activestate.com/recipes/577934-find-a-unique-name-based-on-prefix-digit-in-log2n-/
<p style="color: grey">
Python
recipe 577934
by <a href="/recipes/users/2757636/">Garel Alex</a>
(<a href="/recipes/tags/name/">name</a>, <a href="/recipes/tags/unique/">unique</a>).
</p>
<p>Find a unique name based on a prefix for a content in a container
(eg. a file in a directory) adding a digit to the name</p>
<p>Does it in log2(n) + log2(n/2) were n is the number of duplicates</p>
<p>This would be used eg. in a CMS giving identifiers based on content title, or when shortening file names on a file system, etc.</p>