<p>Unfortunately (from the point of view of highlighting) with a totally dynamic language like Python you must effectively execute the code to find the type of a name.  And without knowing that any expression based on the name cannot be known.</p>
<p>In your example, <code>example</code>, <code>__init__</code>, and <code>world</code> are declarations, that is syntax that explicitly defines a name and what type it is (<code>example</code> is a class, and <code>__init__</code> and <code>world</code> are functions and the highlighter identifies them as such).</p>
<p>But in <code>e=example()</code> there is no syntax to say <code>e</code> is being declared, it is an assignment expression which would have to be evaluated, or at least type inferred, to decide that <code>e</code> is being declared here, and evaluation and type inference is beyond the pay grade of simple syntax highlighters.</p>
<p>Even <code>example()</code> is no guarantee that it is a class instantiation, since Python is a dynamic language the name can be redefined between the class declaration and the use of <code>example()</code> so as I said evaluation or complex type inference would be needed to see what <code>example</code> is bound to at any point in the code.  And also the type of a name may be different depending on which branch of an <code>if</code> the code takes, eg:</p>
<pre><code>if foo:
   blah=example()
else:
   blah=other()
blah.x
</code></pre>
<p>So what is <code>blah</code> and <code>blah.x</code>, depends on <code>foo</code> and that might be the result of a data read, but at least it involves evaluating the code that sets <code>foo</code>.</p>
<p>AFAICT even IDEs like Eclipse or Python's own Idle don't do any better with highlighting.</p>
<p>Static languages do better with highlighting because all names are declared, and the type of names can't be changed, although it still isn't perfect due to scope issues.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany/issues/2441?email_source=notifications&email_token=AAIOWJ5JIHUOP4SH34PMPKLRDRMCRA5CNFSM4KXAUD6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMFRGLQ#issuecomment-587928366">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAIOWJ3R3TI5XNPJ2EQJ5I3RDRMCRANCNFSM4KXAUD6A">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AAIOWJY2MUGG73LOI2ILYLTRDRMCRA5CNFSM4KXAUD6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMFRGLQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany/issues/2441?email_source=notifications\u0026email_token=AAIOWJ5JIHUOP4SH34PMPKLRDRMCRA5CNFSM4KXAUD6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMFRGLQ#issuecomment-587928366",
"url": "https://github.com/geany/geany/issues/2441?email_source=notifications\u0026email_token=AAIOWJ5JIHUOP4SH34PMPKLRDRMCRA5CNFSM4KXAUD6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMFRGLQ#issuecomment-587928366",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>