I can't remember unit systems for Python, do you mean third party module?
___
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
> but Python isn't trying to have the "optimal cutting-edge" thing in its
> standard library. More like "the well-established, widely-used" thing.
I also agree with this.
At present, I have confidence in zstd. There seems to be a trend that some
programmer users are switching to zstd.
Don't k
> Second, why use bytes units? Not every integer value measures the amount of
> memory. If you multiply 2 bytes by 3 bytes, do you get 6 square bytes?
If a code executes m_bytes * n_bytes, it's probably a logic error.
If all values have a unit in a programming language, it might help us to check
Thanks for your replies, your objections are convincing.
___
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 archive
I wrote a zstd module for stdlib:
https://github.com/animalize/cpython/pull/8/files
And a PyPI version based on it:
PyPI: https://pypi.org/project/pyzstd/
Doc: https://pyzstd.readthedocs.io/en/latest/
If you decide to include it into stdlib, the work can be done in a short
在 19-8-14 0:27, Andrew Barnert via Python-ideas 写道:
> On Aug 13, 2019, at 06:45, malincns wrote:
>>
>> Thanks for your guidance.
>> To be honest, it's a challenge for me.
>> It would be nice if an experienced person is willing to make this attempt.
>
> It would be a significant amount of work just
re module [1] and struct module [2] have module-level cache for compiled
stuffs.
Other third-party modules may also need cache for something.
Do we need an unified cache management API like this?
I suppose it's not mandatory, but welcome each module to use this API.
module.cache_get_capacity(
On 19-1-1 21:39, Stefan Behnel wrote:
> I wouldn't be surprised if the slowest part here was the isinstance()
> check. Maybe the RegexFlag class could implement "__hash__()" as "return
> hash(self.value)" ?
Apply this patch:
def _compile(pattern, flags):
# internal: compile pattern
- if
On 18-12-31 19:47, Antoine Pitrou wrote:
> The complaint is that the global cache is still too costly.
> See measurements in https://bugs.python.org/issue35559
In this issue, using a global variable `_has_non_base16_digits` [1] will
accelerate 30%.
Is re module's internal cache [2] so bad?
If
I have a compromise idea, here is some points:
1, Create a built-in class `pattern_str` which is a subclass of `str`,
it's dedicated to regex pattern string.
2, Use p"" to represent `pattern_str`.
Some advantages:
1, Since it's a subclass of `str`, we can use it as normal `str`.
2, IDE/linter
On 18-12-28 22:54, Joao S. O. Bueno wrote:
Sorry for sounding over-reactive, but yes, this could make Python look
like Perl.
Yes, this may introduce Perl's style irreversibly, we need to be
cautious about this.
I'm thinking, if people ask these questions in their mind when reading a
piece of
Maybe this literal will encourage people to finish tasks using regex,
even lead to abuse regex, will this change Python's style?
What's worse is, people using mixed manners in the same project:
one_line.split(',')
...
p','.split(one_line)
Maybe it will break the Python's style, reduce code rea
Reply to Stefan Behnel and Chris Angelico.
On 18-12-27 22:42, Stefan Behnel wrote:
> >>> import pickle, re
> >>> p = re.compile("[abc]")
> >>> pickle.dumps(p)
> b'\x80\x03cre\n_compile\nq\x00X\x05\x00\x00\x00[abc]q\x01K
\x86q\x02Rq\x03.'
>
> What this does, essentially, is to make the pickl
> It'd be good to know just how much benefit this precompilation
actually grants.
As far as I know, Pattern objects in regex module can be pickled, don't
know if it's useful.
>>> import pickle
>>> import regex
>>> p = regex.compile('[a-z]')
>>> b = pickle.dumps(p)
>>> p = pickle.loads(b)
> W
We can use this literal to represent a compiled pattern, for example:
>>> p"(?i)[a-z]".findall("a1B2c3")
['a', 'B', 'c']
>>> compiled = p"(?<=abc)def"
>>> m = compiled.search('abcdef')
>>> m.group(0)
'def'
>>> rp'\W+'.split('Words, words, words.')
['Words', 'words', 'words', '']
This allows pe
15 matches
Mail list logo