> Spyder shouldn't dictate how your code should look. It is better to separate the IDE functionality itself from other needs the users could have.
I agree, that's why I think it should be optional, e.g. by using plugins like yours, or black. In fact, I just discovered that Spyder already has such functionality: on rightclick, you can format your selection with autopep8, but this doesn't format the lists to be less than 79 characters wide. In any case, I think that something like this, or your plugin, or a black plugin that works on sections or just the selected code would be a great feature for Spyder. I mean, producing legible, PEP-conform Python scripts is part of Spyder's mission, no? On Wednesday, 7 April 2021 at 18:41:36 UTC+2 [email protected] wrote: > 2021-04-07 10:24 GMT+02:00, Moritz Lürig <[email protected]>: > > TL;DR can we have hard wrapping of lists to a specific length in the > > editor? > > > > I am often working with lists that are longer than 79 characters, e.g. > > column names of wide pandas dataframes, which I sometimes need to > hardcode > > in the script for reproducibility. I do this by printing the lists in the > > console, and then copying them back to the editor. however, in the > console > > they wrap after each item, so that they take a lot of space vertically. I > > then have to copy them to another editor (e.g. notepad++), remove all > > linebreaks, an then manually wrap them by adding line breaks. this is > > tedious, and I was wondering whether we could have this functionality in > > Spyder to make our scripts more readible, and adhere PEP formatting > > suggestions? > > You could use black or yapf or.... to format your files. Spyder > shouldn't dictate how your code should look. It is better to separate > the IDE functionality itself from other needs the users could have. > > I've made a spyder plugin to integrate black within Spyder but it was > for Spyder 3.x [1]. It shouldn't be difficult to update it to be > compatible to Spyder 5.x but I don't think I could find time in the > short term to learn the new plugin infrastructure in Spyder 5.x. > > [1] https://github.com/kikocorreoso/spyder-black-formatter > > > > > references: > > > https://superuser.com/questions/1088622/notepad-split-line-after-given-number-of-characters > > > https://stackoverflow.com/questions/4248726/how-can-i-insert-a-carriage-return-linefeed-every-x-characters-with-notepad > > > > > > -- > > You received this message because you are subscribed to the Google Groups > > "spyder" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to [email protected]. > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/spyderlib/6d63e894-72f9-42be-9305-e799f4e111ffn%40googlegroups.com > . > > > -- You received this message because you are subscribed to the Google Groups "spyder" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/spyderlib/f4286985-9c37-4aa3-8569-20938ca18cfen%40googlegroups.com.
