[issue42927] Inline cache for slots

2021-01-13 Thread Guido van Rossum


Change by Guido van Rossum :


--
keywords: +patch
pull_requests: +23043
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/24216

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42927] Inline cache for slots

2021-01-13 Thread Guido van Rossum


New submission from Guido van Rossum :

I've been thinking about Python performance improvements, and I played around 
with an inline cache enhancement that supports slots. The results on a very 
simple benchmark look promising (30% speedup) but I'm terrible with our 
benchmarking tools, and this should be considered *very* carefully before we go 
ahead with it, since it could potentially pessimize the inline cache for 
standard attributes.

I'll attach a PR in a minute.

--
messages: 385063
nosy: gvanrossum, pablogsal, yselivanov
priority: normal
severity: normal
stage: test needed
status: open
title: Inline cache for slots
type: performance
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Application window geometry specifier

2021-01-13 Thread 2QdxY4RzWzUUiLuE
On 2021-01-13 at 21:41:26 -0600,
Python  wrote:

> On Thu, Jan 14, 2021 at 12:27:19PM +1100, Chris Angelico wrote:
> > On Thu, Jan 14, 2021 at 12:11 PM Python  wrote:
> > >
> > > On Tue, Jan 12, 2021 at 06:43:39PM -, Grant Edwards wrote:
> > > > And those X11 users will swear at you if you override their window
> > > > managers configured window placement. Application code should not care
> > > > about or try to control window geometry. Period.
> > >
> > > I think this is just plain wrong.
> 
> As a side note, from a purely technical standpoint, Grant's point is
> demonstrably factually false.  A GUI application necessarily must
> "care about or try to control window geometry" so that if the user
> moves or resizes the application, enables or disables additional
> widgets, etc., the widgets it contains are redrawn such that they
> remain usable, possibly expanding the canvas they're drawn on or
> adding new GUI elements like scrollbars to ensure that (at least it
> does if it wants to be useful) ...

A GUI application must care about the geometry (to react to changes made
by the user or the window manager).

OTOH, if I (the user) request a 80x24 character terminal window with a
certain size glyph, and I get a terminal that isn't 80x24 and that glyph
size, then at least one of the application, the window manager, or some
other library is broken.  Period.  Go ahead, tell me, the *user*, that I
shouldn't do that, or that I should reconsider my use case, or that such
a request is too demanding for a modern computer system to honor.

See also Extended Window Manager Hints,¹ with the emphasis on *hints*.

> ... GUI frameworks may provide a core that automatically handles this
> for you, but that is not always the case (as an extreme example, if
> you're writing the whole app from scratch in assembly language) ...

Define "from scratch."

Why does the language in which I'm writing my application matter?

¹ https://en.wikipedia.org/wiki/Extended_Window_Manager_Hints
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Application window geometry specifier

2021-01-13 Thread Python
On Thu, Jan 14, 2021 at 03:02:05PM +1100, Chris Angelico wrote:
> On Thu, Jan 14, 2021 at 2:43 PM Python  wrote:
> > > it is far FAR better to put control in the user's hands
> >
> > I love how you dismissed that the semantics I described gives MORE
> > control to the user, not less, without actually sacrificing anything.
> 
> Actually, you give control to the application, and then the
> application has to choose to give it to the user.

Right, because unless the user can somehow execute instructions
directly on the CPU via some sort of direct cerebral link, all control
the user has over the behavior of the applications comes... from the
applications.

> But apparently, this thread has devolved to this kind of total
> dismissal

For which you are entirely the cause.  I simply responded in kind.
Apparently you don't like it any more than the rest of us do.

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


[issue38250] enum.Flag should be more set-like

2021-01-13 Thread Ethan Furman


Ethan Furman  added the comment:

The code sample:

class Color(IntFlag):
BLACK = 0
RED = 1
GREEN = 2
BLUE = 4
PURPLE = RED | BLUE
WHITE = RED | GREEN | BLUE

Here's the summary of the changes:

- single-bit flags are canonical
- multi-bit and zero-bit flags are aliases
+ only canonical flags are returned during iteration

>>> list(Color.WHITE)
[, , ]

- negating a flag or flag set returns a new flag/flag set with the
  corresponding positive integer value

>> Color.GREEN


>> ~Color.GREEN


- `name`s of pseudo-flags are constructed from their members' names

>>> (Color.RED | Color.GREEN).name
'RED|GREEN'

- multi-bit flags, aka aliases, can be returned from operations

>>> Color.RED | Color.BLUE


>>> Color(7)  # or Color(-1)


- membership / containment checking has changed slightly -- zero valued flags
  are never considered to be contained:

>>> Color.BLACK in Color.WHITE
False

  otherwise, if all bits of one flag are in the other flag, True is returned:

>>> Color.PURPLE in Color.WHITE
True

There is a new boundary mechanism that controls how out-of-range / invalid bits 
are handled: `STRICT`, `CONFORM`, `EJECT', and `KEEP':

  STRICT --> raises an exception when presented with invalid values
  CONFORM --> discards any invalid bits
  EJECT --> lose Flag status and become a normal int with the given value
  KEEP --> keep the extra bits
   - keeps Flag status and extra bits
   - they don't show up in iteration
   - they do show up in repr() and str()

The default for Flag is STRICT, the default for IntFlag is DISCARD, and the 
default for _convert_ is KEEP (see ssl.Options for an example of when KEEP is 
needed).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: count consecutive elements

2021-01-13 Thread Tim Chase
On 2021-01-13 18:20, Dan Stromberg wrote:
> I'm kind of partial to:
> 
> import collections
> import typing
> 
> 
> def get_longest(string: str) -> typing.Tuple[int, str]:
> """Get the longest run of a single consecutive character."""
> dict_: typing.DefaultDict[str, int] =
> collections.defaultdict(int) for left_ch, right_ch in zip(string,
> string[1:]): if left_ch == right_ch:
> dict_[left_ch] += 1
> 
> maximum = max((value, key) for key, value in dict_.items())
> 
> return maximum

seems to only return one value so seems to get odd results if I
specify something like

  get_longest("aaabcccbbb")

which at least here tells me that "c" is the longest run, even though
aaa, bbb, and ccc are all runs of length 3.  The OP didn't specify
what should happen in that case, so it would need some clarification.

-tkc



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


Re: Application window geometry specifier

2021-01-13 Thread Chris Angelico
On Thu, Jan 14, 2021 at 2:43 PM Python  wrote:
> > it is far FAR better to put control in the user's hands
>
> I love how you dismissed that the semantics I described gives MORE
> control to the user, not less, without actually sacrificing anything.

Actually, you give control to the application, and then the
application has to choose to give it to the user.

But apparently, this thread has devolved to this kind of total
dismissal, so I'm not going to respond further. Have fun building your
app, do what you like with it, and I'll continue to use
standards-compliant applications that actually behave correctly in all
situations.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Application window geometry specifier

2021-01-13 Thread Igor Korot
Hi, David,

On Wed, Jan 13, 2021 at 9:24 PM David L Neil via Python-list
 wrote:
>
> On 14/01/2021 15.25, boB Stepp wrote:
> > On Wed, Jan 13, 2021 at 7:28 PM Chris Angelico  wrote:
> >
> >> I love how "I think" is allowed to trump decades of usability research.
>
> I'm just pleased that @Chris has found love!
> (not detracting from the point though)
>
>
> > Can you recommend a good reference for someone relatively new to GUI
> > programming that is based on such research?  Book or web reference
> > would be fine.
>
> Most of my training-materials (certainly in this topic) are web-based -
> but the ideas are also common to Python.
>
>
> Nielsen-Norman Group do a lot of work in UX and offer a regular
> newsletter which is usually a good way to make the brain-cells work for
> their living: https://www.nngroup.com/
>
> eg https://www.nngroup.com/articles/usability-101-introduction-to-usability/
>
>
> A more applied view, courtesy of the New Zealand Government:
> https://www.digital.govt.nz/standards-and-guidance/nz-government-web-standards/web-usability-standard-1-3/
>
>
> Some become confused between the two terms: Accessibility and Usability.
>
> Here's what the boss says:
> https://www.w3.org/WAI/fundamentals/accessibility-usability-inclusion/
>
> This article clearly explains each and then offers a comparison.
> https://www.telerik.com/blogs/web-accessibility-vs-usability
>
>
> If you really want to dig-down, I know for-sure that IBM, Microsoft,
> Apple (and presumably others) have compiled style-guides about how
> various GUIs should work, starting from really basic matters such as
> when to use radio-buttons and when check-boxes. I can't tell you if the
> gtk, qt, or wx people offer something similar...

Certainly not wx - because wx using native set of widgets and therefore
relies on the OS UI guidelines.

Thank you.

> --
> Regards =dn
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Application window geometry specifier

2021-01-13 Thread Python
On Thu, Jan 14, 2021 at 12:27:19PM +1100, Chris Angelico wrote:
> On Thu, Jan 14, 2021 at 12:11 PM Python  wrote:
> >
> > On Tue, Jan 12, 2021 at 06:43:39PM -, Grant Edwards wrote:
> > > And those X11 users will swear at you if you override their window
> > > managers configured window placement. Application code should not care
> > > about or try to control window geometry. Period.
> >
> > I think this is just plain wrong.

As a side note, from a purely technical standpoint, Grant's point is
demonstrably factually false.  A GUI application necessarily must
"care about or try to control window geometry" so that if the user
moves or resizes the application, enables or disables additional
widgets, etc., the widgets it contains are redrawn such that they
remain usable, possibly expanding the canvas they're drawn on or
adding new GUI elements like scrollbars to ensure that (at least it
does if it wants to be useful).  GUI frameworks may provide a core
that automatically handles this for you, but that is not always the
case (as an extreme example, if you're writing the whole app from
scratch in assembly language), and in any event the framework is part
of the application... not the window manager.  Just because you didn't
write that code doesn't mean your app doesn't need those facilities.

> I love how "I think" is allowed to trump decades of usability research.

I love how your complete dismissal of everything I said is allowed to
replace logical counterargument, particuarly when you ignored the fact
that absolutely nothing I said actually contradicts any such years of
usability research IN ANY WAY--I merely pointed out that if the
application were to have ADDITIONAL flexibility for expert users in
regard to placing and sizing windows, the application must necessarily
care about and be able to control its window geometry.  All the other
behaviors remain consistent with usability standards--assuming the
vendor implemented them properly, which is a big assumption.  In fact,
providing such extra semantics may allow the user to overcome bad UI
when the vendor failed.

> it is far FAR better to put control in the user's hands

I love how you dismissed that the semantics I described gives MORE
control to the user, not less, without actually sacrificing anything.

I love how you dismissed that not all computer users and not all humans
are the same, that there are variances and outliers within all
usability studies, and indeed all studies of human behavior, and that
flexibility and configurability have value for that reason.

I love how you dismissed the perpectives and motivations of posters in
this thread without understanding or even hearing them.  For all you
know Rich may just be doing it as an academic exercise, in which case
whether or not it conforms to usability best practices is utterly
irrelevant, even if it weren't already the case that giving more
control to the user--something you just claimed to value--requires
giving control to the app.

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


Re: Application window geometry specifier

2021-01-13 Thread Igor Korot
Chris,

On Wed, Jan 13, 2021 at 8:12 PM Chris Angelico  wrote:
>
> On Thu, Jan 14, 2021 at 1:05 PM Igor Korot  wrote:
> >
> > Chris,
> >
> > On Wed, Jan 13, 2021 at 7:45 PM Chris Angelico  wrote:
> > >
> > > On Thu, Jan 14, 2021 at 12:39 PM Igor Korot  wrote:
> > > >
> > > > Chris,
> > > >
> > > > On Wed, Jan 13, 2021 at 7:33 PM Chris Angelico  wrote:
> > > > >
> > > > > On Thu, Jan 14, 2021 at 12:18 PM Python  
> > > > > wrote:
> > > > > > > The results will differ based on whether the user in question has
> > > > > > > basically just one primary application (an IDE, or some gigantic 
> > > > > > > app
> > > > > > > like Adobe PhotoShop) that they spend all their time in
> > > > > >
> > > > > > OK, so you admit that such apps do exist.  But I guess you knew that
> > > > > > the OP is not writing that sort of application, and know who its
> > > > > > intended audience is, and their work habits and preferences...
> > > > > >
> > > > >
> > > > > The difference isn't in what's best, but in what people are willing to
> > > > > accept. Just because people roll over and accept the latest Windows,
> > > > > the latest Mac OS, the latest PhotoShop, the latest Gmail, the latest
> > > > > whatever else, doesn't mean that (a) they actually like it, nor (b)
> > > > > it's actually better. (Which are independent.)
> > > > >
> > > > > When someone spends all their life in a single app, they're more
> > > > > likely to learn its particular way of doing things and assume that
> > > > > that's "correct". But that doesn't make it so.
> > > >
> > > > Correct.
> > > > But when that same person goes to a different company where a
> > > > different application
> > > > is used, he expects it to behave the same. Because the functionality of 
> > > > such
> > > > application is the same.
> > > >
> > > > Wouldn't you?
> > > >
> > > > It is called association.
> > > >
> > > > "I was working with Application A. Now I'm working with application
> > > > AA. And application
> > > > AA behaves very weirdly."
> > > >
> > >
> > > Yes, association is correct.
> > >
> > > "I was working with Application A. Now I'm working with Application B.
> > > And it behaves very weirdly."
> > >
> > > It's entirely possible that App A was the bad one, and unfortunately,
> > > that does happen. But this is exactly why it's better to follow the
> > > standards. Unless you are so egotistical that you think your users
> > > won't need *any* other applications in their lives, follow the
> > > standards.
> >
> > And you still don't say anything about my DB example.
> >
> > Normal DB application has to place credentials dialog center
> > screen or center frame, depending when it shows.
> >
> > Otherwise they will popup all over the place wrecking havoc
> > with the users.
> >
> > And so its better to show it centered, just like in my example
> > above. And as I said - I hope you are inside this 99.99% of users/
> > developers.
> >
>
> And isn't that exactly where the WM would put it by default too? The
> difference is, if the user wishes it to be somewhere else *for all
> applications*, s/he can reconfigure the WM, but it's an absolute pain
> if all these kinds of apps have to be independently reconfigured. The
> obvious defaults are obvious to the creators of WMs even more than app
> developers, AND you're not forcing people into your personal
> preferences.

I don't know. Do you?
Are you absolutely sure 100% it will put it there?
Especially by default?

Now here is the more interesting question:
if I create such a dialog (meaning it will not be pulled from external
library) what will happen?
Can you guarantee that my dialog will be placed accordingly
and if I call "dlg.Center()" it won't be ignored?

Thank you.

>
> ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Application window geometry specifier

2021-01-13 Thread dn via Python-list
On 14/01/2021 15.25, boB Stepp wrote:
> On Wed, Jan 13, 2021 at 7:28 PM Chris Angelico  wrote:
> 
>> I love how "I think" is allowed to trump decades of usability research.

I'm just pleased that @Chris has found love!
(not detracting from the point though)


> Can you recommend a good reference for someone relatively new to GUI
> programming that is based on such research?  Book or web reference
> would be fine.

Most of my training-materials (certainly in this topic) are web-based -
but the ideas are also common to Python.


Nielsen-Norman Group do a lot of work in UX and offer a regular
newsletter which is usually a good way to make the brain-cells work for
their living: https://www.nngroup.com/

eg https://www.nngroup.com/articles/usability-101-introduction-to-usability/


A more applied view, courtesy of the New Zealand Government:
https://www.digital.govt.nz/standards-and-guidance/nz-government-web-standards/web-usability-standard-1-3/


Some become confused between the two terms: Accessibility and Usability.

Here's what the boss says:
https://www.w3.org/WAI/fundamentals/accessibility-usability-inclusion/

This article clearly explains each and then offers a comparison.
https://www.telerik.com/blogs/web-accessibility-vs-usability


If you really want to dig-down, I know for-sure that IBM, Microsoft,
Apple (and presumably others) have compiled style-guides about how
various GUIs should work, starting from really basic matters such as
when to use radio-buttons and when check-boxes. I can't tell you if the
gtk, qt, or wx people offer something similar...
-- 
Regards =dn
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Application window geometry specifier

2021-01-13 Thread David L Neil via Python-list
On 14/01/2021 15.25, boB Stepp wrote:
> On Wed, Jan 13, 2021 at 7:28 PM Chris Angelico  wrote:
> 
>> I love how "I think" is allowed to trump decades of usability research.

I'm just pleased that @Chris has found love!
(not detracting from the point though)


> Can you recommend a good reference for someone relatively new to GUI
> programming that is based on such research?  Book or web reference
> would be fine.

Most of my training-materials (certainly in this topic) are web-based -
but the ideas are also common to Python.


Nielsen-Norman Group do a lot of work in UX and offer a regular
newsletter which is usually a good way to make the brain-cells work for
their living: https://www.nngroup.com/

eg https://www.nngroup.com/articles/usability-101-introduction-to-usability/


A more applied view, courtesy of the New Zealand Government:
https://www.digital.govt.nz/standards-and-guidance/nz-government-web-standards/web-usability-standard-1-3/


Some become confused between the two terms: Accessibility and Usability.

Here's what the boss says:
https://www.w3.org/WAI/fundamentals/accessibility-usability-inclusion/

This article clearly explains each and then offers a comparison.
https://www.telerik.com/blogs/web-accessibility-vs-usability


If you really want to dig-down, I know for-sure that IBM, Microsoft,
Apple (and presumably others) have compiled style-guides about how
various GUIs should work, starting from really basic matters such as
when to use radio-buttons and when check-boxes. I can't tell you if the
gtk, qt, or wx people offer something similar...
-- 
Regards =dn
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Application window geometry specifier

2021-01-13 Thread boB Stepp
On Wed, Jan 13, 2021 at 7:28 PM Chris Angelico  wrote:

> I love how "I think" is allowed to trump decades of usability research.

Can you recommend a good reference for someone relatively new to GUI
programming that is based on such research?  Book or web reference
would be fine.

Cheers!
boB
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: count consecutive elements

2021-01-13 Thread Dan Stromberg
On Wed, Jan 13, 2021 at 5:59 PM Tim Chase 
wrote:

> On 2021-01-13 21:20, Bischoop wrote:
> > I want to  to display a number or an alphabet which appears mostly
> > consecutive in a given string or numbers or both
> > Examples
> > s= ' aabskaaabad'
> > output: c
> > # c appears 4 consecutive times
> >  8bbakebaoa
> > output: b
> > #b appears 2 consecutive times
>

I'm kind of partial to:

import collections
import typing


def get_longest(string: str) -> typing.Tuple[int, str]:
"""Get the longest run of a single consecutive character."""
dict_: typing.DefaultDict[str, int] = collections.defaultdict(int)
for left_ch, right_ch in zip(string, string[1:]):
if left_ch == right_ch:
dict_[left_ch] += 1

maximum = max((value, key) for key, value in dict_.items())

return maximum

HTH
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Application window geometry specifier

2021-01-13 Thread Chris Angelico
On Thu, Jan 14, 2021 at 1:05 PM Igor Korot  wrote:
>
> Chris,
>
> On Wed, Jan 13, 2021 at 7:45 PM Chris Angelico  wrote:
> >
> > On Thu, Jan 14, 2021 at 12:39 PM Igor Korot  wrote:
> > >
> > > Chris,
> > >
> > > On Wed, Jan 13, 2021 at 7:33 PM Chris Angelico  wrote:
> > > >
> > > > On Thu, Jan 14, 2021 at 12:18 PM Python  wrote:
> > > > > > The results will differ based on whether the user in question has
> > > > > > basically just one primary application (an IDE, or some gigantic app
> > > > > > like Adobe PhotoShop) that they spend all their time in
> > > > >
> > > > > OK, so you admit that such apps do exist.  But I guess you knew that
> > > > > the OP is not writing that sort of application, and know who its
> > > > > intended audience is, and their work habits and preferences...
> > > > >
> > > >
> > > > The difference isn't in what's best, but in what people are willing to
> > > > accept. Just because people roll over and accept the latest Windows,
> > > > the latest Mac OS, the latest PhotoShop, the latest Gmail, the latest
> > > > whatever else, doesn't mean that (a) they actually like it, nor (b)
> > > > it's actually better. (Which are independent.)
> > > >
> > > > When someone spends all their life in a single app, they're more
> > > > likely to learn its particular way of doing things and assume that
> > > > that's "correct". But that doesn't make it so.
> > >
> > > Correct.
> > > But when that same person goes to a different company where a
> > > different application
> > > is used, he expects it to behave the same. Because the functionality of 
> > > such
> > > application is the same.
> > >
> > > Wouldn't you?
> > >
> > > It is called association.
> > >
> > > "I was working with Application A. Now I'm working with application
> > > AA. And application
> > > AA behaves very weirdly."
> > >
> >
> > Yes, association is correct.
> >
> > "I was working with Application A. Now I'm working with Application B.
> > And it behaves very weirdly."
> >
> > It's entirely possible that App A was the bad one, and unfortunately,
> > that does happen. But this is exactly why it's better to follow the
> > standards. Unless you are so egotistical that you think your users
> > won't need *any* other applications in their lives, follow the
> > standards.
>
> And you still don't say anything about my DB example.
>
> Normal DB application has to place credentials dialog center
> screen or center frame, depending when it shows.
>
> Otherwise they will popup all over the place wrecking havoc
> with the users.
>
> And so its better to show it centered, just like in my example
> above. And as I said - I hope you are inside this 99.99% of users/
> developers.
>

And isn't that exactly where the WM would put it by default too? The
difference is, if the user wishes it to be somewhere else *for all
applications*, s/he can reconfigure the WM, but it's an absolute pain
if all these kinds of apps have to be independently reconfigured. The
obvious defaults are obvious to the creators of WMs even more than app
developers, AND you're not forcing people into your personal
preferences.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Application window geometry specifier

2021-01-13 Thread Igor Korot
Chris,

On Wed, Jan 13, 2021 at 7:45 PM Chris Angelico  wrote:
>
> On Thu, Jan 14, 2021 at 12:39 PM Igor Korot  wrote:
> >
> > Chris,
> >
> > On Wed, Jan 13, 2021 at 7:33 PM Chris Angelico  wrote:
> > >
> > > On Thu, Jan 14, 2021 at 12:18 PM Python  wrote:
> > > > > The results will differ based on whether the user in question has
> > > > > basically just one primary application (an IDE, or some gigantic app
> > > > > like Adobe PhotoShop) that they spend all their time in
> > > >
> > > > OK, so you admit that such apps do exist.  But I guess you knew that
> > > > the OP is not writing that sort of application, and know who its
> > > > intended audience is, and their work habits and preferences...
> > > >
> > >
> > > The difference isn't in what's best, but in what people are willing to
> > > accept. Just because people roll over and accept the latest Windows,
> > > the latest Mac OS, the latest PhotoShop, the latest Gmail, the latest
> > > whatever else, doesn't mean that (a) they actually like it, nor (b)
> > > it's actually better. (Which are independent.)
> > >
> > > When someone spends all their life in a single app, they're more
> > > likely to learn its particular way of doing things and assume that
> > > that's "correct". But that doesn't make it so.
> >
> > Correct.
> > But when that same person goes to a different company where a
> > different application
> > is used, he expects it to behave the same. Because the functionality of such
> > application is the same.
> >
> > Wouldn't you?
> >
> > It is called association.
> >
> > "I was working with Application A. Now I'm working with application
> > AA. And application
> > AA behaves very weirdly."
> >
>
> Yes, association is correct.
>
> "I was working with Application A. Now I'm working with Application B.
> And it behaves very weirdly."
>
> It's entirely possible that App A was the bad one, and unfortunately,
> that does happen. But this is exactly why it's better to follow the
> standards. Unless you are so egotistical that you think your users
> won't need *any* other applications in their lives, follow the
> standards.

And you still don't say anything about my DB example.

Normal DB application has to place credentials dialog center
screen or center frame, depending when it shows.

Otherwise they will popup all over the place wrecking havoc
with the users.

And so its better to show it centered, just like in my example
above. And as I said - I hope you are inside this 99.99% of users/
developers.

Thank you.

>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: count consecutive elements

2021-01-13 Thread Tim Chase
On 2021-01-13 21:20, Bischoop wrote:
> I want to  to display a number or an alphabet which appears mostly
> consecutive in a given string or numbers or both
> Examples
> s= ' aabskaaabad'
> output: c
> # c appears 4 consecutive times
>  8bbakebaoa
> output: b
> #b appears 2 consecutive times

I'd break the problem into two parts:

1) iterate over your thing (in this case, a string) and emit the item
and its correpsonding count of consecutive matches.

2) feed that into something that finds the longest run(s) output by
that.

So off the cuff, something like

  def consecutive_counter(seq):
  # I'm not sure if there's something
  # like this already in itertools
  cur = nada = object()
  count = 0
  for x in seq:
  if x == cur:
  count += 1
  else:
  if cur is not nada:
  yield cur, count
  cur = x
  count = 1
  if cur is not nada:
  yield cur, count

  def longest(seq):
  results = []
  biggest = 0
  for item, count in seq:
  if count > biggest:
  results = [item]
  biggest = count
  elif count == biggest:
  results.append(item)
  return results, biggest

  for s in (
  "",
  "a",
  "aaa",
  "aaabbb",
  "aabskaaabad",
  "aabskaaakbad",
  ):
  print("Testing %r" % s)
  print(repr(longest(consecutive_counter(s

-tkc




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


Re: Application window geometry specifier

2021-01-13 Thread Greg Ewing

On 14/01/21 1:58 pm, Chris Angelico wrote:

On Thu, Jan 14, 2021 at 11:53 AM Python  wrote:


I believe it is or was quite common
for large, integrated applications like DAWs, graphical design
software, etc. to remember where you placed your various floating
toolbars and add-ons


Not just large, integrated applications. If I open Intaglio
(a modestly sized drawing app) on my Mac right now, the palettes
are all where I left them last time.


The results will differ based on whether the user in question has
basically just one primary application (an IDE, or some gigantic app
like Adobe PhotoShop) that they spend all their time in, or if they're
using myriad different applications. Especially in the latter case, it
is far FAR better to put control in the user's hands


I don't follow. If the app is just remembering where the user
put things, then it *is* putting control in the user's hands.

And I don't see what difference it makes how many different apps
they use. Leaving things where the user put them seems like a good
idea regardless.

Ideally, the OS or window manager would do the remembering, but
if it doesn't provide such a facility, I don't see any harm in
allowing the app to *request* (not force) a certain position for
a window.

The app can of course abuse that privilege, but that's the fault
of the app, not the feature.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: Application window geometry specifier

2021-01-13 Thread Chris Angelico
On Thu, Jan 14, 2021 at 12:39 PM Igor Korot  wrote:
>
> Chris,
>
> On Wed, Jan 13, 2021 at 7:33 PM Chris Angelico  wrote:
> >
> > On Thu, Jan 14, 2021 at 12:18 PM Python  wrote:
> > > > The results will differ based on whether the user in question has
> > > > basically just one primary application (an IDE, or some gigantic app
> > > > like Adobe PhotoShop) that they spend all their time in
> > >
> > > OK, so you admit that such apps do exist.  But I guess you knew that
> > > the OP is not writing that sort of application, and know who its
> > > intended audience is, and their work habits and preferences...
> > >
> >
> > The difference isn't in what's best, but in what people are willing to
> > accept. Just because people roll over and accept the latest Windows,
> > the latest Mac OS, the latest PhotoShop, the latest Gmail, the latest
> > whatever else, doesn't mean that (a) they actually like it, nor (b)
> > it's actually better. (Which are independent.)
> >
> > When someone spends all their life in a single app, they're more
> > likely to learn its particular way of doing things and assume that
> > that's "correct". But that doesn't make it so.
>
> Correct.
> But when that same person goes to a different company where a
> different application
> is used, he expects it to behave the same. Because the functionality of such
> application is the same.
>
> Wouldn't you?
>
> It is called association.
>
> "I was working with Application A. Now I'm working with application
> AA. And application
> AA behaves very weirdly."
>

Yes, association is correct.

"I was working with Application A. Now I'm working with Application B.
And it behaves very weirdly."

It's entirely possible that App A was the bad one, and unfortunately,
that does happen. But this is exactly why it's better to follow the
standards. Unless you are so egotistical that you think your users
won't need *any* other applications in their lives, follow the
standards.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Application window geometry specifier

2021-01-13 Thread Igor Korot
Chris,

On Wed, Jan 13, 2021 at 7:33 PM Chris Angelico  wrote:
>
> On Thu, Jan 14, 2021 at 12:18 PM Python  wrote:
> > > The results will differ based on whether the user in question has
> > > basically just one primary application (an IDE, or some gigantic app
> > > like Adobe PhotoShop) that they spend all their time in
> >
> > OK, so you admit that such apps do exist.  But I guess you knew that
> > the OP is not writing that sort of application, and know who its
> > intended audience is, and their work habits and preferences...
> >
>
> The difference isn't in what's best, but in what people are willing to
> accept. Just because people roll over and accept the latest Windows,
> the latest Mac OS, the latest PhotoShop, the latest Gmail, the latest
> whatever else, doesn't mean that (a) they actually like it, nor (b)
> it's actually better. (Which are independent.)
>
> When someone spends all their life in a single app, they're more
> likely to learn its particular way of doing things and assume that
> that's "correct". But that doesn't make it so.

Correct.
But when that same person goes to a different company where a
different application
is used, he expects it to behave the same. Because the functionality of such
application is the same.

Wouldn't you?

It is called association.

"I was working with Application A. Now I'm working with application
AA. And application
AA behaves very weirdly."

Thank you.

>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue42762] infinite loop resulted by "yield"

2021-01-13 Thread Xinmeng Xia


Xinmeng Xia  added the comment:

I see,Thank you!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Application window geometry specifier

2021-01-13 Thread Chris Angelico
On Thu, Jan 14, 2021 at 12:18 PM Python  wrote:
> > The results will differ based on whether the user in question has
> > basically just one primary application (an IDE, or some gigantic app
> > like Adobe PhotoShop) that they spend all their time in
>
> OK, so you admit that such apps do exist.  But I guess you knew that
> the OP is not writing that sort of application, and know who its
> intended audience is, and their work habits and preferences...
>

The difference isn't in what's best, but in what people are willing to
accept. Just because people roll over and accept the latest Windows,
the latest Mac OS, the latest PhotoShop, the latest Gmail, the latest
whatever else, doesn't mean that (a) they actually like it, nor (b)
it's actually better. (Which are independent.)

When someone spends all their life in a single app, they're more
likely to learn its particular way of doing things and assume that
that's "correct". But that doesn't make it so.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38250] enum.Flag should be more set-like

2021-01-13 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +23042
pull_request: https://github.com/python/cpython/pull/24215

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Application window geometry specifier

2021-01-13 Thread Igor Korot
Hi,

On Wed, Jan 13, 2021 at 7:20 PM Python  wrote:
>
> On Thu, Jan 14, 2021 at 11:58:34AM +1100, Chris Angelico wrote:
> > On Thu, Jan 14, 2021 at 11:53 AM Python  wrote:
> > Have you actually done any research by (a) asking people what they
> > actually prefer, and better still (b) silently watching over someone's
> > shoulder and seeing which one makes people more productive?
>
> As I said, though it's been a long while, I was actually a user of
> such applications myself.  So I can tell you quite authoritatively
> that in those kinds of apps, *I* absolutely prefer that the app
> remember where my windows are and what's in them, no contest.  And I
> would always use them alongside a slew of other apps--web browsers,
> text editors, mail clients, etc... most likely on a separate desktop,
> if I wasn't mobile, but necessarily on the same one if I was.
>
> > The results will differ based on whether the user in question has
> > basically just one primary application (an IDE, or some gigantic app
> > like Adobe PhotoShop) that they spend all their time in
>
> OK, so you admit that such apps do exist.  But I guess you knew that
> the OP is not writing that sort of application, and know who its
> intended audience is, and their work habits and preferences...

Unfortunately, this is how Wayland behaves right now.

When I tried to complain they said that saving/restoring perspective
is in the works.

But I sure hope that when people will switch to Wayland that DB
credentials dialog I was talking about
in the previous reply will still be positioned on the center of the screen.
Or even better - on the center of the main frame and not somewhere else.

Thank you.

>
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Application window geometry specifier

2021-01-13 Thread Chris Angelico
On Thu, Jan 14, 2021 at 12:11 PM Python  wrote:
>
> On Tue, Jan 12, 2021 at 06:43:39PM -, Grant Edwards wrote:
> > And those X11 users will swear at you if you override their window
> > managers configured window placement. Application code should not care
> > about or try to control window geometry. Period.
>
> I think this is just plain wrong.

I love how "I think" is allowed to trump decades of usability research.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Application window geometry specifier

2021-01-13 Thread Igor Korot
Hi,

On Wed, Jan 13, 2021 at 7:12 PM Python  wrote:
>
> On Tue, Jan 12, 2021 at 06:43:39PM -, Grant Edwards wrote:
> > And those X11 users will swear at you if you override their window
> > managers configured window placement. Application code should not care
> > about or try to control window geometry. Period.
>
> I think this is just plain wrong.  If you, the user, want to override
> what you, the user, configured your window manager to do, for WHATEVER
> reason your little heart may desire, then the application needs to
> give you an interface to request it, and rather importantly the WM must
> necessarily honor it.
>
> The policy reallly ought to be:
>
>  - If the user took the time to specify a geometry, do what it says
>(i.e. honor the placement the application asks for)
>  - If not but the window manager has something configured for that
> application/widget/whatever, do what it says
>  - Otherwise, resort to the window manager's default policy
>
> Arguably there ought to also be a way for the application to *suggest*
> a default geometry that the WM can override, but obviously providing a
> way to force the geometry gives rise to the opportunity for abuse by
> badly behaved developers.  Don't use those apps.
>
> Fortunately, at least historically, in practice most X11 window
> managers more or less did all that anyway.  I recall that when I
> switched to Gnome I had some trouble with this (as in, it just didn't
> work, generally, even if the relevant app allowed you to specify
> --geometry or similar), but AFAICT Gnome has long held to the notion
> that Gnome Gnows better than you do how you should run your apps, so
> when using Gnome all bets are off.

Well, I am running GNOME 3 on top of X11. I didn't preselect or configure
any windows positioning in there.
My application that I'm developing will be connecting to the database to
pull some data. When I tried to connect to Sybase ASE with their own ODBC driver
the dialog that asks for credentials shows up in the center of the screen.
And this is the position where (and I hope 99.99% of people) expect it
to show up.
Hopefully this number (99.99%) does include Mr. Angelico,.

But my application is maximized right now, so maybe it is centered on
the main frame.

Anyway that dialog (TLW) is centered.

Thank you.


>
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32218] add __iter__ to enum.Flag members

2021-01-13 Thread Ethan Furman


Ethan Furman  added the comment:

Final outcome:

`Flag` has been redesigned such that any flag comprised of a single bit is 
canonical; flags comprised of multiple bits are considered aliases.  During 
iteration only canonical flags are returned.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Application window geometry specifier

2021-01-13 Thread Python
On Thu, Jan 14, 2021 at 11:58:34AM +1100, Chris Angelico wrote:
> On Thu, Jan 14, 2021 at 11:53 AM Python  wrote:
> Have you actually done any research by (a) asking people what they
> actually prefer, and better still (b) silently watching over someone's
> shoulder and seeing which one makes people more productive?

As I said, though it's been a long while, I was actually a user of
such applications myself.  So I can tell you quite authoritatively
that in those kinds of apps, *I* absolutely prefer that the app
remember where my windows are and what's in them, no contest.  And I
would always use them alongside a slew of other apps--web browsers,
text editors, mail clients, etc... most likely on a separate desktop,
if I wasn't mobile, but necessarily on the same one if I was.

> The results will differ based on whether the user in question has
> basically just one primary application (an IDE, or some gigantic app
> like Adobe PhotoShop) that they spend all their time in

OK, so you admit that such apps do exist.  But I guess you knew that
the OP is not writing that sort of application, and know who its
intended audience is, and their work habits and preferences...

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


Re: Application window geometry specifier

2021-01-13 Thread Python
On Tue, Jan 12, 2021 at 06:43:39PM -, Grant Edwards wrote:
> And those X11 users will swear at you if you override their window
> managers configured window placement. Application code should not care
> about or try to control window geometry. Period.

I think this is just plain wrong.  If you, the user, want to override
what you, the user, configured your window manager to do, for WHATEVER
reason your little heart may desire, then the application needs to
give you an interface to request it, and rather importantly the WM must
necessarily honor it.

The policy reallly ought to be:

 - If the user took the time to specify a geometry, do what it says
   (i.e. honor the placement the application asks for)
 - If not but the window manager has something configured for that
application/widget/whatever, do what it says
 - Otherwise, resort to the window manager's default policy

Arguably there ought to also be a way for the application to *suggest*
a default geometry that the WM can override, but obviously providing a
way to force the geometry gives rise to the opportunity for abuse by
badly behaved developers.  Don't use those apps.

Fortunately, at least historically, in practice most X11 window
managers more or less did all that anyway.  I recall that when I
switched to Gnome I had some trouble with this (as in, it just didn't
work, generally, even if the relevant app allowed you to specify
--geometry or similar), but AFAICT Gnome has long held to the notion
that Gnome Gnows better than you do how you should run your apps, so
when using Gnome all bets are off.

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


Re: A beginning beginner's question about input, output and . . .

2021-01-13 Thread Greg Ewing

On 14/01/21 11:09 am, Grant Edwards wrote:

Perhaps I need to recalibrate my adjectives, but with
256KB+ of flash and 32KB+ of RAM, I wouldn't call them "small"


It's small by today's standards, when you consider that
multiple GB of RAM is commonplace now in most "real" computers.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: Application window geometry specifier

2021-01-13 Thread Chris Angelico
On Thu, Jan 14, 2021 at 11:53 AM Python  wrote:
>
> On Wed, Jan 13, 2021 at 10:07:23AM +1100, Chris Angelico wrote:
> > On Wed, Jan 13, 2021 at 10:02 AM Igor Korot  wrote:
> > > But for my dialogs (especially for dialogs where I need to ask for
> > > credentials) - I don't think I want
> > > WM to do my job.
> > >
> > > Again - we are talking positioning here and not size/client size.
> > >
> >
> > And I don't think I want you to do the WM's job.
> >
> > You're welcome to keep going to great effort to do the wrong thing,
> > but be aware that nobody will appreciate the work you're doing, and in
> > fact are more likely to curse you for it. Just save yourself a LOT of
> > hassle and let the WM do its job. It knows the user's wishes better
> > than you do.
>
> I think this is quite very, very far from true.  It's been a while
> since I've used such tools, but I believe it is or was quite common
> for large, integrated applications like DAWs, graphical design
> software, etc. to remember where you placed your various floating
> toolbars and add-ons (and even much more detailed state about how
> you'd set the various widgets in them), and that users of such
> applications expect that.
>

Have you actually done any research by (a) asking people what they
actually prefer, and better still (b) silently watching over someone's
shoulder and seeing which one makes people more productive?

The results will differ based on whether the user in question has
basically just one primary application (an IDE, or some gigantic app
like Adobe PhotoShop) that they spend all their time in, or if they're
using myriad different applications. Especially in the latter case, it
is far FAR better to put control in the user's hands than to try to
make the monopoly position work. Of course, if you are a big enough
name (like Apple, especially), you can do whatever you like, and
people just have to accept it. That's a monopoly for you, and there's
no evidence that it's better, just that people learn to live with it.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Application window geometry specifier

2021-01-13 Thread Python
On Wed, Jan 13, 2021 at 10:07:23AM +1100, Chris Angelico wrote:
> On Wed, Jan 13, 2021 at 10:02 AM Igor Korot  wrote:
> > But for my dialogs (especially for dialogs where I need to ask for
> > credentials) - I don't think I want
> > WM to do my job.
> >
> > Again - we are talking positioning here and not size/client size.
> >
> 
> And I don't think I want you to do the WM's job.
> 
> You're welcome to keep going to great effort to do the wrong thing,
> but be aware that nobody will appreciate the work you're doing, and in
> fact are more likely to curse you for it. Just save yourself a LOT of
> hassle and let the WM do its job. It knows the user's wishes better
> than you do.

I think this is quite very, very far from true.  It's been a while
since I've used such tools, but I believe it is or was quite common
for large, integrated applications like DAWs, graphical design
software, etc. to remember where you placed your various floating
toolbars and add-ons (and even much more detailed state about how
you'd set the various widgets in them), and that users of such
applications expect that.

Obviously the software needs to be aware of, and compensate for, cases
when the available display can't draw the various widgets in visible
space on the desktop/canvas/whatever, but if the application wants to
do all that, it seems like a perfectly wonderful feature to me.  The
last thing I want to do is spend 15 minutes to relocate and reconfgure
UI elements to where and how I like them before I can even start
working on a media project (or whatever).

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


[issue42923] Py_FatalError(): dump the list of extension modules

2021-01-13 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: A beginning beginner's question about input, output and . . .

2021-01-13 Thread Greg Ewing

On 13/01/21 7:57 pm, Christian Gollwitzer wrote:

  What do you mean, "until" ?

https://medium.com/@yon.goldschmidt/running-python-in-the-linux-kernel-7cbcbd44503c 


He's using Micropython. That's cheating! :-)

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: count consecutive elements

2021-01-13 Thread Bischoop
On 2021-01-13, Bischoop  wrote:
> t = set(s) # set of characters in s

I have this one changed to:
t= list(set(s))
-- 
https://mail.python.org/mailman/listinfo/python-list


[ANN] PyYAML-5.4b1: Linux and Mac users, please test wheels!

2021-01-13 Thread Matt Davis
===
Announcing PyYAML-5.4b1
===

A beta release of PyYAML is now available:
https://github.com/yaml/pyyaml/releases/tag/5.4b1

This release contains a security fix for CVE-2020-14343. It removes the
python/module, python/object, and python/object/new tags from the
FullLoader.
YAML that uses these tags must be loaded by UnsafeLoader, or a custom loader
that has explicitly enabled them.

This beta release also adds Python wheels for manylinux1 (x86_64) and
MacOS (x86_64) with the libyaml extension included (built on libyaml 0.2.5).
We believe these wheels to be stable, but please take the opportunity to
test
against your local Linux and MacOS environments, and file any issues at
https://github.com/yaml/pyyaml/issues.

PyYAML 5.4 will be the last release to support Python 2.7.


Changes
===

* https://github.com/yaml/pyyaml/pull/407 -- build modernization, remove
distutils, fix metadata, build wheels, CI to GHA
* https://github.com/yaml/pyyaml/pull/472 -- fix for CVE-2020-14343, moves
arbitrary python tags to UnsafeLoader
* https://github.com/yaml/pyyaml/pull/441 -- fix memory leak in implicit
resolver setup
* https://github.com/yaml/pyyaml/pull/392 -- fix py2 copy support for
timezone objects
* https://github.com/yaml/pyyaml/pull/378 -- fix compatibility with Jython


Resources
=

PyYAML IRC Channel: #pyyaml on irc.freenode.net
PyYAML homepage: https://github.com/yaml/pyyaml
PyYAML documentation: http://pyyaml.org/wiki/PyYAMLDocumentation
Source and binary installers: https://pypi.org/project/PyYAML/
GitHub repository: https://github.com/yaml/pyyaml/
Bug tracking: https://github.com/yaml/pyyaml/issues

YAML homepage: http://yaml.org/
YAML-core mailing list:
http://lists.sourceforge.net/lists/listinfo/yaml-core


About PyYAML


YAML is a data serialization format designed for human readability and
interaction with scripting languages. PyYAML is a YAML parser and emitter
for
Python.

PyYAML features a complete YAML 1.1 parser, Unicode support, pickle support,
capable extension API, and sensible error messages. PyYAML supports standard
YAML tags and provides Python-specific tags that allow to represent an
arbitrary Python object.

PyYAML is applicable for a broad range of tasks from complex configuration
files to object serialization and persistence.


Example
===

>>> import yaml

>>> yaml.full_load("""
... name: PyYAML
... description: YAML parser and emitter for Python
... homepage: https://github.com/yaml/pyyaml
... keywords: [YAML, serialization, configuration, persistence, pickle]
... """)
{'keywords': ['YAML', 'serialization', 'configuration', 'persistence',
'pickle'], 'homepage': 'https://github.com/yaml/pyyaml', 'description':
'YAML parser and emitter for Python', 'name': 'PyYAML'}

>>> print(yaml.dump(_))
name: PyYAML
homepage: https://github.com/yaml/pyyaml
description: YAML parser and emitter for Python
keywords: [YAML, serialization, configuration, persistence, pickle]


Maintainers
===

The following people are currently responsible for maintaining PyYAML:

* Ingy döt Net
* Matt Davis

and many thanks to all who have contribributed!
See: https://github.com/yaml/pyyaml/pulls


Copyright
=

Copyright (c) 2017-2020 Ingy döt Net 
Copyright (c) 2006-2016 Kirill Simonov 

The PyYAML module was written by Kirill Simonov .
It is currently maintained by the YAML and Python communities.

PyYAML is released under the MIT license.
See the file LICENSE for more details.
___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-archive.com


Re: FridayFinking - Was: A beginning beginner's question about input, output and . . .

2021-01-13 Thread Rich Shepard

On Thu, 14 Jan 2021, dn via Python-list wrote:


Concerning the definition of "old"
- when I'm having a 'good day', it's anyone several years my senior (and
above)
- when I'm creaking and groaning, it's anyone remotely my age, and older.


About 45 years ago a 25-year-older friend of mine offered a great philosophy
of life. "We can do nothing about growing older," she told me, "but we can
do everything about growing old."

How true.

Rich
--
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-13 Thread Grant Edwards
On 2021-01-13, Peter Pearson  wrote:
> On Mon, 11 Jan 2021 15:37:58 -0500, DonK  
> wrote:
> [snip]
>>
>> I've seen some Python gui frameworks like Tkinter, PyQt, etc. but they
>> look kinda like adding a family room onto a 1986 double wide mobile
>> home, 
>
> Agreed.
>
> Browsergui is not widely popular (I don't think anybody but me has
> mentioned it on this newsgroup), but it was written to be simple and
> Pythonic, and has served me well.  Browsergui just uses your browser as
> its user interface.  Grab it from
>
> https://github.com/speezepearson/browsergui

I've been browsing through to documentation and examples, and I don't
see any way to do any sort of modern flexible layout (e.g. nesting
horizontal and vertical flexboxes) where you can control which
elements grow/shrink when the window size changes.

Is there a way to span columns/rows in a grid or control which columns
grow/shrink?

Have I missed something?

--
Grant


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


Re: A beginning beginner's question about input, output and . . .

2021-01-13 Thread Grant Edwards
On 2021-01-13, Dennis Lee Bieber  wrote:
> On Tue, 12 Jan 2021 15:18:05 - (UTC), Grant Edwards
> declaimed the following:
>>On 2021-01-12, songbird  wrote:
>>
>>> it can be used for pretty much anything except perhaps high
>>> pressure real time things, but i bet someone else will know that
>>> is being done too, i've just not heard of it.  :)
>>
>>AFAIK, Python can't be used to write device drivers for any popular OS
>>(Linux, Unix, Windows, OSX). It also can't be used on small embedded
>>systems (real-time or not).
>
>   MicroPython/Circuit Python. Native language for AdaFruit's Metro
> boards.

Those are very cool, and I've come this -><- close to ordering one in
the past.  Perhaps I need to recalibrate my adjectives, but with
256KB+ of flash and 32KB+ of RAM, I wouldn't call them "small" -- even
though the Trinket M0 is physically tiny. But that may just be my age
showing. I remember not _that_ long ago working on processors where
the RAM was measured in hundreds of bytes. And I still maintain code
for ARM parts with way less than 1/10 the memory of the Trinket M0.

--
Grant



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


count consecutive elements

2021-01-13 Thread Bischoop
I want to  to display a number or an alphabet which appears mostly
consecutive in a given string or numbers or both
Examples
s= ' aabskaaabad'
output: c
# c appears 4 consecutive times
 8bbakebaoa
output: b
#b appears 2 consecutive times

I thought about set the string then and for each element loop the string
to check if equal with element set element if so count =+1 and check if
next to it is not equal add counter value to list with same index as in
set.
However I'm fighting to code it and the counting numbers are not right:


s = 'aabskaaabad'

c = 0
t = set(s) # set of characters in s
li=[0,0,0,0,0,0]  # list for counted repeats

for x in t:
h = t.index(x)
for i in s:
if i == x:
m = s.index(i)
c +=1
if s[m+1] != x:  # if next element is not x
if c > li[h]: 
li[h]= c
c = 0

for i in t:
n = t.index(i)
print(i,li[n])

--
Thanks
-- 
https://mail.python.org/mailman/listinfo/python-list


FridayFinking - Was: A beginning beginner's question about input, output and . . .

2021-01-13 Thread dn via Python-list
On 14/01/2021 04.54, Grimble wrote:
> On 11/01/2021 20:37, DonK wrote:
>>
>> Hi, I'm thinking about learning Python but I'm 74 years old and will
>> very likely not ever have a programming job again. 

> At 83, I have no intention of having a programming job again! I last
> coded something professionally 45 years ago, but it hasn't lost its
> attraction.

Hey, some 'silver surfers' who have a few years on me!

Concerning the definition of "old"
- when I'm having a 'good day', it's anyone several years my senior (and
above)
- when I'm creaking and groaning, it's anyone remotely my age, and older.


Of course, many of my colleagues have fairly similar understandings -
for them anyone with the digit "3" (or greater) at the front of their
age, is not so much old (saying that would be rude!), but "ancient"!


That said, such young-bucks wrestling with cloud-concepts today, were
totally nonplussed when I told them how (mainframe) computer bureaux
used to work. The 'mechanics' may be different, but the management is
little-changed!


...

> I find this a fascinating news group - shame there's been no updates to
> Friday Finking recently!


With all due apologies!

I work(ed) with a particular team in a mentoring rôle, handling reviews,
walk-throughs, some design meetings, Python version-upgrades coaching,
etc. One of these was a 'morning tea' meeting, when we would
discuss/debate/argue 'Python best practice' topics, either raised by
members or that arose from other meetings but were best not discussed
there-and-then.

If there was an interesting topic, or one that 'we' hadn't really
settled satisfactorily within the group, I would try to re-frame the
discussion, and consult 'the oracles' here. So, that's the raison d'être
and motivation of the "Friday Finking" series..


Then along came COVID-19, and although this country's response was
amongst the best in the world, the team (and its routines) all-but
fell-apart. Firstly, we had to adjust to working remotely. The effort
that went into 'Friday Finking' was quickly absorbed into figuring-out
remote-techniques and maintaining the social component of the team's
success. Then a bunch of us were 'released to other duties' and
landed-in high-pressure projects to do with modelling pandemic
response-options. Various other interventions, life moved-on, etc, etc -
stories familiar to most, I'm sure.


So, thank you for the gentle reminder. Even though that team is still
not meeting as it once did, there's plenty of other 'inspiration', eg a
parallel discussion 'here' about the virtues of a programmer positioning
dialog(ue)s/windows or leaving it to the window manager...


I'll give it some thought - as long as Fridays keep coming!
-- 
Regards =dn
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41490] Update bundled pip to 20.2.1 and setuptools to 49.2.1

2021-01-13 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

> Why do we keep setuptools?

I agree; would be good to remove it if possible.

There are many packages that fail to build without Setuptools being present or 
--use-pep517 indicated. It would be nice if pip could make --use-pep517 the 
default, update that in Python, and then remove Setuptools. I would expect that 
approach will cause a great deal less turmoil in the ecosystem.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40956] Use Argument Clinic in sqlite3

2021-01-13 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset a330365ca5ae836075f306334ab648bf23471481 by Erlend Egeberg 
Aasland in branch 'master':
bpo-40956: Fix sqlite3.Cursor.fetchmany() default value (GH-24214)
https://github.com/python/cpython/commit/a330365ca5ae836075f306334ab648bf23471481


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42915] enum.Flag ~ bitwise negation is very slow and can't be defined as a Flag value

2021-01-13 Thread Ethan Furman


Ethan Furman  added the comment:

Yes.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: learning python building 2nd app, need advices

2021-01-13 Thread Phil Boutros
Loris Bennett  wrote:

> As an Emacs user, personally I would use the command 
>
>   M-x untabify
>
> within Emacs.  I assume that Vim has something similar.

It does.  ':retab' is what you want.  If you have tabstop set to a
specific value, it'll use that.  If not, you can do ':retab ',
where  is an integer defining how many spaces to replace a tab
with.

Don't add the quote symbols ('), I added it for readability!

As others have mentionned, 'expand' from the shell also works. 

Phil
-- 
AH#61  Wolf#14  BS#89  bus#1  CCB#1  SENS  KOTC#4
ph...@philb.ca  http://philb.ca
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: conceptual problem (was: A beginning beginner's question about input, output and . . .

2021-01-13 Thread Cameron Simpson
On 13Jan2021 10:37, songbird  wrote:
>  my momentary conceptual problem is that to me OOP means
>being able to encapsulate data structures and code from
>other parts of the program, but to me it doesn't look like
>that is how python is designed.  this is probably a complete
>aside to this whole thread and perhaps even this newsgroup
>so i'll subthread this.

Python allows you to avoid mucking with the object internals from 
outside. But it doesn't prevent it.

So you can (and often should) adopt an OOP approach - it reduces the 
dependencies between your classes, with the benefits that brings.

The "pure" OOP approach, where method calls are used as messages to set 
or fetch aspects of the object, is usually does with getter and setter 
methods like:

x = o.getX()
o.setX(9)

In Python this is less common. Simple things like that which do not 
intrude much on the conceptual model (i.e. if all such things will have 
an "X") are usually exposed as a public attribute which you can get or 
set directly:

x = o.x
o.x = 9

"Public" attributes in Python are just a convention: we name "private" 
attributes with a leading underscore and "public" attributes with 
leading letters and expect people using our classes to behave well.

Sometime we _don't_ have a plain old attribute "x", but we do have a 
property of the object looking like it. Then you can implement something 
which looks like an attribute from outside:

@property
def x(self):
# "x" if a derived value
return self._a + self._b

@x.setter
def x(self, new_x):
# setting "x" gets split between _a and _b
x2 = x / 3
self._a = x2# put some in _a
self._b = x - x2# put the rest in _b

# you can still do this, but it calls methods now
x = o.x
o.x = 9

So Python supports OOP practices but doesn't enforce them. Adopt the 
degree of discipline you think best.

Cheers,
Cameron Simpson 
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33809] Expose `capture_locals` parameter in `traceback` convenience functions

2021-01-13 Thread Irit Katriel

Irit Katriel  added the comment:

I’m not sure I agree that it’s a big win.
You can always add such a utility function in your code.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33809] Expose `capture_locals` parameter in `traceback` convenience functions

2021-01-13 Thread Ulrich Petri


Ulrich Petri  added the comment:

Functionally equivalent code would be:

print("".join(TracebackException.from_exception(ex, 
capture_locals=True).format()))

vs. (hypothetically)

print_exc(capture_locals=True)

Which is quite a significant difference IMO.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42915] enum.Flag ~ bitwise negation is very slow and can't be defined as a Flag value

2021-01-13 Thread Kevin Chen


Kevin Chen  added the comment:

Awesome thanks! Does the rewrite fix the issue with creating negated flags as 
well?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: A beginning beginner's question about input, output and . . .

2021-01-13 Thread Peter Pearson
On Mon, 11 Jan 2021 15:37:58 -0500, DonK  wrote:
[snip]
>
> I've seen some Python gui frameworks like Tkinter, PyQt, etc. but they
> look kinda like adding a family room onto a 1986 double wide mobile
> home, 

Agreed.

Browsergui is not widely popular (I don't think anybody but me has
mentioned it on this newsgroup), but it was written to be simple and
Pythonic, and has served me well.  Browsergui just uses your browser as
its user interface.  Grab it from

https://github.com/speezepearson/browsergui

then run "python -m browsergui.examples".

(Disclaimer/boast: I'm related to Browsergui's author.)

-- 
To email me, substitute nowhere->runbox, invalid->com.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue42925] Error trace of else inside class

2021-01-13 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy: +Mark.Shannon

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40956] Use Argument Clinic in sqlite3

2021-01-13 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +23041
pull_request: https://github.com/python/cpython/pull/24214

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40956] Use Argument Clinic in sqlite3

2021-01-13 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

Thanks, but I prefer the following:

size as maxrows: int(c_default='self->arraysize', 
py_default='') = 1

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28146] Confusing error messages in str.format()

2021-01-13 Thread Irit Katriel


Irit Katriel  added the comment:

My PR fixes the second case ('{: }') and Serhiy's PR on Issue27772 fixes the 
first case ('{:04}').

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28146] Confusing error messages in str.format()

2021-01-13 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +patch
nosy: +iritkatriel
nosy_count: 4.0 -> 5.0
pull_requests: +23040
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24213

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

2021-01-13 Thread Guido van Rossum


Guido van Rossum  added the comment:

> "The implementation is allowed to skip any boolean test of a value, when it 
> has *no* effect on the flow of the program and at least one test has already 
> been performed on that value."

+1

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

2021-01-13 Thread Steve Stagg


Steve Stagg  added the comment:

Sounds great to me (with my approximately zero optimizer experience)

At risk of taking this too far, you /could/ add something like:

"skip any boolean test of a value _immediately_ following another boolean test, 
when it has no ..."

to this spec/guidance/whatever it is.

Just to prevent the risk of the `if` block being removed in future in 
ridiculous code like the following:

try:
  while True:
a = x or y
a.pop()
if a:
  pass
except XIsEmptyError:
  ...

(I'm guessing we're pretty far from being able to rewrite enough for this to be 
a remotely credible optimization candidate anytime soon anyway)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

2021-01-13 Thread Mark Shannon


Mark Shannon  added the comment:

I missed a "no" in the above, which somewhat changed the meaning!

It should have read:

"The implementation is allowed to skip any boolean test of a value, when it has 
*no* effect on the flow of the program and at least one test has already been 
performed on that value."

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

2021-01-13 Thread Mark Shannon


Mark Shannon  added the comment:

The problem with using a specific syntax example, is that the optimizer doesn't 
work that way. It works on the CFG.

Any specification needs to be phrased in terms of general control flow, as 
other optimizations can enable this transformation.
e.g. 

if x or True:
do_something()

is (in master) transformed to:

x
do_something()

I think your earlier suggestion of
"So I think dropping an *extra* call is fine, while dropping the *only* call is 
not."
is the best way to preserve 3.9 behavior.
It can be formalised as:
"The implementation is allowed to skip any boolean tests of a value, when it 
has effect on the flow of the program and at least one test has already been 
performed on that value."

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39934] Fatal Python error "XXX block stack overflow" when exception stacks >10

2021-01-13 Thread Mark Shannon


Change by Mark Shannon :


--
nosy: +lukasz.langa

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34705] Python 3.8 changes how returns through finally clauses are traced

2021-01-13 Thread Mark Shannon

Mark Shannon  added the comment:

In master, the sequence of events is:

1 call
2 line
3 line
returning
4 line
6 line
finally
6 return

which is the same as 3.7.
I now believe this is the correct trace, as the language spec states:

When a return, break or continue statement is executed in the try suite of a 
try…finally statement, the finally clause is also executed ‘on the way out.’

So line 6 should be last line traced.

--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42924] bytearray_repeat copies from ob_bytes instead of ob_start

2021-01-13 Thread miss-islington


Change by miss-islington :


--
pull_requests: +23039
pull_request: https://github.com/python/cpython/pull/24212

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42924] bytearray_repeat copies from ob_bytes instead of ob_start

2021-01-13 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +23038
pull_request: https://github.com/python/cpython/pull/24211

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42924] bytearray_repeat copies from ob_bytes instead of ob_start

2021-01-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 61d8c54f43a7871d016f98b38f86858817d927d5 by Tobias Holl in branch 
'master':
bpo-42924: Fix incorrect copy in bytearray_repeat (GH-24208)
https://github.com/python/cpython/commit/61d8c54f43a7871d016f98b38f86858817d927d5


--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

2021-01-13 Thread Guido van Rossum

Guido van Rossum  added the comment:

Is anyone still in favor of eliminating the __bool__ call from ‘if p: pass’?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: A beginning beginner's question about input, output and . . .

2021-01-13 Thread songbird
Christian Gollwitzer wrote:
> Am 13.01.21 um 06:24 schrieb Greg Ewing:
>> On 13/01/21 4:18 am, Grant Edwards wrote:
>> 
>>> AFAIK, Python can't be used to write device drivers for any popular OS
>> 
>> At least not until some crazy person embeds Python in the
>> Linux kernel...
>
>
>   What do you mean, "until" ?
>
> https://medium.com/@yon.goldschmidt/running-python-in-the-linux-kernel-7cbcbd44503c
>
> http://www.kplugs.org/

  yes!  haha!  :)  love it!  wish i had time to play now.


  songbird
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A beginning beginner's question about input, output and . . .

2021-01-13 Thread Grimble

On 11/01/2021 20:37, DonK wrote:


Hi, I'm thinking about learning Python but I'm 74 years old and will
very likely not ever have a programming job again. 
At 83, I have no intention of having a programming job again! I last 
coded something professionally 45 years ago, but it hasn't lost its 
attraction.

So, what do you folks use Python for?

I have several scripts to help with activities for the charity that 
keeps me occupied. I've written a shopping list script with 
auto-completion and a couple of web-scraping applications that support a 
weather reporting application interfacing with various 1Wire sensors 
transcribed from an initial Ruby application. My largest GUI application 
is a database of personal contacts with input and output of data via 
vCards and .csv files (with a lot of mentoring from an American Gtk user!)
I find this a fascinating news group - shame there's been no updates to 
Friday Finking recently!


--
Grimble
Registered Linux User #450547
Machine 'Bach' running Plasma 5.15.4 on 5.7.19-desktop-3.mga7 kernel.
Mageia release 7 (Official) for x86_64


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


conceptual problem (was: A beginning beginner's question about input, output and . . .

2021-01-13 Thread songbird
Chris Angelico wrote:
...projects that fade...
> That's not really something Python can ever control, but I can say
> with some confidence that the big libraries like Qt and GTK are going
> to adapt, one way or another. And perhaps more importantly: Neither
> input()/print() nor web applications is going *anywhere*. You are
> ALWAYS going to have those two as options.

  :)  i hope so. :)

  at the moment i've only done things with GTK and pyglet.
since i am way too new at python i can't say the code is
pretty, but it does work.

  my momentary conceptual problem is that to me OOP means
being able to encapsulate data structures and code from
other parts of the program, but to me it doesn't look like
that is how python is designed.  this is probably a complete
aside to this whole thread and perhaps even this newsgroup
so i'll subthread this.


  songbird
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue2506] Add mechanism to disable optimizations

2021-01-13 Thread Mark Shannon


Mark Shannon  added the comment:

In general, it is hard to define what is an optimization, and what is part of 
the compiler.

The original request was to disable optimizations that changed observable 
behavior w.r.t. line numbers.

All optimizations now respect line numbers, so proposed mechanism would be 
pointless.

--
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42926] Split compiler into code-gen, optimizer and assembler.

2021-01-13 Thread Guido van Rossum

Guido van Rossum  added the comment:

SGTM. But I’m not the one who has to work with it.

--
nosy: +gvanrossum

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39934] Fatal Python error "XXX block stack overflow" when exception stacks >10

2021-01-13 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

> Pablo, are you OK closing this without a 3.8 backport?

I would be supportive, but we should check with Łukasz as he is the release 
manager of 3.8

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42693] "if 0:" lines are traced; they didn't use to be

2021-01-13 Thread Mark Shannon


Mark Shannon  added the comment:

Unless anyone objects, I'm going to close this issue.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

2021-01-13 Thread Steve Stagg


Steve Stagg  added the comment:

Oops, sorry, didn't realise there were such rules.  

The reasoning for me making the change to the title is that that the original 
PR didn't mention skipping actual condition logic, but does mention skipping 
unreachable blocks, with the examples provided (either by accident or intent) 
showing cases where the condition was still included.

I thus assumed the change that has been implemented had bad unintended 
side-effects (a bug), so wanted to capture that and, if any consensus on 
allowing the optimizer to skip bool() calls is ever reached on the mailing 
list, an explicit issue would be raised to cover that change.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39934] Fatal Python error "XXX block stack overflow" when exception stacks >10

2021-01-13 Thread Mark Shannon


Mark Shannon  added the comment:

Pablo, are you OK closing this without a 3.8 backport?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: A beginning beginner's question about input, output and . . .

2021-01-13 Thread Grimble

On 11/01/2021 20:37, DonK wrote:




So, what do you folks use Python for?


I've written a shopping list script with auto-completion and a couple of 
web-scraping applications that support a weather reporting application 
interfacing with various 1Wire sensors transcribed from an initial Ruby 
application. My largest GUI application is a database of personal 
contacts with input and output of data via vCards and .csv files (with a 
lot of mentoring from an American Gtk user!)
I find this a fascinating news group - shame there's been no updates to 
Friday Finking recently


--
Grimble
Registered Linux User #450547
Machine 'Bach' running Plasma 5.15.4 on 5.7.19-desktop-3.mga7 kernel.
Mageia release 7 (Official) for x86_64
--
https://mail.python.org/mailman/listinfo/python-list


[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

2021-01-13 Thread Mark Shannon


Change by Mark Shannon :


--
title: Is it legal to eliminate tests of a value, when that test has no effect 
on control flow -> Is it legal to eliminate tests of a value, when that test 
has no effect on control flow?

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow

2021-01-13 Thread Mark Shannon


Mark Shannon  added the comment:

Steve,
Please don't change the title of the issue.

Sure, the optimizer is "inconsistent".
Optimizations are applied in some cases, and not in others.
That's just how compilers work.

The issue here is whether the optimizer is allowed to skip the call to 
__bool__() if the result doesn't effect the observable effect of running the 
program.

--
title: Inconsistent elimination of empty blocks by optimizer causes 
__bool__calls to be skipped in some exception handling scenarios -> Is it legal 
to eliminate tests of a value, when that test has no effect on control flow

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39934] Fatal Python error "XXX block stack overflow" when exception stacks >10

2021-01-13 Thread Irit Katriel


Irit Katriel  added the comment:

There were additional merge conflicts when I tried to create a manual 3.8 
backport, more significant than the 3.9 ones IIRC.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40956] Use Argument Clinic in sqlite3

2021-01-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Use NULL.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39934] Fatal Python error "XXX block stack overflow" when exception stacks >10

2021-01-13 Thread Mark Shannon


Mark Shannon  added the comment:

Does this need backporting to 3.8, or is 3.9 sufficient?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42914] pprint numbers with underscore

2021-01-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

>>> format(10**9, '_d')
'1_000_000_000'

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42926] Split compiler into code-gen, optimizer and assembler.

2021-01-13 Thread Mark Shannon


New submission from Mark Shannon :

Currently the compiler operates in three main passes:

Code-gen
Optimize
Assemble

The problem is that these passes use the same basic-block based CFG, leading to 
unnecessary coupling and inefficiencies.
A basic block CFG is awkward and error-prone for the code-gen, but not very 
efficient for the optimizer and assembler.

A better design would be for the code-gen to create a single linear sequence of 
instructions. The optimizer would take this and produce a list of 
extended-blocks for the assembler to consume.

code-gen -> (list of instructions) -> optimizer
optimizer -> (list of extended blocks) -> assembler

(Extended blocks have a single entry and multiple exits, unlike basic blocks 
which have a single entry and single exit)

This would:
1. Reduce memory use considerably (the size of instruction and block data 
structures would be about 60% of current)
2. Be faster (Less CFG management).
3. Produce better code (extended blocks are a better unit for optimization that 
basic blocks).
4. Be easier to maintain:
  a) Code-gen wouldn't have to worry about creating a correct CFG.
  b) The optimizer wouldn't need to handle empty blocks and track which basic 
blocks form an extended block.


Apart from the changes to the compiler, it would help if we made all branch 
instructions absolute (or have a backward dual) to accommodate free reordering 
of blocks in the optimizer.

--
messages: 385033
nosy: Mark.Shannon
priority: normal
severity: normal
status: open
title: Split compiler into code-gen, optimizer and assembler.

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42856] ensurepip: add configure --with-wheel-pkg-dir=PATH to get wheel packages from a system directory

2021-01-13 Thread Miro Hrončok

Miro Hrončok  added the comment:

In Fedora, we update the wheels independently without rebuilding Python.

What incredible convoluted constructs do you have in mind in particular?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42856] ensurepip: add configure --with-wheel-pkg-dir=PATH to get wheel packages from a system directory

2021-01-13 Thread Matej Cepl


Matej Cepl  added the comment:

We (SUSE) have updated versions of the wheels as special Sources, and then this 
in the %prep stage of our SPEC file:

# Replace bundled wheels with the updates ones
rm -v Lib/ensurepip/_bundled/*.whl
cp -v %{SOURCE20} %{SOURCE21} Lib/ensurepip/_bundled/
STVER=$(basename %{SOURCE20}|cut -d- -f2)
PIPVER=$(basename %{SOURCE21}|cut -d- -f2)
sed -E -i -e 
"s/^(\s*_SETUPTOOLS_VERSION\s+=\s+)\"[0-9.]+\"/\1\"${STVER}\"/" \
  -e "s/^(\s*_PIP_VERSION\s+=\s+)\"[0-9.]+\"/\1\"${PIPVER}\"/" \
Lib/ensurepip/__init__.py

A bit of manual work required, but it doesn't lead to so incredible convoluted 
constructs as I see in Fedora (nothing against it, but our build system is 
already convoluted enough).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33809] Expose `capture_locals` parameter in `traceback` convenience functions

2021-01-13 Thread Irit Katriel


Irit Katriel  added the comment:

That said, you can always use 

TracebackException.from_exception(exc, capture_locals=True).format()

which is not much longer than 

print_exception(exc, capture_locals=True)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33809] Expose `capture_locals` parameter in `traceback` convenience functions

2021-01-13 Thread Irit Katriel


Irit Katriel  added the comment:

Sorry, I spoke too soon - see now that the locals are use in the 
StackSummary.format().

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42856] ensurepip: add configure --with-wheel-pkg-dir=PATH to get wheel packages from a system directory

2021-01-13 Thread Matej Cepl


Change by Matej Cepl :


--
nosy: +mcepl

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33809] Expose `capture_locals` parameter in `traceback` convenience functions

2021-01-13 Thread Irit Katriel


Irit Katriel  added the comment:

I don't understand this request. If you ask TracebackExceptions to 
capture_locals then the FrameSummary object gets a dict of the reprs of the 
locals, which can be introspected and participate in __eq__ checks but nothing 
else happens with them. What would the convenience functions do with this 
parameter?

Ulrich, can you explain the use case or how you see this working?

--
nosy: +iritkatriel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42856] ensurepip: add configure --with-wheel-pkg-dir=PATH to get wheel packages from a system directory

2021-01-13 Thread STINNER Victor


STINNER Victor  added the comment:

> For simplicity, I would avoid mixing wheels from 2 different directories.

Right. I wrote PR 24210 which is simpler. It either uses bundled wheels, or 
wheels from the directory.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42856] ensurepip: add configure --with-wheel-pkg-dir=PATH to get wheel packages from a system directory

2021-01-13 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +23037
pull_request: https://github.com/python/cpython/pull/24210

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42908] Incorrect line numbers at end of try-except and with statements containing if False: pass

2021-01-13 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +23036
pull_request: https://github.com/python/cpython/pull/24209

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42922] Enlace a descripción de función 'dir' faltante

2021-01-13 Thread Mariatta


Mariatta  added the comment:

Hi, the Spanish translation for Python docs is managed at  
https://github.com/python/python-docs-es

Can you please open the issue there? Thanks you. Really sorry that I don't 
speak Spanish :( so I'm replying in English.

--
nosy: +Mariatta
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42877] TracebackException saves more data than it needs for format

2021-01-13 Thread Irit Katriel


Change by Irit Katriel :


--
title: TracebackException saves more data than it needs -> TracebackException 
saves more data than it needs for format

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ANN] PyInstaller 4.2

2021-01-13 Thread Hartmut Goebel

Hello,

on behalf of the PyInstaller development team I'm happy to announce
PyInstaller 4.2.

   http://www.pyinstaller.org  

Thanks for all those who contributed questions, bug-reports or
pull-requests.


PyInstaller is in urgent need of funding to make future security fixes
happen, see  for
details.


=== Important Changes ===

Release 4.2 adds support for Python 3.8 and 3.9,
is able to find binary dependencies of Anaconda distributions,
includes fixes for some endless recursion cases (more to be
fixed in the next release), and code for the sw_64 architecture.

Of course there are again quite some bug-fixes and update to core hooks.

This will be the last version supporting Python 3.5.
The last version supporting Python 2.7 was PyInstaller 3.6.

The full changelog for this release can be found at:
https://pyinstaller.readthedocs.io/en/v4.2/CHANGES.html


=== What it is ===

PyInstaller bundles a Python application and all its dependencies into a
single package. The user can run the packaged app without installing a
Python interpreter or any modules.

PyInstaller reads a Python script written by you. It analyzes your code to
discover every other module and library your script needs in order to
execute.
Then it collects copies of all those files – including the active Python
interpreter! – and puts them with your script in a single folder, or
optionally in a single executable file.

PyInstaller is tested against Windows, Mac OS X, and Linux. However, it
is not a cross-compiler: to make a Windows app you run PyInstaller in
Windows; to make a Linux app you run it in Linux, etc. PyInstaller has
been used successfully with AIX, Solaris, and FreeBSD, but is not tested
against them.


=== Help keeping PyInstaller alive ===

Maintaining PyInstaller is a huge amount of work.
PyInstaller development can only continue
if users and companies provide sustainable funding.
Please consider recurring donations.
Seehttp://www.pyinstaller.org/funding.html  for how
to support PyInstaller.


=== Installation ===

PyInstaller can be installed from PyPi using

   pip install pyinstaller

=== Important Changes ===



The full changelog for this release can be found at:

   https://pyinstaller.readthedocs.io/en/v4.0/CHANGES.html


=== Feedback ===

We're eager to listen to your feedback on using PyInstaller:

 Bug tracker:https://github.com/pyinstaller/pyinstaller/issues  

 Mailing list:http://groups.google.com/group/PyInstaller  


--
Schönen Gruß
Hartmut Goebel
Dipl.-Informatiker (univ), CISSP, CSSLP, ISO 27001 Lead Implementer
Information Security Management, Security Governance, Secure Software 
Development


Goebel Consult, Landshut
http://www.goebel-consult.de 

Blog: 
http://www.goebel-consult.de/blog/warum-sie-nicht-perl-programmiern-sollten 
 

Kolumne: 
http://www.cissp-gefluester.de/2012-02-bring-your-own-life-glosse 



___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-archive.com


[issue42924] bytearray_repeat copies from ob_bytes instead of ob_start

2021-01-13 Thread tholl


Change by tholl :


--
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42914] pprint numbers with underscore

2021-01-13 Thread Eric V. Smith


Eric V. Smith  added the comment:

+1 also. I agree with Raymond it should be optional.

--
nosy: +eric.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42925] Error trace of else inside class

2021-01-13 Thread ChenXuan


ChenXuan <522169...@qq.com> added the comment:

another example:
if 1 < 10:
b = 1
if 0:
a = 1
else:
a = 1
output:
1: if 1 < 10:
1: b = 1
1: if 0:
1: a = 1
   else:
   a = 1
Is this a bug or feature?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42924] bytearray_repeat copies from ob_bytes instead of ob_start

2021-01-13 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 1.0 -> 2.0
pull_requests: +23035
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24208

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42925] Error trace of else inside class

2021-01-13 Thread ChenXuan


New submission from ChenXuan <522169...@qq.com>:

Hi, python3.10 seems to give wrong trace here:
class A:
   if 3 < 9:
  a = 1
   else:
  a = 2

result:
2: class A:
1:if 3 < 9:
1:   a = 1
  else:
1:   a = 2
   

command: python3.10 -m trace --count -C . a1.py
environment: Linux 5.8.0-36-generic #40~20.04.1-Ubuntu SMP
version: python3.10.0a4

--
files: a1.py
messages: 385023
nosy: ChenXuan
priority: normal
severity: normal
status: open
title: Error trace of else inside class
versions: Python 3.10
Added file: https://bugs.python.org/file49740/a1.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42908] Incorrect line numbers at end of try-except and with statements containing if False: pass

2021-01-13 Thread Mark Shannon


Change by Mark Shannon :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >