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://
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
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
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
___
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
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
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
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
'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
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
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
___
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
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
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
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
___
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
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
... 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
..
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
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
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
Trying to get back to speed with PEP-499...
On 06Aug2015 13:26, Nick Coghlan wrote:
On 6 August 2015 at 10:07, Cameron Simpson wrote:
I suspect "How Reloading Will Work" would need to track both module.__name__
and module.__spec__.name to reattach the module to both entires in
s
ot %d bytes"
% (offset0, datalen, len(data)))
offset += datalen
return data, offset
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/
t is nonsemantic: I wish it let me put meaningless whitespace
inside the format for readability).
+1 on the proposal from me.
Oh: subject to one proviso: reading a struct will need to return how many bytes
of input data were scanned, not merely retur
to avoid making a weird incongruity, where only
variable-length strings return the length actually parsed.
Fully agree. Arguing for two API calls: the current one and one that also
returns the scan length.
Cheers,
Cameron Simpson
___
Python-ideas mailing
.
Have you read the struct module? Do you think your additions would be very
intrusive to it, or relatively simple? Will the present performance be likely
to be the same with your additions (not necessarily to cost to parse the new
formats, but the performance with any existing fixed length
ather niche function. Had you considered just calling "du" via
subprocess and reading the number it returns?
Cheers,
Cameron Simpson
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
m the kind of person
who'd write his own for things like this sometimes also. Starting with Python's
os.walk function would get you off the ground.
If you end up with something clean and usable by others, publish it to PyPI.
Cheers,
Cameron Simpson
__
deal with 3). Catching nested exception is not what
people want many times.
Isn't it? Why not? Can you explain further?
I hope this real world example shows why the scenario is real, and that my
discussion shows why for me at least it would be handy to _easily_ catch the
"shallow"
On 22Jun2017 19:47, Andy Dirnberger wrote:
On Jun 22, 2017, at 7:29 PM, Cameron Simpson wrote:
try:
foo(bah[5])
except IndexError as e:
... infer that there is no bah[5] ...
Of course, it is possible that bah[5] existed and that foo() raised an
IndexError of its own. One
On 24Jun2017 05:02, Steven D'Aprano wrote:
On Fri, Jun 23, 2017 at 09:29:23AM +1000, Cameron Simpson wrote:
On 23Jun2017 06:55, Steven D'Aprano wrote:
>On Thu, Jun 22, 2017 at 10:30:57PM +0200, Sven R. Kunze wrote:
>>We usually teach our newbies to catch exceptions as nar
On 23Jun2017 11:48, Nick Coghlan wrote:
On 23 June 2017 at 09:29, Cameron Simpson wrote:
This is so common that I actually keep around a special hack:
def prop(func):
''' The builtin @property decorator lets internal AttributeErrors
escape.
While that can sup
On 23Jun2017 15:59, Paul Moore wrote:
On 23 June 2017 at 15:20, Sven R. Kunze wrote:
On 23.06.2017 03:02, Cameron Simpson wrote:
How about something like this?
try:
val = bah[5]
except IndexError:
# handle your expected exception here
else:
foo(val)
That is the
ere's some code to refactor using this construct now...
Alas, no. It is existing syntax in Standard ML, not in Python.
Cheers,
Cameron Simpson
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-i
On 26Jun2017 13:30, Ethan Furman wrote:
On 06/26/2017 01:20 PM, Mikhail V wrote:
I dont't like "while True:" simply because it does not make enough
visual distinction with the "while condition:" statement.
My "while True:" loops look something like:
whil
rasings because the tail iterables
("chunks" and "blocks") are of unknown and potentially large size.
And a few other cases whose uses are harder to succinctly describe, but
generally "iterable flattening".
So it is uncommon for me, but very useful when I wan
lar keyword.
Cheers,
Cameron Simpson
Trust the computer industry to shorten Year 2000 to Y2K. It was this thinking
that caused the problem in the first place.
- Mark Ovens
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.
rors with
distinct text for 0 and >1 failure.
Cheers,
Cameron Simpson (formerly c...@zip.com.au)
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
On 31Oct2017 22:50, Greg Ewing wrote:
Koos Zevenhoven wrote:
|defsingle(i): try: ||v =i.next()
|||exceptStopIteration:raiseException('No values')|||try: ||i.next()
||exceptStopIteration: ||returnv||else: ||raiseException('Too many
values')|||printsingle(name forname in('bob','fred')
chine code when
used).
This isn't really an option for "pure" Python.
Cheers,
Cameron Simpson (formerly c...@zip.com.au)
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
Personally, I'm -1 for an autoimport because it doesn't actually buy much, and
-2 for any autoimport based on PHP semantics, which generally lead to "fail
late" instead of "fail early".
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/
ssion as name" camp, which I gather is already
rejected.
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/
On 13May2018 07:07, Cameron Simpson wrote:
Similar to import statements, optional parentheses could be included in the
grammar, allowing the name bindings to be split across multiple lines:
if diff and g > 1 given (
diff = x - x_base,
g = gcd(diff, n),
):
return g
success.
And that is entirely enabled by the implied scoping in the "if" statement.
The above example is subtly wrong because I'm doing this from memory, but I had
a very simple real world example bite me this way and it was a PITA to debug
because the effect was so surprising. So mu
On 13May2018 00:51, MRAB wrote:
On 2018-05-12 22:07, Cameron Simpson wrote:
On 06May2018 02:00, Nick Coghlan wrote:
Similar to import statements, optional parentheses could be included in the
grammar, allowing the name bindings to be split across multiple lines:
if diff and g > 1 gi
as with, import
and except.
Could someone point me to a post which nicely describes the rationale behind
its rejection? I'm sure there's one in the many in this discussion but I've
not found it yet.
Cheers,
Cameron Simpson
_
d painful memories of being burned by that in C. That's not
just speculation - it came up a number of times in the PEP 572
threads.
Disclaimer: I'm not a core dev!
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/
On 13May2018 14:23, Chris Angelico wrote:
On Sun, May 13, 2018 at 2:05 PM, Cameron Simpson wrote:
Could someone point me to a post which nicely describes the rationale behind
its rejection? I'm sure there's one in the many in this discussion but I've
not found
"not"...) fit this role.
So as a matter of egonomic design "given" ought also to bind less tightly than
"+". Arithmetic before logic before declaration before control, if you like.
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/
On 13May2018 06:45, Eric V. Smith wrote:
On 5/13/18 1:05 AM, Chris Angelico wrote:
On Sun, May 13, 2018 at 2:58 PM, Cameron Simpson wrote:
On 13May2018 14:23, Chris Angelico wrote:
https://www.python.org/dev/peps/pep-0572/#alternative-spellings
[...] I'd already looked at that pa
geset from maintenance, tread on the "3.3" with "2.5"
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/
slice assignment: replace a
sublist with another sequence.
Yes I see, actually that is what I am saying - slice assignment has
_replace_ semantics.
Yes, but note that replacing an _empty_ part of the list _is_ an insert!
Cheers,
Cameron Simpson
___
P
already be written:
L[len(L):len(L)]=[9]
Cumbersome, I accept. But I've got a .append method.
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/
On 16Jun2018 20:21, Mikhail V wrote:
On Sat, Jun 16, 2018 at 4:44 AM, Cameron Simpson wrote:
On 16Jun2018 02:42, Mikhail V wrote:
Some things _should_ be syntax errors. Particularly things which may be
typing errors. Suppose I'd meant to type:
L[0] = item
Silent breakage, requ
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
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
)
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
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
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
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
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
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
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
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
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
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
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
101 - 167 of 167 matches
Mail list logo