question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

use_tabs=True does not work for lists and dictionaries

See original GitHub issue

We use_tabs for indentation but continuation_indent_width still uses spaces instead of tabs for lists and dictionaries that are split over multiple lines. If required there should be a separate knob for this which allows setting of tabs vs spaces for lists and dictionaries

``

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:1
  • Comments:33 (13 by maintainers)

github_iconTop GitHub Comments

3reactions
eskhoolcommented, Feb 12, 2018

@gwelymernans, there are 2 basic school of thoughts (amongst us tabbers=tab users) for continuation alignment

  • Tab only (for both indentation and alignment) In this case whenever continuing on a long line, there will be an additional tab like in the 1st screenshot of @gregwym
  • Tab and space indentation (tab for code indentation and tab+spaces for alignment) In this case the tab indentation used for the primary line is retained and further indentation is done through spaces. This keeps the code aligned regardless of the tab to space display being used on a particular display/IDE and works well for those who use it.

Currently yapf does a very unexpected switchover back to pure spaces for continuation indentation which is probably completely invalid for any tabber.

If yapf has to truly cater to tab users, it will probably have to have a flag for those of us in the 2nd school of mixed indentation

hope I have helped

3reactions
eskhoolcommented, Mar 18, 2017

Thanks for not starting a ‘holy war’ on this 👍 . Ideally, though this may vary even amongst us ‘tabs’ people, I think I would want the continuation indent to be additional to the indent at which the code is at right now. so CONTINUATION_INDENT=1 should result in the code below Eg below

def a():
	really_long_dictionary_name = {
		first_really_long_key: 1,
		second_really_long_key: 2,
	}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Manipulating Lists and Dictionaries in Python - Pluralsight
A dictionary is a mutable, unordered set of key-value pairs where each key must be unique.
Read more >
Storing and updating lists in Python dictionaries: why does this ...
Since, all dictionaries are key-value structures, the question's not very clear. ... In this case, we provide the list function so that a...
Read more >
List vs Dictionary | 10 Difference Between List and ... - FavTutor
Mutability. Lists are mutable in nature. Dictionaries are mutable, but keys do not allow duplicates ; Creation. List object is created using list...
Read more >
How to work with lists and dictionaries in Ansible - Red Hat
Learn how to analyze and use data in lists and dictionaries, a crucial skill for anything you want to do with Ansible.
Read more >
5. Data Structures — Python 3.11.1 documentation
Lists are mutable, and their elements are usually homogeneous and are accessed by iterating over the list. A special problem is the construction...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found