[Geany] Detecting symbols
Enrico Tröger
enrico.troeger at xxxxx
Tue May 26 18:14:54 UTC 2009
On Tue, 19 May 2009 23:12:28 +0200, spir wrote:
>Le Tue, 19 May 2009 22:33:07 +0200,
>Enrico Tröger <enrico.troeger at uvena.de> s'exprima ainsi:
>
>> For testing the parser, I mainly used the following code snippet:
>> import os, sys, errno, re, glob, gc, datetime, shutil
>> try: import cPickle
>> except: import pickle as cPickle
>> import Runner, TaskGen, Node, Scripting, Utils, Environment, Task,
>> Logs, Options
>> from Logs import debug, error, info
>> from Constants import *
>>
>> Are there other variants of "import" statements possible? You know,
>> my Python knowledge is very limited :).
>
>Yes, sadly, there's a variant that will complicate a bit your table
>updating:
> from soup import foo as f, bar as b, ...
>renames (in local scope) while importing.
I get "f" and "b" for this one which seems correct to me.
>There are also imports from sub packages (read: sub-dir):
> import foo.bar
This one is ugly, currently it is detected as "foo" and "bar". But
"fixing" this would mean to consider the dot as a valid chacracter for
identifiers. Not sure whether it's worth at all.
> from foo.bar import fish, chips as crisps
This is one is detected as "fish" and "crisps" which is what the code
should do. Is this wrong?
>And recently (python 2.5 I guess) relative imports using leading dot
>(s), in a form similar to *nix filesystems:
> from ..foo import bar
The current code detects this as "bar" which seems correct to me?
Maybe my understanding of the import statements is wrong as I never
really read the docs about it :). But I thought something like
from foo import bar as b
means that I import the class "bar" from the module(i.e. file?) "foo"
and in the following code "bar" can be referred as "b". If so, the
current parsing code is correct.
Regards,
Enrico
--
Get my GPG key from http://www.uvena.de/pub.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/users/attachments/20090526/52b31e8c/attachment.pgp>
More information about the Users
mailing list