[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: 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: 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: 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: 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: 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: 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: 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] 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: 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] 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: 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-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-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: 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-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: 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: 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: 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
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: 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: 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: 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: 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: 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: 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: 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: 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
). 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: 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: 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: 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: 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: 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: 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] "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: "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] 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 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
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-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: 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: 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

Re: [Python-ideas] Executable space protection: NX bit,

2018-09-03 Thread Cameron Simpson
ints, strs, dicts and lists. And floats. None of those is executable. 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] Executable space protection: NX bit,

2018-09-03 Thread Cameron Simpson
On 03Sep2018 22:32, Wes Turner wrote: On Monday, September 3, 2018, Cameron Simpson wrote: On 03Sep2018 20:58, Wes Turner wrote: So, if an application accepts user-supplied input (such as a JSON payload), is that data marked as non-executable? Unless you've hacked the JSON decod

Re: [Python-ideas] Executable space protection: NX bit,

2018-09-03 Thread Cameron Simpson
On 04Sep2018 13:26, Cameron Simpson wrote: On 03Sep2018 22:32, Wes Turner wrote: Can another process or exploitable C extension JMP to that data or no? See Stephan Houben's reply to your post: heap and stack on modern OSes are normally NX mode already, and CPython objects live on the

Re: [Python-ideas] Positional-only parameters

2018-09-06 Thread Cameron Simpson
nctions whose purpose is to import such spreadsheet exports, making namedtuple subclasses automatically from the column headers. In many of these situations I've had recently positional-only arguments would have been very helpful. I even had to bugfix a function recently where a pos

Re: [Python-ideas] Moving to another forum system where moderation is possible

2018-09-20 Thread Cameron Simpson
heers, 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] Moving to another forum system where moderation is possible

2018-09-20 Thread Cameron Simpson
On 20Sep2018 20:55, Mikhail V wrote: On Thu, Sep 20, 2018 at 11:21 AM Cameron Simpson wrote: On 20Sep2018 10:16, Chris Barker - NOAA Federal wrote: >Let's just keep it on email -- I, at least, find i never participate in any >other type of discussion forum regularly. As do I.

Re: [Python-ideas] Simplicity of C (was why is design-by-contracts not widely)

2018-09-29 Thread Cameron Simpson
t assertions corresponding the the method semantic definition. The flip side of this is that there's no case for language changes in what I say above: the decorators look pretty good to my eye. Cheers, Cameron Simpson ___ Python-ideas mailing l

Re: [Python-ideas] Renaming icontract to pcontract

2018-10-01 Thread Cameron Simpson
On 01Oct2018 07:25, Marko Ristin-Kaufmann wrote: I'd like to rename icontract into pcontract to avoid name conflict with java's icontract library. Do you have any better suggestion? No, sounds ok to me. What was the "i" for in the old name? Che

Re: [Python-ideas] Support parsing stream with `re`

2018-10-06 Thread Cameron Simpson
This incantation: for lineno, line in enumerate(gcode, 1): is to make it easy to print error message which recite the file line number to aid debugging. If you don't need that you'd just run with: for line in gcode: 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] Support parsing stream with `re`

2018-10-07 Thread Cameron Simpson
use case, but I'm trying to avoid writing an algorithm. No. You can write a line by line loop. See my other post. Cheers, Cameron Simpson ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/pyth

Re: [Python-ideas] Support parsing stream with `re`

2018-10-08 Thread Cameron Simpson
matches as the memory gets consumed, or is the first iateration blocking and consuming gobs of memory before the first match comes back? A print() call will tell you that. 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] Support parsing stream with `re`

2018-10-09 Thread Cameron Simpson
Yes, pages (whatever using the memory paging service works in). But not COW. Changes to the memory affect the file contents and are visible to the other process. It is mapped, not pseudocopied. Cheers, Cameron Simpson ___ Python-ideas mailing list P

Re: [Python-ideas] Revisiting Immutable Mappings

2018-10-10 Thread Cameron Simpson
ial way to spell "frozendict". One could argue for the above as a nice example to live in the docs perhaps. But not everything needs a special name. Cheers, Cameron Simpson ___ Python-ideas mailing list Python-ideas@python.org https://mail.

Re: [Python-ideas] Add closing and iteration to threading.Queue

2018-10-21 Thread Cameron Simpson
_usually_ only one getter but of course there's no need for that. So to my mind his proposal is very simple and sensible, and matches almost universally my own use of Queues. Cheers, Cameron Simpson ___ Python-ideas mailing list Python-ideas@p

Re: [Python-ideas] Add closing and iteration to threading.Queue

2018-10-21 Thread Cameron Simpson
this kind of circular flow because if your queue communicates backpressure (which it should) then circular flows can deadlock. Haven't come across this myself. A closeable queue doesn't seem circular to me. The handling of the sentinel is internal to the IterableQueue,

Re: [Python-ideas] struct.unpack should support open files

2018-12-25 Thread Cameron Simpson
LL', 'rate initial_delay') Then you can just use PDInfo.from_buffer() or PDInfo.from_bytes() to parse out your structures from then on. I used to have tedious duplicated code for bytes and files in various placed; I'm ripping it out and replacing with this as I encounter it. Far more r

Re: [Python-ideas] struct.unpack should support open files

2018-12-26 Thread Cameron Simpson
need to pass it to a file-expecting object. Do it _once_, and don't megacomplicatise all the existing utility classes. 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] struct.unpack should support open files

2018-12-26 Thread Cameron Simpson
x27;ll see how general purpose it really is. The PyPI package pages for each have doco derived from the module docstrings. Cheers, Cameron Simpson ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ide

Re: [Python-ideas] struct.unpack should support open files

2018-12-26 Thread Cameron Simpson
On 27Dec2018 12:59, Steven D'Aprano wrote: On Thu, Dec 27, 2018 at 10:02:09AM +1100, Cameron Simpson wrote: [...] >Also I'm thinking about type annotations in typeshed. >Now the type is Union[array[int], bytes, bytearray, memoryview] >Should it be Union[io.BinaryIO

Re: [Python-ideas] AMEND PEP-8 TO DISCOURAGE ALL CAPS

2019-01-04 Thread Cameron Simpson
our in the absence of config files. 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] AMEND PEP-8 TO DISCOURAGE ALL CAPS

2019-01-04 Thread Cameron Simpson
;s nice and clear and absolutely everyone knows what it means. Me too. 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] kwargs for return

2019-01-26 Thread Cameron Simpson
__(self, value): super().__int__(value) self.x = 'x!' self.y = 4 def foo_rich(): return Richness(3) a, **kw = foo_rich() gets a=3 and kw={'x': 'x!', 'y': 4}. I've got mixed mfeelings about this, but it does supply the kind of mechanism he seems to be thinking about. 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] AMEND PEP-8 TO DISCOURAGE ALL CAPS

2019-01-29 Thread Cameron Simpson
es? Yes they do, and they do a disservice to everyone. 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] AMEND PEP-8 TO DISCOURAGE ALL CAPS

2019-01-30 Thread Cameron Simpson
ut the flip side of being in a mostly lower case world is that having occasional upper case as a standout formatting for particular entities sudden has more value. And that value has been used for constants for a long time with, IMO, some benefit. 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] Clearer communication

2019-02-01 Thread Cameron Simpson
re many many clients and one should find one which suits your preferred interface and behaviour. With a web interface this is basicly not a choice. And IMO web browsers are terrible email readers. Some systems like discourse offer a web interface and also email. Che

Re: [Python-ideas] Keeping discussion relevant

2019-02-08 Thread Cameron Simpson
e first of these, at least initially. It is less intrusive and makes the shift evident. 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] PEP 8 update on line length

2019-02-19 Thread Cameron Simpson
ble name sizes. The longer the line, the harder it is to apprehend. To my mind 80 columns is a nice upper limit: long enough for expressiveness, short enough to easily scan. Cheers, Cameron Simpson ___ Python-ideas mailing list Python-id

Re: [Python-ideas] New Data Structure - Non Well-Founded Dict

2019-03-17 Thread Cameron Simpson
And in case it wasn't clear, "python-list" is here: python-l...@python.org Please try posting the same question there instead. Cheers, Cameron Simpson On 17Mar2019 16:23, David Mertz wrote: This is an interesting challenge you have. However, this list is for proposing ideas

Re: [Python-ideas] True and False are singletons

2019-03-19 Thread Cameron Simpson
te such an idiom as "if x is None: ... elif x: truthy-action else: falsey-action" i.e. only rely on a singleton for the "not set" sentinel (usually None, occasionally something else). 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] New explicit methods to trim strings

2019-03-24 Thread Cameron Simpson
#x27;t mean what "trim" is proposed to mean here). "clip"? I'm +0.9 rather than +1 entirely because the operation feels so... trivial, which usually trips the "not everything needs a method" argument. But it is also very common. Cheers, Cameron Simpson

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

2019-03-29 Thread Cameron Simpson
x27;m a big -1 on ltrim and rtrim because of confusion with the VERY well known PHP trim function which does something else. I like lcut/rcut as succienct and reminiscent of the UNIX "cut" command. I like cutprefix and cutsuffix even more, as having similar heft as the startswith

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

2019-03-31 Thread Cameron Simpson
yes, the longest regexp itself, nothing to do with what it matched. Config stupidity ensues. Do things in the order supplied: that way the user has control. Doing things by length is imposing policy which can't be circumvented. 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] Backward-incompatible changes for Python 4

2019-04-01 Thread Cameron Simpson
ict would have that flavour in that thread. For simple dict/set quicts this presents a fairly capped memory use (two flavours, and per thread view state) but companion types such as the quoat have much more scope for heavy memory consumption. Cheers, Cameron Simpson ___

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

2019-04-02 Thread Cameron Simpson
or does something which only _looks_ like this purpose". Classic example from the codebase I was in at the time was SQL parameter insertion. Eventually I said "... this" and wrote the battery anyway. My position on cut*affix is that (a) it is easy to implement (b) it can t

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

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] 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] 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] 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] 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] [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/

[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...@

[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: 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
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: 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: 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: 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: 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: 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: 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-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] 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
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] 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: 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: 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

  1   2   >