Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"-datetime.timedelt" not completed #6140

Closed
lebigot opened this issue Jul 16, 2014 · 9 comments
Closed

"-datetime.timedelt" not completed #6140

lebigot opened this issue Jul 16, 2014 · 9 comments
Milestone

Comments

@lebigot
Copy link
Contributor

lebigot commented Jul 16, 2014

After the necessary import datetime, completing -datetime.timedelt with TAB does not work. Doing the same with datetime.timedelt works as expected.

Python 2.7.8 (default, Jul 13 2014, 17:11:32)
IPython 2.1.0

@Carreau
Copy link
Member

Carreau commented Jul 22, 2014

Pep8 ! 1-datetime.timedelt<tab> does not work, but 1 - datetime.timedelt<tab> does.
We might try to fix it but it's probably difficult as ot require to make sens of unfinished python code. It is not that obvious to do, as things might be in currently-not-complete-strings-that-are-in-fact-filename so were to split is not obvious.

@Carreau Carreau added this to the wishlist milestone Jul 22, 2014
@takluyver
Copy link
Member

Was this in the notebook, the terminal or the Qt console? Tab completion works different ways in different environments.

@Carreau
Copy link
Member

Carreau commented Jul 22, 2014

I tested on pure ipython shell.

@lebigot
Copy link
Contributor Author

lebigot commented Jul 23, 2014

The problem is present in the terminal.

Note that PEP 8 does not apply here ("If operators with different priorities are used, consider adding whitespace"). Plus, I was not doing 1-datetime… but simply -datetime…. :)

Also, one of the uses of ipython is to perform calculations quickly, so here, I would "use my own judgment" (PEP 8) and would not see any reasons to put spaces around operations, usually (in a terminal—a notebook would be different, since it is for others to read, maybe).

Finally, I'm not sure I get the "might be a filename" parsing argument either: why would 2+date<TAB> complete correctly but not 2-date<TAB>? there is something special and unexpected happening when completing a name preceded by "-".

@Carreau
Copy link
Member

Carreau commented Jul 23, 2014

The pep-8 part was a joke,

And the comment about filename ment that there is probably a reason why it treats - differently. This reason might not be anymore.

Thinking about it a bit more, the only case where I see a tokenization difference for +- are magics that uses arguments. Thus the - might be treated as part of the valid char for a token whereas + is not.

Note that the completer messaging spec has change recently so it might help fixing that at some point. I just wouldn't put too much hope into the fact that this is a simple fix that new to treat - and + equally.

Envoyé de mon iPhone

Le 23 juil. 2014 à 12:24, "Eric O. LEBIGOT (EOL)" notifications@github.com a écrit :

The problem is present in the terminal.

Note that PEP 8 does not apply here ("If operators with different priorities are used, consider adding whitespace").

Also, one of the uses of ipython is to perform calculations quickly, so here, I would "use my own judgment" (PEP 8) and would not see any reasons to put spaces (in a terminal—a notebook would be different, since it is for others to read, maybe).

Finally, I'm not sure I get the "might be a filename" parsing argument either: why would 2+date complete correctly but not "2-date"? there is something special and unexpected happening when completing a name preceded by "-".


Reply to this email directly or view it on GitHub.

@lebigot
Copy link
Contributor Author

lebigot commented Jul 23, 2014

Hmm. Good idea. Now, I never use magic commands with arguments, but I do a lot of subtractions, and not having completion in this case is a real limitation… :)

@takluyver
Copy link
Member

Yes, we explicitly remove - from the list of things readline treats as delimiters, probably so that it's possible to complete things like --foo. Also, I guess dashes are more common in filenames than + signs.

We might be able to improve this when we get to reworking the completions machinery, but that code is pretty thorny.

@Carreau
Copy link
Member

Carreau commented Jan 25, 2017

This will be fixed by #10182

@Carreau Carreau modified the milestones: 6.0, wishlist Feb 3, 2017
@Carreau
Copy link
Member

Carreau commented Feb 3, 2017

closed by #10182

@Carreau Carreau closed this as completed Feb 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants