collections.UserString can take away a lot of this boilerplate pain from
user defined str subclasses.
On Sun, Dec 18, 2022 at 7:28 PM Steven D'Aprano wrote:
> On Sun, Dec 18, 2022 at 07:38:06PM -0500, David Mertz, Ph.D. wrote:
>
> > However, if you want to allow these types to possibly *do* some
On Sun, Dec 18, 2022 at 8:29 PM Steven D'Aprano wrote:
> > However, if you want to allow these types to possibly *do* something with
> > the strings inside (validate them, canonicalize them, do a security
> check,
> > etc), I think I like the other way:
> > class html(str): pass
> > class css(str
On Mon, 19 Dec 2022 at 12:29, Steven D'Aprano wrote:
> The problem with this is that the builtins are positively hostile to
> subclassing. The issue is demonstrated with this toy example:
>
> class mystr(str):
> def method(self):
> return 1234
>
> s = mystr("hello")
> print(s.method())
On Sun, Dec 18, 2022 at 07:38:06PM -0500, David Mertz, Ph.D. wrote:
> However, if you want to allow these types to possibly *do* something with
> the strings inside (validate them, canonicalize them, do a security check,
> etc), I think I like the other way:
>
> #2
>
> class html(str): pass
> cl
Using a typing approach sounds like a fantastic idea. Moreover, as Stephen
showed, it's easy to make Emacs utilize that, and as I showed, it's easy to
make vim follow that. I've only written one tiny VS Code extension, but it
wouldn't be hard there either. I'm not sure how one adds stuff to PyCh
On Sun, 18 Dec 2022 at 21:42, Christopher Barker
wrote:
> On Sun, Dec 18, 2022 at 9:48 AM David Mertz, Ph.D.
> wrote:
>
>> In general, I find any proposal to change Python "because then my text
>> editor would need to
>> change to accommodate the language" to be unconvincing.
>>
>
> Personally,
On Sun, Dec 18, 2022 at 9:48 AM David Mertz, Ph.D.
wrote:
> In general, I find any proposal to change Python "because then my text
> editor would need to
> change to accommodate the language" to be unconvincing.
>
Personally, I’m skeptical of any proposal to change Python to make it
easier for I
Well, obviously I have to come to the defense of vim as well :-). I'm not
sure what year vim got the capability, but I suspect around as long as
emacs.
This isn't for exactly the same language use case, but finding a quick
example on the internet:
unlet b:current_syntaxsyntax include @srcBash sy
e...@emilstenstrom.se writes:
> Seems simple enough, right? The problem is: There's no syntax
> highlighting in my code editor for the three other languages.
Then you're not using Emacs's mmm-mode, which has been available for a
couple of decades. Now, mmm-mode doesn't solve the whole problem
dn wrote:
> > Is this a problem with Python, or with the tool?
> «
> Language injections
> Last modified: 14 December 2022
> Language injections let you work with pieces of code in other languages
> embedded in your code. When you inject a language (such as HTML, CSS,
> XML, RegExp, and so on) i
10 matches
Mail list logo