Re: weirdness with list()

2021-03-01 Thread Cameron Simpson
On 01Mar2021 00:06, MRAB  wrote:
>I'm not seeing a huge problem here:
>
>Python 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC v.1928 
>64 bit (AMD64)] on win32
>Type "help", "copyright", "credits" or "license" for more information.
 import time
 class A:
>... def __len__(self):
>... return 1024**3
>... def __iter__(self):
>... yield from ()
>...
 a = A()
 len(a)
>1073741824
 s = time.time()
 list(a)
>[]
 print(time.time() - s)
>0.16294455528259277

3.9.1 on MacOS: 14.529589891433716
3.9.2 on MacOS: instant again

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


Re: weirdness with list()

2021-03-01 Thread Grant Edwards
On 2021-03-01, Greg Ewing  wrote:
> On 28/02/21 1:17 pm, Cameron Simpson wrote:
>> [its length in bytes] is presented via the object's __len__ method,
>
>> BUT... It also has a __iter__ value, which like any Box iterates over
>> the subboxes.
>
> You're misusing __len__ here. If an object is iterable and
> also has a __len__, its __len__ should return the number of
> items you would get if you iterated over it. Anything else
> is confusing and can lead to trouble, as you found here.

That was certainly my reaction. Can you imagine the confusion if len()
of a list returned the number of bytes required for srorage insttead
of the number of elements?

>> But is there a cleaner way to do this?
>
> Yes. Give up on using __len__ to get the length in bytes,
> and provide another way to do that.



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


yield from () Was: Re: weirdness with list()

2021-03-01 Thread Alan Gauld via Python-list
On 28/02/2021 00:17, Cameron Simpson wrote:

> BUT... It also has a __iter__ value, which like any Box iterates over 
> the subboxes. For MDAT that is implemented like this:
> 
> def __iter__(self):
> yield from ()

Sorry, a bit OT but I'm curious. I haven't seen
this before:

yield from ()

What is it doing?
What do the () represent in this context?

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


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


is not recognized as an internal or external command, operable program or batch file.

2021-03-01 Thread singh.veer99999--- via Python-list
   Dear Sir/Madam

   Sir I am facing the issue from 10 days. And I tried all the ways to remove
   this or to come out of this problem
   but as i try to install some PYTEST or OPENPYXL packages using pip it
   gives the notification that there is no writeable path present due to that
   I am not “is not recognized as an internal or external command, operable
   program or batch file.”  I am facing problem in running the test cases in
   Pycharm for the PYTEST
   please help me pls

    

    

   Sent from [1]Mail for Windows 10

    

References

   Visible links
   1. https://go.microsoft.com/fwlink/?LinkId=550986
-- 
https://mail.python.org/mailman/listinfo/python-list


grc 1.12 released

2021-03-01 Thread garabik-news-2005-05

This is generic colouriser, version 1.12

grc is a colouriser configured by regular expressions, including
a simple command line wrapper for some commonly used unix commands.

Notable changes in this version:
  - add several configuration files
  - pass invalid UTF-8 unchanged, if possible
  - fix other minor bugs

License: GPL (any version)

URL: http://kassiopeia.juls.savba.sk/~garabik/software/grc.html

-- 
 ---
| Radovan Garabík http://kassiopeia.juls.savba.sk/~garabik/ |
| __..--^^^--..__garabik @ kassiopeia.juls.savba.sk |
 ---
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: try to install Python3.9.2 / setup failed

2021-03-01 Thread manfred . schmidt

Hello Python Team,

i tried to install SW above; the installation stopped with the
message
"one or more issues caused the setup to fail.
Please the issues and then retry

0x80070642 installation stopped by user"

What must i do go get the SW installed?
Windows 10, file "python-3.9.2-amd64.exe"

Best Regards from Lake of Constance
Manfred Schmidt

log-file:
[3314:32E8][2021-03-01T18:44:04]i001: Burn v3.11.1.2318, Windows v10.0 
(Build 19041: Service Pack 0), path: C:\Users\Manfred 
Schmidt\AppData\Local\Temp\{2E17A51D-2D6F-45A4-A0FE-7965AAB86107}\.cr\python-3.9.2-amd64.exe
[3314:32E8][2021-03-01T18:44:04]i000: Initializing string variable 
'ActionLikeInstalling' to value 'Installing'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing string variable 
'ActionLikeInstallation' to value 'Setup'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing string variable 
'ShortVersion' to value '3.9'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'ShortVersionNoDot' to value '39'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing string variable 
'WinVer' to value '3.9'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'WinVerNoDot' to value '39'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'InstallAllUsers' to value '0'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'InstallLauncherAllUsers' to value '1'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing string variable 
'TargetDir' to value ''
[3314:32E8][2021-03-01T18:44:04]i000: Initializing string variable 
'DefaultAllUsersTargetDir' to value 
'[ProgramFiles64Folder]Python[WinVerNoDot]'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing string variable 
'TargetPlatform' to value 'x64'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing string variable 
'DefaultJustForMeTargetDir' to value 
'[LocalAppDataFolder]Programs\Python\Python[WinVerNoDot]'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing string variable 
'OptionalFeaturesRegistryKey' to value 
'Software\Python\PythonCore\[WinVer]\InstalledFeatures'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing string variable 
'TargetDirRegistryKey' to value 
'Software\Python\PythonCore\[WinVer]\InstallPath'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing string variable 
'DefaultCustomTargetDir' to value ''
[3314:32E8][2021-03-01T18:44:04]i000: Initializing string variable 
'InstallAllUsersState' to value 'enabled'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing string variable 
'InstallLauncherAllUsersState' to value 'enabled'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing string variable 
'CustomInstallLauncherAllUsersState' to value 
'[InstallLauncherAllUsersState]'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing string variable 
'TargetDirState' to value 'enabled'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing string variable 
'CustomBrowseButtonState' to value 'enabled'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'Include_core' to value '1'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'Include_exe' to value '1'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'Include_dev' to value '1'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'Include_lib' to value '1'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'Include_test' to value '1'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'Include_doc' to value '1'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'Include_tools' to value '1'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'Include_tcltk' to value '1'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'Include_pip' to value '1'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'Include_launcher' to value '-1'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing string variable 
'Include_launcherState' to value 'enabled'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'Include_symbols' to value '0'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'Include_debug' to value '0'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'LauncherOnly' to value '0'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'DetectedLauncher' to value '0'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'DetectedOldLauncher' to value '0'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'AssociateFiles' to value '1'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'Shortcuts' to value '1'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'PrependPath' to value '0'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'CompileAll' to value '0'
[3314:32E8][2021-03-01T18:44:04]i000: Initializing numeric variable 
'SimpleInstall' to value '0'
[3314:32E8][202