larray-project / larray-editor

Graphical User Interface for LArray
GNU General Public License v3.0
2 stars 2 forks source link

debugger #198

Closed gdementen closed 4 years ago

gdementen commented 4 years ago

resurrect PR I accidentally closed before merging.

I wonder if the removal of "from larray import " should be mentioned in the changelog. I guess our current users will not notice since they do "from larray import " in their code anyway but... What do you think?

alixdamman commented 4 years ago

What would happen if a user types view(<session object>) ? Is the larray library loaded with the session object?

gdementen commented 4 years ago

What would happen if a user types view(<session object>) ? Is the larray library loaded with the session object?

No. In that case, the top-level larray functions are not loaded automatically. I don't know whether users use that idiom though.

I could change that in that case if you think it's worth it...

alixdamman commented 4 years ago

I don't know whether users use that idiom though.

I do but it's maybe only me.

I could change that in that case if you think it's worth it...

You removed that automatic call to from larray import * for performance reason I guess. Let's try and see if users complain (except me ;) )

gdementen commented 4 years ago

You removed that automatic call to from larray import * for performance reason I guess.

No, it has nothing to do with performance (at least currently because larray is a dependency of the editor and is loaded anyway before we hit the console). It is just that it is more correct that way for view()/debug()/edit(). For example, when using any of those functions in the middle of code which does not use "from larray import *" (or which do not use larray at all for that matter), this is annoying because it:

  1. overrides user variables/functions (or functions from other libs loaded with from x import y) with larray functions causing weird and very hard to diagnose problems. The most usual case I get bitten by is that I have a variable x which is overridden by larray's deprecated "axis reference factory".

  2. makes dir() or top-level functions tab completion very long and annoying even if the code being inspected/debugged was done cleanly with few functions.

Let's try and see if users complain (except me ;) )

No, I think that's more convenient to still do it for Session objects. I just overlooked that case. Thanks for mentioning this. I will remove that commit from the PR and open an issue to properly handle that later.