Mailing List Archive

1 2 3 4  View All
Re: (no subject) [ In reply to ]
John Wong wrote:
>
> I am actually
> amazed to remember dict + dict is not possible... there must be a reason
> (performance??) for this...

I think it's mainly because there is no obviously
correct answer to the question of what to do about
duplicate keys.

--
Greg
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com
Re: (no subject) [ In reply to ]
Georg Brandl wrote:
> The call syntax part is a mixed bag: on the one hand it is nice to be
> consistent with the extended possibilities in literals (flattening),
> but on the other hand there would be small but annoying inconsistencies
> anyways (e.g. the duplicate kwarg case above).

That inconsistency already exists -- duplicate keys are
allowed in dict literals but not calls:

>>> {'a':1, 'a':2}
{'a': 2}

--
Greg
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com
Re: (no subject) [ In reply to ]
I am still in favor of this PEP but have run out of time to review it and
the feedback. I'm going on vacation for a week or so, maybe I'll find time,
if not I'll start reviewing this around Feb 23.

--
--Guido van Rossum (python.org/~guido)
Re: (no subject) [ In reply to ]
Victor,

Thanks - I will comment on the issue WRT backporting the fix.
If you have particular issues you??d like me to look into, just point me in
the right direction.

Thanks,

Rob



On 6/30/17, 2:29 AM, "Victor Stinner" <victor.stinner@gmail.com> wrote:

>Hi Robb,
>
>2017-06-29 23:34 GMT+02:00 Rob Boehne <robb@datalogics.com>:
>> I??m new to the list, and contributing to Python specifically, and I??m
>> interested in getting master and 3.6 branches building and working
>> ??better?? on UNIX.
>> I??ve been looking at a problem building 3.6 on HP-UX and see a PR was
>> merged into master, https://github.com/python/cpython/pull/1351 and I??d
>> like to see it applied to 3.6. I??m happy to create a PR with a
>> cherry-picked commit, and/or test.
>
>Sure, this change can be backported to 3.6, maybe also to 3.5. But
>hum, I may suggest to first focus on the master branch and fix most
>HP-UX issues, before spending time on backport. I would prefer to see
>most tests of the important modules pass on HP-UX (ex: test_os).
>
>For a backport, you can directly comment http://bugs.python.org/issue30183
>
>Victor

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com
Re: (no subject) [ In reply to ]
On 2017-12-26 07:01, Yogev Hendel wrote:
>
> I don't know if this is the right place to put this,
> but I've found the following lines of code results in an incredibly long
> processing time.
> Perhaps it might be of use to someone.
>
> /import re/
> /pat = re.compile('^/?(?:\\w+)/(?:[%\\w-]+/?)+/?$')/
> /pat.match('/t/a-aa-aa-aaaaa-aa-aa-aa-aa-aa-aa./')/
>
The pattern has a repeated repeat, which results in catastrophic
backtracking.

As an example, think about how the pattern (?:a+)+b would try to match
the string 'aaac'.

Match 'aaa', but not 'c'.

Match 'aa' and 'a', but not 'c'.

Match 'a' and 'aa', but not 'c'.

Match 'a' and 'a' and 'a', but not 'c'.

That's 4 failed attempts.

Now try match the string 'aaaac'.

Match 'aaaa', but not 'c'.

Match 'aaa' and 'a', but not 'c'.

Match 'aa' and 'aa', but not 'c'.

Match 'aa' and 'a a', but not 'c'.

Match 'a' and 'aaa', but not 'c'.

Match 'a' and 'aa' and 'a', but not 'c'.

Match 'a' and 'a aa', but not 'c'.

Match 'a' and 'a a' and 'a', but not 'c'.

That's 8 failed attempts.

Each additional 'a' in the string to match will double the number of
attempts.

Your pattern has (?:[%\w-]+/?)+, and the '/' is optional. The string has
a '.', which the pattern can't match, but it'll keep trying until it
finally fails.

If you add just 1 more 'a' or '-' to the string, it'll take twice as
long as it does now.

You need to think more carefully about how the pattern matches and what
it'll do when it doesn't match.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com
Re: (no subject) [ In reply to ]
On Tue, Dec 26, 2017 at 2:01 AM, Yogev Hendel <yogev@intsights.com> wrote:
>
> I don't know if this is the right place to put this,
> but I've found the following lines of code results in an incredibly long
> processing time.
> Perhaps it might be of use to someone.
>
> import re
> pat = re.compile('^/?(?:\\w+)/(?:[%\\w-]+/?)+/?$')
> pat.match('/t/a-aa-aa-aaaaa-aa-aa-aa-aa-aa-aa./')

(I think the correct place is python-list. python-dev is primarily for
the developers of Python itself. python-ideas is for proposing new
features and changes to the language. python-list is for general
discussion. Bug reports and feature requests belong in
https://bugs.python.org/ (where your post could also have gone).)

The textbook regular expression algorithm (which I believe grep uses)
runs in linear time with respect to the text length. The algorithm
used by Perl, Java, Python, JavaScript, Ruby, and many other languages
instead use a backtracking algorithm, which can run up to exponential
time with respect to text length. This worst-case is in fact necessary
(assuming P != NP): Perl allows (introduced?) backreferences, which
are NP-hard[1]. Perl also added some other features which complicate
things, but backreferences are enough.

The user-level solution is to understand how regexes are executed, and
to work around it.

Here are library-level solutions for your example:
1. Perl now has a regex optimizer, which will eliminate some
redundancies. Something similar can be added to Python, at first as a
third-party library.
2. In theory, we can use the textbook algorithm when possible, and the
backtracking algorithm when necessary. However, the textbook version
won't necessarily be faster, and may take more time to create, so
there's a tradeoff here.
3. To go even further, I believe it's possible to use the textbook
algorithm for subexpressions, while the overall expression uses
backtracking, internally iterating through the matches of the textbook
algorithm.

There's a series of articles by Russ Cox that try to get us back to
the textbook (see [2]). He and others implemented the ideas in the C++
library RE2[3], which has Python bindings[4]. RE2 was made for and
used on Google Code Search[5] (described in his articles), a (now
discontinued) search engine for open-source repos which allowed
regular expressions in the queries.

You can get a whiff of the limitations of the textbook algorithm by
checking out RE2's syntax[6] and seeing what features aren't
supported, though some features may be unsupported for different
reasons (such as being redundant syntax).
- Backreferences and lookaround assertions don't have a known solution.[7]
- Bounded repetition is only supported up to a limit (1000), because
each possible repetition needs its own set of states.
- Possessive quantifiers aren't supported. Greedy and reluctant quantifiers are.
- Groups and named groups _are_ supported. See the second and third
Russ Cox articles, with the term "submatch".[2]

(Apologies: I am making up reference syntax on-the-fly.)
[1] "Perl Regular Expression Matching is NP-Hard"
https://perl.plover.com/NPC/
[2] "Regular Expression Matching Can Be Simple And Fast"
https://swtch.com/~rsc/regexp/regexp1.html
"Regular Expression Matching: the Virtual Machine Approach"
https://swtch.com/~rsc/regexp/regexp2.html
"Regular Expression Matching in the Wild"
https://swtch.com/~rsc/regexp/regexp3.html
"Regular Expression Matching with a Trigram Index"
https://swtch.com/~rsc/regexp/regexp4.html
[3] RE2: https://github.com/google/re2
[4] pyre2: https://github.com/facebook/pyre2/
Also see re2 and re3 on PyPI, which intend to be a drop-in
replacement. re3 is a Py3-compatible fork of re2, which last updated
in 2015.
[5] https://en.wikipedia.org/wiki/Google_Code_Search
[6] https://github.com/google/re2/wiki/Syntax
[7] Quote: "As a matter of principle, RE2 does not support constructs
for which only backtracking solutions are known to exist. Thus,
backreferences and look-around assertions are not supported."
https://github.com/google/re2/wiki/WhyRE2
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com
Re: (no subject) [ In reply to ]
Hi Robert,

This mailing list is for the development of the Python interpreter, not
a general help desk. There are many other forums where you can ask for
help, such as the comp.lang.python newsgroup, Stackoverflow, /r/python
on Reddit, the IRC channel, and more.

Perhaps you can help us though, I presume you signed up to this mailing
list via the web interface at

https://mail.python.org/mailman/listinfo/python-dev

Is there something we could do to make it more clear that this is not
the right place to ask for help?


--
Steven
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com
Re: (no subject) [ In reply to ]
Hi Steven,

Thank you for pointing me in the right direction. Will search for help on
places you mentioned.

Not sure how can we help you with developing the Python interpreter, as I
doubt we have any knowledge that this project might use it. When I say
'we', I mean on my colleague and me.

All the best,
--
Robert Okadar
IT Consultant

Schedule an *online meeting <https://calendly.com/aranea-network/60min>* with
me!

Visit *aranea-mreze.hr* <http://aranea-mreze.hr> or call
* +385 91 300 8887*


On Wed, 10 Apr 2019 at 17:36, Steven D'Aprano <steve@pearwood.info> wrote:

> Hi Robert,
>
> This mailing list is for the development of the Python interpreter, not
> a general help desk. There are many other forums where you can ask for
> help, such as the comp.lang.python newsgroup, Stackoverflow, /r/python
> on Reddit, the IRC channel, and more.
>
> Perhaps you can help us though, I presume you signed up to this mailing
> list via the web interface at
>
> https://mail.python.org/mailman/listinfo/python-dev
>
> Is there something we could do to make it more clear that this is not
> the right place to ask for help?
>
>
> --
> Steven
>
Re: (no subject) [ In reply to ]
On 4/10/2019 7:24 AM, Robert Okadar wrote:
> Hi community,
>
> I have developed a tkinter GUI component, Python v3.7. It runs very well in
> Linux but seeing a huge performance impact in Windows 10. While in Linux an
> almost real-time performance is achieved, in Windows it is slow to an
> unusable level.
>
> The code is somewhat stripped down from the original, but the performance
> difference is the same anyway. The columns can be resized by clicking on
> the column border and dragging it. Resizing works only for the top row (but
> it resizes the entire column).
> In this demo, all bindings are avoided to exclude influence on the
> component performance and thus not included. If you resize the window
> (i.e., if you maximize it), you must call the function table.fit() from
> IDLE shell.
>
> Does anyone know where is this huge difference in performance coming from?
> Can anything be done about it?

For reasons explained by Steve, please send this instead to python-list
https://mail.python.org/mailman/listinfo/python-list
To access python-list as a newsgroup, skip comp.lang.python and use
newsgroup gmane.comp.python.general at news.gmane.org.

I will respond there after testing/verifying and perhaps searching
bugs.python.org for a similar issue.

--
Terry Jan Reedy

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com
Re: (no subject) [ In reply to ]
On 2019-04-10 22:00, Terry Reedy wrote:
> On 4/10/2019 7:24 AM, Robert Okadar wrote:
>> Hi community,
>>
>> I have developed a tkinter GUI component, Python v3.7. It runs very well in
>> Linux but seeing a huge performance impact in Windows 10. While in Linux an
>> almost real-time performance is achieved, in Windows it is slow to an
>> unusable level.
>>
>> The code is somewhat stripped down from the original, but the performance
>> difference is the same anyway. The columns can be resized by clicking on
>> the column border and dragging it. Resizing works only for the top row (but
>> it resizes the entire column).
>> In this demo, all bindings are avoided to exclude influence on the
>> component performance and thus not included. If you resize the window
>> (i.e., if you maximize it), you must call the function table.fit() from
>> IDLE shell.
>>
>> Does anyone know where is this huge difference in performance coming from?
>> Can anything be done about it?
>
> For reasons explained by Steve, please send this instead to python-list
> https://mail.python.org/mailman/listinfo/python-list
> To access python-list as a newsgroup, skip comp.lang.python and use
> newsgroup gmane.comp.python.general at news.gmane.org.
>
> I will respond there after testing/verifying and perhaps searching
> bugs.python.org for a similar issue.
>
ttk has Treeview, which can be configured as a table.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/list-python-dev%40lists.gossamer-threads.com
Re: (no subject) [ In reply to ]
[woops]
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/NAT7FGQUCSCB2I265P7IR5BATLKHL5FT/
Code of Conduct: http://python.org/psf/codeofconduct/

1 2 3 4  View All