[Python-ideas] Re: "Curated" package repo?

2023-07-08 Thread Cameron Simpson
pam sources: good for a single "bad" actor (by my personal criteria) to ignore their (apparent) gaming of the ratings but not good for a swarm of robots. Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To unsu

[Python-ideas] Re: Auto dedent -c arguments.

2023-04-05 Thread Cameron Simpson
On 05Apr2023 10:01, Lucas Wiman wrote: On Tue, Apr 4, 2023 at 7:19 AM Jonathan Crall wrote: Would there be any downside to the Python CLI automatically dedenting the input string given to -c? I can't think of any case off the top of my head where it would make a previously valid program inval

[Python-ideas] Re: timedelta.strptime() and timedelta.strftime()

2023-02-02 Thread Cameron Simpson
f generality. I've used the above for some things. Personally, I _also_ keep my own helpers around, usually for special niche cases (more niche than your suggested `timedelta.strptime`): https://pypi.org/project/cs.dateutils/ https://github.com/cameron-simpson/css/blob/main/lib/python/cs/da

[Python-ideas] Re: Idea: Tagged strings in python

2022-12-23 Thread Cameron Simpson
On 24Dec2022 15:12, Chris Angelico wrote: On Sat, 24 Dec 2022 at 15:00, Cameron Simpson wrote: help(list.index) seems empty. Huh that's strange. I'm checking this in a few recent versions, and they all say "Return first index of value". Ugh. It isn't empty. B

[Python-ideas] Re: Idea: Tagged strings in python

2022-12-23 Thread Cameron Simpson
On 24Dec2022 14:35, Chris Angelico wrote: On Sat, 24 Dec 2022 at 13:15, Cameron Simpson wrote: My question was more: do you know, or do you have to look? I'll take another example. Take the list.index() method, which returns the index where a thing can be found. *Without checking

[Python-ideas] Re: Idea: Tagged strings in python

2022-12-23 Thread Cameron Simpson
On 24Dec2022 09:11, Chris Angelico wrote: On Sat, 24 Dec 2022 at 09:07, Cameron Simpson wrote: On 23Dec2022 22:27, Chris Angelico wrote: >I think this would be a useful feature to have, although it'll >probably end up needing a LOT of information (you can't just say &q

[Python-ideas] Re: Idea: Tagged strings in python

2022-12-23 Thread Cameron Simpson
tly example of naive/incorrect use. Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Messag

[Python-ideas] Re: Idea: Tagged strings in python

2022-12-20 Thread Cameron Simpson
On 21Dec2022 17:00, Steven D'Aprano wrote: On Wed, Dec 21, 2022 at 09:42:51AM +1100, Cameron Simpson wrote: With str subtypes, the case that comes to my mind is mixing str subtypes. [...] So, yes, for many methods I might reasonably expect a new html(str). But I can contrive situations

[Python-ideas] Re: Idea: Tagged strings in python

2022-12-20 Thread Cameron Simpson
ult - because such a string has substructure that seems to warrant careful thought. Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/m

[Python-ideas] Re: Idea: Tagged strings in python

2022-12-20 Thread Cameron Simpson
mple is from KML (Google map markup dialect) where IIRC a "ScreenOverlay" and a "screenoverlay" both existing with different semantics. Ugh. So indeed, I'd probably _want_ .upper to return a plain string and have special methods to do mo

[Python-ideas] Re: Slice 'size' parameter (in the style of pairwise)

2022-06-04 Thread Cameron Simpson
) Indeed. But there's a reason we ty to avoid letting functions acquire many positional parameters. I appreciate that you're illustrating that deliberately. Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.or

[Python-ideas] Re: Heterogeneous numeric data in statistics library

2022-05-12 Thread Cameron Simpson
vert to homogenous" followed by a _fast_ operation than an accept-heterogeneous-but-be-much-slower. Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https

[Python-ideas] Re: CLI convenience?

2022-02-20 Thread Cameron Simpson
without polluting the command line space. That said, it isn't always a bad thing to provide a script. I do it myself. Choosing an name which is (a) expressive and (b) less likely to conflict with other's choices is important though. Cheers, Cameron Simpson

[Python-ideas] Re: Revisiting a frozenset display literal

2022-01-31 Thread Cameron Simpson
On 01Feb2022 09:13, Chris Angelico wrote: >On Tue, 1 Feb 2022 at 09:02, Cameron Simpson wrote: >> On 22Jan2022 01:41, Chris Angelico wrote: >> >On Sat, 22 Jan 2022 at 00:56, Joao S. O. Bueno >> >wrote: >> >> At that point, I argue that despite adding st

[Python-ideas] Re: Revisiting a frozenset display literal

2022-01-31 Thread Cameron Simpson
gexp. I'm _not_ arguing for regexp literals in Python - IMO they're undesirable, a separate argument. (Note: not "undesired", just undesirable: to be avoided except when they're the right solution.) Cheers, Cameron Simpson ___ Pyt

[Python-ideas] Re: "frozen" operator Re: Revisiting a frozenset display literal

2022-01-31 Thread Cameron Simpson
uot; hard to see, but that is just "practice". I'm not inherently in the "but _only strings_ should have prefixes" camp. My remark about the bickering was aimed at unadorned brackets eg the "{{frozen literal set here }}" suggestion. Anyway, this post is jus

[Python-ideas] Re: "frozen" operator Re: Revisiting a frozenset display literal

2022-01-21 Thread Cameron Simpson
ozen components, there's no need for a deep freeze - just a frezze of the relevant aspects. Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mai

[Python-ideas] Re: "frozen" operator Re: Revisiting a frozenset display literal

2022-01-21 Thread Cameron Simpson
On 21Jan2022 20:57, Steven D'Aprano wrote: >On Fri, Jan 21, 2022 at 11:18:27AM +1100, Cameron Simpson wrote: > >> Paired with a __freeze__ dunder method, this applies to any type, not >> just sets. (Where appropriate of course.) >> >> So: >> >>

[Python-ideas] Re: "frozen" operator Re: Revisiting a frozenset display literal

2022-01-21 Thread Cameron Simpson
On 21Jan2022 01:16, MRAB wrote: >On 2022-01-21 00:18, Cameron Simpson wrote: >>This all feels to me like a special case of "wanting a constant for >>bytecode". What is we had a "freeze" operator, eg: >> |foo| [...] >>Paired with a __freeze

[Python-ideas] Re: "frozen" operator Re: Revisiting a frozenset display literal

2022-01-21 Thread Cameron Simpson
On 20Jan2022 19:31, Eric V. Smith wrote: >See also the rejected PEP 351. Ah. So close to my idea as to be indistinguishable. That's a shame. Thanks, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe

[Python-ideas] "frozen" operator Re: Revisiting a frozenset display literal

2022-01-20 Thread Cameron Simpson
nd (b) gateways to freezing many things, starting with the obvious above, via the __freeze__ dunder method. This feels more general and less bikeshedable. My main question is: is the syntax unambiguous? Cheers, Cameron Simpson ___ Python-ideas mailing list -

[Python-ideas] Re: mimetypes.guess_type should not return deprecated mimetype application/x-javascript

2022-01-18 Thread Cameron Simpson
ss_extension and guess_all_extensions functions. Indeed. +1 That would allow applying policy beyond the mime.types file ordering. Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to pyt

[Python-ideas] Re: mimetypes.guess_type should not return deprecated mimetype application/x-javascript

2022-01-18 Thread Cameron Simpson
regexp instead of the config file ordering. Insanity abounded with regexp wackiness purely to make some rules longer than others. Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-

[Python-ideas] Re: Shouldn't 'input' prompt be going to stderr?

2022-01-16 Thread Cameron Simpson
this, here: https://discuss.python.org/t/builtin-function-input-writes-its-prompt-to-sys-stderr-and-not-to-sys-stdout/12955 Have a read. Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email

[Python-ideas] Re: easier writing to multiple streams

2021-11-26 Thread Cameron Simpson
ore generally: writing a log to both >a local and a remote location. This sounds to me lke you want a logger setup with multiple handlers. Add a handler to log to your cloud log file in addition to the normal log file. Then you'd just use ordinary logging calls

[Python-ideas] Re: easier writing to multiple streams

2021-11-25 Thread Cameron Simpson
the stdlib. You mentioned logging. Doesn't just adding a second root logger (or handler) get you what you'd want there? They accumulate, and messages go to all lthe loggers. BTW, can you elaborate on when you find yourself wanting to write the same mes

[Python-ideas] Re: Fwd: Simple curl/wget-like download functionality in urllib (like http offers server)

2021-10-18 Thread Cameron Simpson
uests.get(url) with open("filename","wb") as f: for chunk in rsp.iter_content(): f.write(chunk) Now, if you find yourself doing that _specific_ variation often, write yourself a function to do it and keep it in a module of your own. Cheers, Cameron Simpson __

[Python-ideas] Re: os.workdir() context manager

2021-09-14 Thread Cameron Simpson
). Agreed here. As long as it has a big clear warning about process global state. That is the beauty of libraries, to me: not just reuse, but a correct implementation is correct everywhere, and likewise a bugfix fixes all the things. Cheers, Cameron Simpson ___

[Python-ideas] Re: os.workdir() context manager

2021-09-14 Thread Cameron Simpson
On 15Sep2021 07:50, Chris Angelico wrote: >On Wed, Sep 15, 2021 at 7:43 AM Cameron Simpson wrote: >> I know I'm atypical, but I have quite a lot of multithreaded stuff, >> including command line code. So while it'd be ok to avoid this context >> manager for my o

[Python-ideas] Re: os.workdir() context manager

2021-09-14 Thread Cameron Simpson
his example. All that said, I wrote pretty much exactly what you describe just the other week for umask(). Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Re: NAN handling in statistics functions

2021-08-29 Thread Cameron Simpson
or finding a value in an ordered sequence. Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Mess

[Python-ideas] Re: We should have an explicit concept of emptiness for collections

2021-08-24 Thread Cameron Simpson
d like to be able to probe for the presence of queued items via the emptiness idiom. But I can't. It does has a .empty() method. I don't even know what my point is here :-( But I am definitely -1 on weaking the bool(container) idiom as a test for empty/nonempty, and also for asking every

[Python-ideas] Re: Stack-scoped variables

2021-08-18 Thread Cameron Simpson
you are after. If this isn't what you want, can you describe what's different? Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.

[Python-ideas] Re: slices syntactic sugar

2021-08-17 Thread Cameron Simpson
n values" objects, which could be used in expressions like this: attr[12:15] Unfortunately that looks to my eye like "get me these elements" rather than a test, but in the right context (your queries) it might be intuitive. Cheers, Cameron Simpson ___

[Python-ideas] Re: slices syntactic sugar

2021-08-17 Thread Cameron Simpson
take(n) call accepts an Ellipsis to mean "everything to the end of input". I know Python file.read() without a parameter also means that, but the idiom of my module uses take(n) to obtain exactly n bytes, so the Ellipsis is a good fit. Of course ex

[Python-ideas] Re: Create a @deprecated decorator (annotation)

2021-08-15 Thread Cameron Simpson
t;Why would it be "interesting"? I don't see any practical advantage, >and as soon as you need any form of logic you have to rewrite, so why >bother? That's the case for any presupplied convenience. But it covers off a lot of the common cas

[Python-ideas] Re: Define functions without parentheses (if no parameters given)

2021-06-10 Thread Cameron Simpson
27;t take parameters >such as a home page or a contact page. Ah, good example. Thanks, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.or

[Python-ideas] Re: Define functions without parentheses (if no parameters given)

2021-06-10 Thread Cameron Simpson
On 11Jun2021 10:01, Cameron Simpson wrote: >So your idea does not suck. But it may not motivate anyone to implement >it, or even to agreed that it should be implemented. It also struck me: functions with _no_ parameters are pretty rare. I had a glance through my own code and aside fro

[Python-ideas] Re: Define functions without parentheses (if no parameters given)

2021-06-10 Thread Cameron Simpson
ft cited view that "not everything needs its own function", usually applied to advocating for small one/few line functions to be added to the standard library. So your idea does not suck. But it may not motivate anyone to implement it, or even to agr

[Python-ideas] Re: Support more conversions in format string

2021-05-05 Thread Cameron Simpson
ask :-( Oh, you did :-) Anyway, I may be shifting sideways per my recent ":foo" post, using a new class which is a magic view of the TagSet and a Formatter subclass which parses the field_names itself (thus grabbing the dotted identifier). Still a work in progress. Cheers, Cam

[Python-ideas] Re: Support more conversions in format string

2021-05-05 Thread Cameron Simpson
On 25Apr2021 10:54, Cameron Simpson wrote: >On 24Apr2021 22:35, Stephen J. Turnbull >wrote: >[...] >> > My use case is presupplied strings, eg a command line supplied >> > format string. >> >>In that case the format string is user input, and x is a vari

[Python-ideas] Re: Adding str.remove()

2021-05-01 Thread Cameron Simpson
st I haven't done it in some standard "my_utils" module >I always import. Nonetheless, a string method would feel even more natural >than a function taking the string as an argument. A method is almost always "easier/natural", but how many do we really want? If

[Python-ideas] Re: Support more conversions in format string

2021-04-24 Thread Cameron Simpson
ing used in the format string. See my adjacent much longer post. Maybe I'm trying to say that "!foo" would benefit similar extensibilty as ":foo" already has. The former is for presenting arbitrary values, and the latter is for presenting particular types of va

[Python-ideas] Re: Support more conversions in format string

2021-04-24 Thread Cameron Simpson
On 24Apr2021 22:35, Stephen J. Turnbull wrote: >Cameron Simpson writes: > > On 23Apr2021 18:25, Stephen J. Turnbull > > wrote: > > >I don't understand how this is supposed to work. It looks to me > > >like !code is a preprocessor: [...] > >

[Python-ideas] Re: Support more conversions in format string

2021-04-23 Thread Cameron Simpson
On 23Apr2021 18:25, Stephen J. Turnbull wrote: >Cameron Simpson writes: > > I would _frequently_ like to be able to provide custom > > conversions. At present I'm using elaborate hacks based on > > __getattr__ etc to recognise things like this: > > >

[Python-ideas] Re: Support more conversions in format string

2021-04-21 Thread Cameron Simpson
ustom conversions would let me use this: '{x} is {x!lc} in lowercase' just by registering 'lc' as a conversion from my code. Chaining then per Serhiy's other suggestion would bring a fair amount of power. Cheers, Cameron Simpson

[Python-ideas] Re: shouldn't slices be iterable ?

2021-03-18 Thread Cameron Simpson
I whinged: >> On Fri, Mar 19, 2021 at 10:46 AM Cameron Simpson wrote: >> > I know that range(start,end,stride) will produce what I'd want from >> > iter(slice(start,end,stride)), but wouldn't it be reasonable for a slice >> > itself to be iterable? [.

[Python-ideas] shouldn't slices be iterable ?

2021-03-18 Thread Cameron Simpson
dex, slice): for i in index: ... do stuff with i ... is the obvious thing to do. Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.

[Python-ideas] Re: Adding `open_text()` builtin function. (relating to PEP 597)

2021-01-23 Thread Cameron Simpson
ate easy writing by various systems. I do not consider the BOM dead, and it is so cheap to recognise that not bothering to do so seems almost mean sprited. Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To un

[Python-ideas] Re: pathlib.Path.makedirs

2021-01-18 Thread Cameron Simpson
used a directory belonging to something else. I would far rather such reuse required a little thought on my part, by requiring specific calling out that exists_ok=True. Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.o

[Python-ideas] Re: An option to force the path separator for the "os.path.join()" method.

2021-01-05 Thread Cameron Simpson
ls antithetical to me. I was going to suggest: https://docs.python.org/3/library/urllib.parse.html#module-urllib.parse since your use case is URLs, but it doesn't really parse the "path" part. Cheers, Cameron Simpson ___ Python-ideas

[Python-ideas] Re: An option to force the path separator for the "os.path.join()" method.

2021-01-05 Thread Cameron Simpson
tever separators it likes. However, HTML relative URLs rely on '/' as a separator to resolve correctly. You can't change that without breaking the text web because relative URLs are resolved by browsers, not servers. Cheers, Cameron Simpson __

[Python-ideas] Re: Standard tool for iterating over recursive data structures?

2021-01-01 Thread Cameron Simpson
o.idkey()) def recurse(o, blah..., *, seen, other_kwargs...): for some nondefault decoration. There are some missing features there: what to return when recusion is encoutered (rather than None above), some mode to make the occurrence of recursion trivially noticeable by the primary

[Python-ideas] Re: fsync-on-close io object

2020-12-24 Thread Cameron Simpson
anager. Aye. Fully agree here, and frankly think this is a "write your own" situation. Except, of course, that like all "write your own" one/few liners there will be suboptimal or buggy ones released. Such as the "overly wide sync" from your os.sync() above. Personally

[Python-ideas] Re: built in to clear terminal

2020-12-20 Thread Cameron Simpson
On 20Dec2020 15:48, Christopher Barker wrote: >On Sun, Dec 20, 2020 at 1:23 PM Cameron Simpson wrote: >> My anger at programmes which gratuitously clear the screen is large. > >There are a LOT of bad things one can do with Python, I don't think we need >to make something d

[Python-ideas] Re: built in to clear terminal

2020-12-20 Thread Cameron Simpson
he programme which it is talking to? >is it so bad to use a subprocess? Yes. It is _really slow_, depends on external reaources which might not be there, and subprocess brings other burdens too. Python comes with curses and that knows directly how to do this. Cheers, Cameron Simpson

[Python-ideas] Re: Making the for statement work better with nested functions

2020-11-29 Thread Cameron Simpson
on right now and does not mean that. So some indication of the special meaning would be required. Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mai

[Python-ideas] Re: Making the for statement work better with nested functions

2020-11-27 Thread Cameron Simpson
On 27Nov2020 21:13, Steven D'Aprano wrote: >On Fri, Nov 27, 2020 at 08:32:04AM +1100, Cameron Simpson wrote: >> On 27Nov2020 00:25, Steven D'Aprano wrote: >> >Block scoping allows shadowing within a function. >> >> Just to this: it needn't. > >Y

[Python-ideas] Re: Making the for statement work better with nested functions

2020-11-26 Thread Cameron Simpson
.. The nearest Python equivalent is: i = blah() ... use i del i which feels fragile - accidental assignment to "i" later is not forbidden. Of course, in C variables must be declared. Not so easy with Python, syntacticly. Cheers, Cameron Simpson

[Python-ideas] Re: Making the for statement work better with nested functions

2020-11-26 Thread Cameron Simpson
... also x and y cannot shadow existing names ... I wouldn't want to let any "as" support a "new", but the one on "with" introduces a suite which nicely delineates a block. Cheers, Cameron Simpson ___ Python-ideas

[Python-ideas] Re: Adding PyInstaller to the standard library

2020-11-21 Thread Cameron Simpson
On 22Nov2020 13:22, Steven D'Aprano wrote: >On Sun, Nov 22, 2020 at 12:56:01PM +1100, Cameron Simpson wrote: >> On 21Nov2020 17:54, Chris Angelico wrote: >> >The range of people who (a) cannot install from PyPI and can only use >> >the stdlib, and (b) cannot deplo

[Python-ideas] Re: Adding PyInstaller to the standard library

2020-11-21 Thread Cameron Simpson
ries (needed PyQt) They're end users; some are (variously) technical and some aren't, but none should need to be technical. I want them to copy an app to a new machine and be happy - drag'n'drop a single thing. Cheers, Cameron Simpson

[Python-ideas] Re: Adding PyInstaller to the standard library

2020-11-19 Thread Cameron Simpson
robust way to ship something which Just Works. It may not be necessary in you environment or use cases, but in the very common case where you want users to just use something without installing a development environment to support it, it is the go. Cheers, Cameron Simpson ___

[Python-ideas] Re: Adding PyInstaller to the standard library

2020-11-19 Thread Cameron Simpson
ode and/or python version) are often a fair price to pay to "just give it to someone" and have it work. If it needs an update or bugfix I can just give them a newer one. BTW, py2app also has a "dev mode", a bit like pip's -e option, to use the

[Python-ideas] Re: TextIOWrapper support for null-terminated lines

2020-10-25 Thread Cameron Simpson
On 26Oct2020 09:45, Chris Angelico wrote: >On Mon, Oct 26, 2020 at 8:44 AM Cameron Simpson wrote: >> On 24Oct2020 13:37, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: >> >Spaces in filenames are just as bad, and much more common: >> >> But much easi

[Python-ideas] Re: TextIOWrapper support for null-terminated lines

2020-10-25 Thread Cameron Simpson
have newlines in a filename(yuck) ... > >Spaces in filenames are just as bad, and much more common: But much easier to handle in simple text listings, which are newline delimited. You're really running into a horrible behaviour from xargs, which is one reason why GN

[Python-ideas] annotating PEP mentions (was: Naming Accepted PEPs as PAPs)

2020-09-21 Thread Cameron Simpson
a bit opaque. Since I use mutt it might be tractable for me to modify the display_filter I use to perform this edit. It'd need a small backing store to avoid having to do an HTTP callout on each reference, but I have one of those... Cheers, Cameron Simpson ___

[Python-ideas] Re: Curious : Why staticmethod if classmethods can do everything a static method can?

2020-09-11 Thread Cameron Simpson
Dan, I should preface this by saying I don't substantially disagree with you, I just work differently and want to show how and why. On 11Sep2020 21:24, Dan Sommers <2qdxy4rzwzuui...@potatochowder.com> wrote: >On 2020-09-12 at 09:57:10 +1000, >Cameron Simpson wrote

[Python-ideas] Re: Curious : Why staticmethod if classmethods can do everything a static method can?

2020-09-11 Thread Cameron Simpson
't understand what you mean by "additionally is not limited by inheritance"? Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.pytho

[Python-ideas] Re: A shortcut to load a JSON file into a dict : json.loadf

2020-09-11 Thread Cameron Simpson
import them from your personal little module-of-three-line-functions. No need to publish to PyPI (extra work) - it's as easy to keep them locally unless you need them elsewhere. But don't rewrite - reuse! Cheers, Cameron Simpson ___ Pyth

[Python-ideas] Re: Function composition

2020-05-24 Thread Cameron Simpson
cut, also grep, also uniq... everything I used in the example). People forget that redirections may appear anywhere rather than just at the end of the command: output But I take your point on incremental build-the-pipeline, I do that a lot. Cheers, Cameron Simpson

[Python-ideas] Re: len(path) == len(str(path))

2020-05-24 Thread Cameron Simpson
different to that measured by a numeric index. I think this makes me -1 on the proposal, also because str(Path) is so easy to do. Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to pytho

[Python-ideas] Re: How to propose a change with tests where the failing test case (current behaviour) is bad or dangerous

2020-05-21 Thread Cameron Simpson
ndary objective is to do it without zip exploding in the tester's face. The process here is: - bug exists (exploding zip) - write a test that fails when the bug exists - fix the bug - the test should now pass Step 2 eats an unbounded amount of disc (in this case, other bugs can go bad o

[Python-ideas] Re: str.strip: argument maxstrip

2020-05-19 Thread Cameron Simpson
ing the Python 3.9 suggestion, what about: salt2 = salt.cutsuffix(('==', '=')) I appreciate this isn't as _general_ as a maxstrip param, but it seems to neatly address the single use case you've found. Cheers, Cameron Simpson ___

[Python-ideas] Re: Making asserts non-recoverable.

2020-05-13 Thread Cameron Simpson
mplete lack of consistency with every other exception type, seems very artificial. You'lll just push the devs from misusing asserts to misusing something else. _Are_ your devs catching AssertionError and preventing programme termination? Cheers, Cameron Simpson

[Python-ideas] Re: General methods

2020-05-08 Thread Cameron Simpson
iment which motivates the proposal. Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archiv

[Python-ideas] Re: returning a namedtuple on dict.items()

2020-03-31 Thread Cameron Simpson
attribute names. I'm sure there must be other modules with similar facilities as well. Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://

[Python-ideas] Re: About python3 on windows

2020-03-26 Thread Cameron Simpson
table name when installing Python 3 on Windows, and to my eye that is/was a _bad_ choice. I would like to see a good explaination as to why that choice was made. Choosing Python 3 specificly is an important choice for many scripts because 2->3 was a breaking change. Cheers, Cameron Simpson

[Python-ideas] Re: Syntax for loop invariants

2020-03-22 Thread Cameron Simpson
ame out of your library for checking before and after the suite. The closure gets you the locals/globals directly without cumbersomeness. Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an emai

[Python-ideas] Re: New explicit methods to trim strings

2020-03-07 Thread Cameron Simpson
On 07Mar2020 17:51, Christopher Barker wrote: On Sat, Mar 7, 2020 at 4:36 PM Cameron Simpson wrote: >Go's Trim strips multiple characters, but, as far as I can tell from >the docs, TrimPrefix and TrimSuffix strip a single prefix/suffix >string. And right there is the confus

[Python-ideas] Re: New explicit methods to trim strings

2020-03-07 Thread Cameron Simpson
On 08Mar2020 00:17, MRAB wrote: On 2020-03-07 23:01, Cameron Simpson wrote: I'm somewhat against "strip" in the name, because Python's plain "strip" methods act like PHP and Go trim methods: they strip multiple characters, not fixed strings. My own preference

[Python-ideas] prefix/suffix for bytes (was: New explicit methods to trim strings)

2020-03-07 Thread Cameron Simpson
ar smoother with these, as Mercurial had a lot of filenames-as-bytes-strings inside. Here we are: https://gregoryszorc.com/blog/2020/01/13/mercurial%27s-journey-to-and-reflections-on-python-3/ Personally I lean the other way, and welcomed the initial lack of stringish methods as a good way to uncove

[Python-ideas] Re: New explicit methods to trim strings

2020-03-07 Thread Cameron Simpson
d strings. My own preference (and personal library use) is cutprefix and cutsuffix. Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mai

[Python-ideas] Re: New explicit methods to trim strings

2020-03-07 Thread Cameron Simpson
c.def' >>> cutsuffix(abc_def, '.def') 'abc' >>> cutsuffix(abc_def, '.zzz') 'abc.def' >>> cutsuffix(abc_def, '.zzz') is abc_def True

[Python-ideas] Re: New explicit methods to trim strings

2020-03-04 Thread Cameron Simpson
e if anyone wants to use them. Their signature is: prefix = cutsuffix(original_string, suffix) if prefix is original_string: # suffix not present ... else: # suffix present, proceed using prefix and the converse for cutprefix. Cheers, Cameron Simpson ___

[Python-ideas] Re: PyPI should include PEP 440-compliant version strings for including in install_requires

2020-02-10 Thread Cameron Simpson
. I'm with Chris here. Install without versions unless you've s specific requirement such as a feature to use or a bug/misfeature to avoid. I look on pinning as a tool for reproducability; if I've tested against my venv happily, my build/install should us

[Python-ideas] Re: Improved Function Decorators

2019-11-18 Thread Cameron Simpson
Of course, you could legitamtely argue that the above should be part of the protocol which @ implements, and that any sufficiently flexible decorator should expect a **kw. I'd support that. Again, no new syntax required, just better behaviour! Cheers, Cameron Simpson __

[Python-ideas] Re: Extending @ syntax to allow expressions

2019-10-21 Thread Cameron Simpson
On 21Oct2019 20:41, Andrew Barnert wrote: On Oct 21, 2019, at 19:53, Cameron Simpson wrote: On 21Oct2019 17:18, Yonatan Zunger wrote: I came across a case which *might* be a use case for a syntax extension, but I'm not sure. Wanted to get feedback from the group. *The extension: *E

[Python-ideas] Re: Extending @ syntax to allow expressions

2019-10-21 Thread Cameron Simpson
;default for an otherwise unspecified environment" decoration. No new syntax needed. And it reads nicely, at least to my eye. You will probably run into some resistance if there's no case for your syntax which can't be addressed with the nested deco

[Python-ideas] Re: Allow kwargs in __{get|set|del|}item__

2019-10-07 Thread Cameron Simpson
On 08Oct2019 09:19, Cameron Simpson wrote: Chris pointed out to me recently that tuples don't need commas, Cough, "brackets", cough. the commas alone suffice. You see brackets _around_ tuples a lot because of precedence. Reviewing my mail folder, it was actually Stev

[Python-ideas] Re: Allow kwargs in __{get|set|del|}item__

2019-10-07 Thread Cameron Simpson
On 08Oct2019 09:19, Cameron Simpson wrote: On 07Oct2019 10:56, Joao S. O. Bueno wrote: So, in short, your idea is to allow "=" signs inside `[]` get notation to be translated to dicts on the call, Subjectively that seems like a tiny tiny win. I'm quite -1 on this idea; lang

[Python-ideas] Re: Allow kwargs in __{get|set|del|}item__

2019-10-07 Thread Cameron Simpson
ferent result. Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail

[Python-ideas] Re: Python including packages

2019-07-09 Thread Cameron Simpson
d to install something important. Perhaps I'm using a feature I didn't really plan to install. Cheers, Cameron Simpson ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@

Re: [Python-ideas] [Python-Dev] Overloading comparison operator for lists

2019-05-26 Thread Cameron Simpson
be part of the MRO of a subclass). Cheers, Cameron Simpson ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] easier lazy logging in stdlib ?

2019-05-15 Thread Cameron Simpson
stuff (isEnabledFor, getEffectiveLevel) don't suffice. Disclaimer: my logging fu is a bit weak; I've got a wrapper module for it largely to avoid thinking about it, just providing a simple call layer to the root logger :-) Cheers, Cameron Simpson __

Re: [Python-ideas] More alternate constructors for builtin type

2019-05-07 Thread Cameron Simpson
instead, to support an arbitrary fill pattern/sequence. That avoids slowing the common case and provides flexibility at the same time. Cheers, Cameron Simpson ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/p

Re: [Python-ideas] More alternate constructors for builtin type

2019-05-06 Thread Cameron Simpson
yes, PyPI notwithstanding: finding a specific module in there can be haphazard) and (d) the bytes type is a natural place to have these constructors/factories. All these arguments apply to the other types too. Cheers, Cameron Simpson ___ Python-id

Re: [Python-ideas] Exception for developer errors?

2019-04-10 Thread Cameron Simpson
tion implementor, have screwed up right here instead of in the larger programme. Cheers, Cameron Simpson ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Sorted lists

2019-04-07 Thread Cameron Simpson
ply out-of-order, just that we need to check when sortedness is required. Cheers, Cameron Simpson ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/

Re: [Python-ideas] Sorted lists

2019-04-07 Thread Cameron Simpson
issorted__ flag? I'm thinking yes since the flag is intended to mean known-to-be-sorted. Cheers, Cameron Simpson * I _know_ subclassing builtins is discouraged, but it is supported and can be done if one is conservative. ___ Python-ideas maili

  1   2   >