<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>sebthom.de &#187; pydev</title>
	<atom:link href="http://sebthom.de/tag/pydev/feed/" rel="self" type="application/rss+xml" />
	<link>http://sebthom.de</link>
	<description>Selbständiger IT Berater - Java, J2EE, WebSphere Portal, Lotus Domino</description>
	<lastBuildDate>Sun, 20 May 2012 22:59:38 +0000</lastBuildDate>
	<language>de</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Leveraging PyDev&#8217;s auto completion for indirectly created objects</title>
		<link>http://sebthom.de/140-leveraging-pydevs-auto-completion-indirectly-created-objects/lang/de/</link>
		<comments>http://sebthom.de/140-leveraging-pydevs-auto-completion-indirectly-created-objects/lang/de/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 23:29:00 +0000</pubDate>
		<dc:creator>Sebastian Thomschke</dc:creator>
				<category><![CDATA[Jython]]></category>
		<category><![CDATA[pydev]]></category>
		<category><![CDATA[pydoc]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[rtype]]></category>

		<guid isPermaLink="false">http://sebthom.de/?p=140</guid>
		<description><![CDATA[     <link rel="alternate" type="application/atom+xml" title="sebthom.de Category: Jython" href="http://sebthom.de/category/it/development/jython/lang/de/feed/" />
This is just a quick tip how to enable auto completion in PyDev for indirectly created objects. By default, PyDev has no problems in presenting you the possible object attributes and methods on a variable if that variable gets a new object instance assigned directly in the code. For example, when you first type &#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a quick tip how to enable auto completion in <a href="http://pydev.org">PyDev</a> for indirectly created objects. </p>
<p>By default, PyDev has no problems in presenting you the possible object attributes and methods on a variable if that variable gets a new object instance assigned directly in the code. </p>
<p>For example, when you first type &#8230;</p>
<pre name="code" class="python">mybook = Book()</pre>
<p>&#8230; and in the next line you enter &#8230;</p>
<pre name="code" class="python">mybook.</pre>
<p>&#8230; PyDev will dutifully present you the statically declared features for the Book class in a popup.</p>
<p>If you however get that Book instance as the result of another method, e.g. &#8230;</p>
<pre name="code" class="python">mybook = bookstore.findBook("foobar")</pre>
<p>&#8230; PyDev currently seems to be helpless. </p>
<p>Because of Python&#8217;s dynamic nature it is of course a bit harder for an IDE to figure out what kind of objects may a method. But PyDev could for example honor the @return / @rtype <a href="http://epydoc.sourceforge.net/manual-epytext.html">PyDoc</a> annotations (which you can add to the findBook&#8217;s method declaration) but currently it just does not.</p>
<p>To still have autocompletion you have two options:</p>
<ol>
<li> Temporarily instantiate a Book object in the code.
<pre name="code" class="python">
mybook = Book()
mybook = bookstore.findBook("foobar")
mybook. #--> now you have auto completion
</pre>
<p>This has the drawback, that if you forget to remove the first line before you finish coding an unneccessary Book instance will be created on every execution during runtime.</p>
<li> Use an assertion to ensure that the mybook variable contains an object of type Book
<pre name="code" class="python">
mybook = bookstore.findBook("foobar")
assert isinstance(mybook, Book)
mybook. #--> now you have auto completion
</pre>
</ol>
 <img src="http://sebthom.de/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=140" width="1" height="1" style="display: none;" /><hr />
<p><small>&copy; sebthom for <a href="http://sebthom.de">sebthom.de</a>, 2010. |
<a href="http://sebthom.de/140-leveraging-pydevs-auto-completion-indirectly-created-objects/lang/de/">Permalink</a> |
<a href="http://sebthom.de/140-leveraging-pydevs-auto-completion-indirectly-created-objects/lang/de/#comments">3 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://sebthom.de/140-leveraging-pydevs-auto-completion-indirectly-created-objects/lang/de/&amp;title=Leveraging PyDev&#8217;s auto completion for indirectly created objects">del.icio.us</a>
<br/>
Post tags: <a href="http://sebthom.de/tag/jython/" rel="nofollow tag">Jython</a>, <a href="http://sebthom.de/tag/pydev/" rel="nofollow tag">pydev</a>, <a href="http://sebthom.de/tag/pydoc/" rel="nofollow tag">pydoc</a>, <a href="http://sebthom.de/tag/python/" rel="nofollow tag">python</a>, <a href="http://sebthom.de/tag/rtype/" rel="nofollow tag">rtype</a><br/>
</small></p>
<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://sebthom.de/140-leveraging-pydevs-auto-completion-indirectly-created-objects/feed/lang/de/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

