Why does datetime.timedelta only have the attributes 'days' and 'seconds'?
Hi, With Python 3.9.2 I get $ import datetime $ s = "1-00:01:01" $ t = datetime.datetime.strptime(s, "%d-%H:%M:%S") $ d = datetime.timedelta(days=t.day, hours=t.hour, minutes=t.minute, seconds=t.second) $ d.days 1 $ d.seconds 61 $ d.minutes AttributeError: 'datetime.timedelta' object has no attribute 'minutes' Is there a particular reason why there are no attributes 'minutes' and 'hours and the attribute 'seconds' encompasses is the entire fractional day? Cheers, Loris -- This signature is currently under construction. -- https://mail.python.org/mailman/listinfo/python-list
Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?
"Loris Bennett" writes: > Hi, > > With Python 3.9.2 I get > > $ import datetime > $ s = "1-00:01:01" > $ t = datetime.datetime.strptime(s, "%d-%H:%M:%S") > $ d = datetime.timedelta(days=t.day, hours=t.hour, minutes=t.minute, > seconds=t.second) > $ d.days > 1 > $ d.seconds > 61 > $ d.minutes > AttributeError: 'datetime.timedelta' object has no attribute 'minutes' > > Is there a particular reason why there are no attributes 'minutes' and > 'hours and the attribute 'seconds' encompasses is the entire fractional > day? That should read: Is there a particular reason why there are no attributes 'minutes' and 'hours' and the attribute 'seconds' encompasses the entire fractional day? > Cheers, > > Loris -- Dr. Loris Bennett (Herr/Mr) ZEDAT, Freie Universität Berlin Email loris.benn...@fu-berlin.de -- https://mail.python.org/mailman/listinfo/python-list
Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?
I think because minutes and hours can easily be composed by multiplying seconds. days is separate because you cannot compose days from seconds; leap seconds are applied to days at various times, due to irregularities in the Earth's rotation. On Thu, 2022-04-14 at 15:38 +0200, Loris Bennett wrote: > "Loris Bennett" writes: > > > Hi, > > > > With Python 3.9.2 I get > > > > $ import datetime > > $ s = "1-00:01:01" > > $ t = datetime.datetime.strptime(s, "%d-%H:%M:%S") > > $ d = datetime.timedelta(days=t.day, hours=t.hour, > > minutes=t.minute, seconds=t.second) > > $ d.days > > 1 > > $ d.seconds > > 61 > > $ d.minutes > > AttributeError: 'datetime.timedelta' object has no attribute > > 'minutes' > > > > Is there a particular reason why there are no attributes 'minutes' > > and > > 'hours and the attribute 'seconds' encompasses is the entire > > fractional > > day? > > That should read: > > Is there a particular reason why there are no attributes 'minutes' > and > 'hours' and the attribute 'seconds' encompasses the entire > fractional > day? > > > Cheers, > > > > Loris > -- > Dr. Loris Bennett (Herr/Mr) > ZEDAT, Freie Universität Berlin Email > loris.benn...@fu-berlin.de -- https://mail.python.org/mailman/listinfo/python-list
Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?
Additionally, which datatype would you expect them to be returned in? One could argument for int or float (Decimal?), both could be valid datatypes, depending on how exact you might want them, while the second is the time base of SI units. Cheers Lars -- Lars Liedtke Software Entwickler Phone: Fax:+49 721 98993- E-mail: l...@solute.de solute GmbH Zeppelinstraße 15 76185 Karlsruhe Germany Marken der solute GmbH | brands of solute GmbH billiger.de | Shopping.de Geschäftsführer | Managing Director: Dr. Thilo Gans, Bernd Vermaaten Webseite | www.solute.de Sitz | Registered Office: Karlsruhe Registergericht | Register Court: Amtsgericht Mannheim Registernummer | Register No.: HRB 110579 USt-ID | VAT ID: DE234663798 Informationen zum Datenschutz | Information about privacy policy http://solute.de/ger/datenschutz/grundsaetze-der-datenverarbeitung.php Am 14.04.22 um 17:01 schrieb Paul Bryan: I think because minutes and hours can easily be composed by multiplying seconds. days is separate because you cannot compose days from seconds; leap seconds are applied to days at various times, due to irregularities in the Earth's rotation. On Thu, 2022-04-14 at 15:38 +0200, Loris Bennett wrote: "Loris Bennett" writes: Hi, With Python 3.9.2 I get $ import datetime $ s = "1-00:01:01" $ t = datetime.datetime.strptime(s, "%d-%H:%M:%S") $ d = datetime.timedelta(days=t.day, hours=t.hour, minutes=t.minute, seconds=t.second) $ d.days 1 $ d.seconds 61 $ d.minutes AttributeError: 'datetime.timedelta' object has no attribute 'minutes' Is there a particular reason why there are no attributes 'minutes' and 'hours and the attribute 'seconds' encompasses is the entire fractional day? That should read: Is there a particular reason why there are no attributes 'minutes' and 'hours' and the attribute 'seconds' encompasses the entire fractional day? Cheers, Loris -- Dr. Loris Bennett (Herr/Mr) ZEDAT, Freie Universität Berlin Email loris.benn...@fu-berlin.de -- https://mail.python.org/mailman/listinfo/python-list
Functionality like local static in C
In C when you declare a variable static in a function, the variable retains its value between function calls. The first time the function is called it has the default value (0 for an int). But when the function changes the value in a call (for example to 43), the next time the function is called the variable does not have the default value, but the value it had when the function returned. Does python has something like that? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list
Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?
On 2022-04-14, Paul Bryan wrote: > I think because minutes and hours can easily be composed by multiplying > seconds. days is separate because you cannot compose days from seconds; > leap seconds are applied to days at various times, due to > irregularities in the Earth's rotation. That's an argument that timedelta should *not* have a 'days' attribute, because a day is not a fixed number of seconds long (to know how long a day is, you have to know which day you're talking about, and where). It's an undocumented feature of timedelta that by 'day' it means '86400 seconds'. -- https://mail.python.org/mailman/listinfo/python-list
Re: Functionality like local static in C
> On 14 Apr 2022, at 16:28, Cecil Westerhof via Python-list > wrote: > > In C when you declare a variable static in a function, the variable > retains its value between function calls. > The first time the function is called it has the default value (0 for > an int). > But when the function changes the value in a call (for example to 43), > the next time the function is called the variable does not have the > default value, but the value it had when the function returned. > Does python has something like that? You can define variables at the module level and then use global to use them in your function. a_static_var = 42 def func(value): global a_static_var a_static_var = value Barry > > -- > Cecil Westerhof > Senior Software Engineer > LinkedIn: http://www.linkedin.com/in/cecilwesterhof > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
Re: Functionality like local static in C
Am 14.04.2022 um 17:02 schrieb Cecil Westerhof via Python-list: > In C when you declare a variable static in a function, the variable > retains its value between function calls. > The first time the function is called it has the default value (0 for > an int). > But when the function changes the value in a call (for example to 43), > the next time the function is called the variable does not have the > default value, but the value it had when the function returned. > Does python has something like that? > There are several ways to emulate that: ### With a mutable default argument In [1]: def func(var=[-1]): ...: var[0] += 1 ...: return var[0] ...: In [2]: func() Out[2]: 0 In [3]: func() Out[3]: 1 In [4]: func() Out[4]: 2 ### with a callable class In [12]: class Func(): ...: def __init__(self, var=-1): ...: self.var = var ...: ...: def __call__(self): ...: self.var += 1 ...: return self.var ...: In [13]: func = Func() In [14]: func() Out[14]: 0 In [15]: func() Out[15]: 1 In [16]: func() Out[16]: 2 ### with a closure In [29]: def outer(var=-1): ...: def inner(): ...: nonlocal var ...: var += 1 ...: return var ...: return inner ...: In [30]: func = outer() In [31]: func() Out[31]: 0 In [32]: func() Out[32]: 1 In [33]: func() Out[33]: 2 ### with a generator In [2]: def func(init=0, end=3): ...: for var in range(init, end): ...: yield var ...: In [3]: for i in func(): ...: print(i) ...: 0 1 2 HTH -- https://mail.python.org/mailman/listinfo/python-list
Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?
On 2022-04-14 16:22, Jon Ribbens via Python-list wrote: On 2022-04-14, Paul Bryan wrote: I think because minutes and hours can easily be composed by multiplying seconds. days is separate because you cannot compose days from seconds; leap seconds are applied to days at various times, due to irregularities in the Earth's rotation. That's an argument that timedelta should *not* have a 'days' attribute, because a day is not a fixed number of seconds long (to know how long a day is, you have to know which day you're talking about, and where). It's an undocumented feature of timedelta that by 'day' it means '86400 seconds'. When you're working only with dates, timedelta not having a 'days' attribute would be annoying, especially when you consider that a day is usually 24 hours, but sometimes 23 or 25 hours (DST). -- https://mail.python.org/mailman/listinfo/python-list
Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)
On Wed, 13 Apr 2022 at 20:05, Peter J. Holzer wrote: > > On 2022-04-12 21:03:00 +0200, Marco Sulla wrote: > > On Tue, 29 Mar 2022 at 00:10, Peter J. Holzer wrote: > > > They are are about a year apart, so they will usually contain different > > > versions of most packages right from the start. So the Ubuntu and Debian > > > security teams probably can't benefit much from each other. > > > > Well, this is what my updater on Lubuntu says to me today: > > > > Changes for tcpdump versions: > > Installed version: 4.9.3-0ubuntu0.18.04.1 > > Available version: 4.9.3-0ubuntu0.18.04.2 > > > > Version 4.9.3-0ubuntu0.18.04.2: > > > > * SECURITY UPDATE: buffer overflow in read_infile > > - debian/patches/CVE-2018-16301.patch: Add check of > > file size before allocating and reading content in > > tcpdump.c and netdissect-stdinc.h. > > - CVE-2018-16301 > > * SECURITY UPDATE: resource exhaustion with big packets > > - debian/patches/CVE-2020-8037.patch: Add a limit to the > > amount of space that can be allocated when reading the > > packet. > > - CVE-2020-8037 > > > > I use an LTS version. So it seems that Ubuntu benefits from Debian > > security patches. > > Why do you think so? Because the release notes mention debian/patches/*.patch? Of course. > This may be an artefact of the build process. The build tools for .deb > packages expect all kinds of meta-data to live in a subdirectory called > "debian", even on non-debian systems. This includes patches, at least if > the maintainer is using quilt (which AFAIK is currently the recommended > tool for that purpose). And why does the security update package contain metadata about Debian patches, if the Ubuntu security team did not benefit from Debian security patches but only from internal work? > OTOH tcpdump would be one of the those packages where Ubuntu could use a > Debian patch directly [...] It doesn't seem so. This is a fresh new security update: Changes for git versions: Installed version: 1:2.17.1-1ubuntu0.9 Available version: 1:2.17.1-1ubuntu0.10 Version 1:2.17.1-1ubuntu0.10: * SECURITY UPDATE: Run commands in diff users - debian/patches/CVE-2022-24765-*.patch: fix GIT_CEILING_DIRECTORIES; add an owner check for the top-level-directory; add a function to determine whether a path is owned by the current user in patch.c, t/t0060-path-utils.sh, setup.c, compat/mingw.c, compat/mingw.h, git-compat-util.hi, config.c, config.h. - CVE-2022-24765 I checked packages.debian.org and git 2.17 was never on Debian: Package git stretch (oldoldstable) (vcs): fast, scalable, distributed revision control system 1:2.11.0-3+deb9u7: amd64 arm64 armel armhf i386 mips mips64el mipsel ppc64el s390x stretch-backports (vcs): fast, scalable, distributed revision control system 1:2.20.1-1~bpo9+1: amd64 arm64 armel armhf i386 mips mips64el mipsel ppc64el s390x buster (oldstable) (vcs): fast, scalable, distributed revision control system 1:2.20.1-2+deb10u3: amd64 arm64 armel armhf i386 mips mips64el mipsel ppc64el s390x etc. https://packages.debian.org/search?keywords=git -- https://mail.python.org/mailman/listinfo/python-list
Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?
On Thu, 14 Apr 2022 at 19:16, MRAB wrote: > > When you're working only with dates, timedelta not having a 'days' > attribute would be annoying, especially when you consider that a day is > usually 24 hours, but sometimes 23 or 25 hours (DST). I agree. Furthermore, timedelta is, well, a time delta, not a date with a timezone. How could a timedelta take into account DST, leap seconds etc? About the initial question, I think it's a good question. -- https://mail.python.org/mailman/listinfo/python-list
Re: Functionality like local static in C
I've seen people use function attributes for this. ``` Python 3.10.2 (main, Jan 15 2022, 19:56:27) [GCC 11.1.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> def function(): ... print(function.variable) ... function.variable += 1 ... >>> function.variable = 1 >>> function() 1 >>> function() 2 >>> ``` If necessary, the variable can be initialised inside the function too. Kind Regards, Sam Ezeh On Thu, 14 Apr 2022 at 16:36, Sam Ezeh wrote: > > I've seen people use function attributes for this. > ``` > Python 3.10.2 (main, Jan 15 2022, 19:56:27) [GCC 11.1.0] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> def function(): > ... print(function.variable) > ... function.variable += 1 > ... > >>> function.variable = 1 > >>> function() > 1 > >>> function() > 2 > >>> > ``` > > If necessary, the variable can be initialised inside the function too. > > Kind Regards, > Sam Ezeh > > > On Thu, 14 Apr 2022 at 16:26, Cecil Westerhof via Python-list > wrote: > > > > In C when you declare a variable static in a function, the variable > > retains its value between function calls. > > The first time the function is called it has the default value (0 for > > an int). > > But when the function changes the value in a call (for example to 43), > > the next time the function is called the variable does not have the > > default value, but the value it had when the function returned. > > Does python has something like that? > > > > -- > > Cecil Westerhof > > Senior Software Engineer > > LinkedIn: http://www.linkedin.com/in/cecilwesterhof > > -- > > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Functionality like local static in C
Cecil Westerhof writes: > In C when you declare a variable static in a function, the variable > retains its value between function calls. > The first time the function is called it has the default value (0 for > an int). > But when the function changes the value in a call (for example to 43), > the next time the function is called the variable does not have the > default value, but the value it had when the function returned. > Does python has something like that? Others (in particular mirko) have given ways to emulate that functionality. I'll mention that local statics are frequently not found in object oriented languages because member variables can serve much the same function in a more general way. If you think you need a static local variable, ask yourself if what you really need is a class. -- https://mail.python.org/mailman/listinfo/python-list
Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?
On Fri, 15 Apr 2022 at 03:45, Marco Sulla wrote: > > On Thu, 14 Apr 2022 at 19:16, MRAB wrote: > > > > When you're working only with dates, timedelta not having a 'days' > > attribute would be annoying, especially when you consider that a day is > > usually 24 hours, but sometimes 23 or 25 hours (DST). > > I agree. Furthermore, timedelta is, well, a time delta, not a date > with a timezone. How could a timedelta take into account DST, leap > seconds etc? It can't. It's a simple representation of a time period. It is useful for situations where you want to express questions like "from this date/time, wait this long, what will the date/time be?". In the absence of a corresponding timezone-aware datetime object, it cannot possibly acknowledge DST. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Functionality like local static in C
Cecil Westerhof wrote at 2022-4-14 17:02 +0200: >In C when you declare a variable static in a function, the variable >retains its value between function calls. >The first time the function is called it has the default value (0 for >an int). >But when the function changes the value in a call (for example to 43), >the next time the function is called the variable does not have the >default value, but the value it had when the function returned. >Does python has something like that? In "C" a variable designates a storage location; assignment to the variable changes the stored value. In "Python" a variable designates an object. Assignments to the variable do not change the object but the association variable-object. The im|mutability of the object determines whether the object can or cannot have different values. Mutable objects can behave similar to storage locations, e.g. class StaticVariable: def __init__(self, v): self.v = v def set(self, v): self.v = v def get(self): return self.v static_emul = StaticVariable(...) def f(...): ... static_emul.set(...) ... -- https://mail.python.org/mailman/listinfo/python-list
Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?
On Fri, 15 Apr 2022 at 00:54, Loris Bennett wrote: > > Hi, > > With Python 3.9.2 I get > > $ import datetime > $ s = "1-00:01:01" > $ t = datetime.datetime.strptime(s, "%d-%H:%M:%S") > $ d = datetime.timedelta(days=t.day, hours=t.hour, minutes=t.minute, > seconds=t.second) > $ d.days > 1 > $ d.seconds > 61 > $ d.minutes > AttributeError: 'datetime.timedelta' object has no attribute 'minutes' > > Is there a particular reason why there are no attributes 'minutes' and > 'hours and the attribute 'seconds' encompasses is the entire fractional > day? > You can get those by dividing: >>> divmod(d, datetime.timedelta(minutes=1)) (1441, datetime.timedelta(seconds=1)) But the obvious question is: how many minutes ARE there in this time period? I give a response of 1441 (or if you prefer, 1441 + 1/60 or roughly 1441.017), but you might just as reasonably consider that there is one minute. If a good definition could be chosen, it wouldn't be too hard to add a bunch of properties to the timedelta that let you view it in other ways. Otherwise, the easiest way is probably to define yourself a set of units and sequentially divmod: >>> units = {"days": datetime.timedelta(days=1), "hours": >>> datetime.timedelta(hours=1), "minutes": datetime.timedelta(minutes=1), >>> "seconds": datetime.timedelta(seconds=1)} >>> for label, unit in units.items(): ... n, d = divmod(d, unit) ... print(n, label) ... 1 days 0 hours 1 minutes 1 seconds >>> This way, you have full control over which units are "interesting"; for instance, the constructor supports weeks, but a lot of applications won't consider them to be important, and would prefer to see "20 days" than "2 weeks and 6 days". But, as mentioned, adding properties to timedelta would be a relatively benign change, so it could be done if there's enough need and a good definition. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Functionality like local static in C
On Fri, 15 Apr 2022 at 03:53, Sam Ezeh wrote: > > I've seen people use function attributes for this. > ``` > Python 3.10.2 (main, Jan 15 2022, 19:56:27) [GCC 11.1.0] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> def function(): > ... print(function.variable) > ... function.variable += 1 > ... > >>> function.variable = 1 > >>> function() > 1 > >>> function() > 2 > >>> > ``` > > If necessary, the variable can be initialised inside the function too. > Indeed; or you can initialize it with a decorator: def static(**kw): def deco(f): for name, val in kw.items(): setattr(f, name, val) return f return deco @static(variable=1) def function(): print(function.variable) function.variable += 1 There are a good few quirks to the concept of "static variables" though, and how you perceive them may guide your choice of which style to use. For example, what should this do? def outer(): def inner(): static variable = 1 return inner Should it have a single static variable shared among all the closures? If so, you probably want a global. Should each closure have its own static? Then use nonlocal and initialize the variable in outer(). Or what about methods? class Spam: def ham(self): static variable = 1 Shared across them all? Use Spam.variable, which (being attached to the class) is common to all Spam instances. Unique to each instance? Well, that's exactly what object members are, so "self.variable" is perfect. There are other quirks too (like decorated functions that end up wrapped, multiple classes, inheritance, etc etc etc), and honestly, if you don't care about those use cases, go with whichever one seems most convenient at the time :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
RE: Functionality like local static in C
Yes, python has something like that. In fact, two things. 1) Generator. Use a "yield" statement. Every call "yields" a new value. The state of the function (local variables) is remembered from each previous call to the next. 2) In a file, declare a variable to be global. In the function declare global var, so that it will not only read the global but will also write it. That variable does not go away. On the next time the function is called, It will hold whatever value it had when the function finished previously. Joseph S. Teledyne Confidential; Commercially Sensitive Business Data -Original Message- From: Cecil Westerhof Sent: Thursday, April 14, 2022 11:02 AM To: python-list@python.org Subject: Functionality like local static in C In C when you declare a variable static in a function, the variable retains its value between function calls. The first time the function is called it has the default value (0 for an int). But when the function changes the value in a call (for example to 43), the next time the function is called the variable does not have the default value, but the value it had when the function returned. Does python has something like that? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list
Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?
On 2022-04-14, MRAB wrote: > On 2022-04-14 16:22, Jon Ribbens via Python-list wrote: >> On 2022-04-14, Paul Bryan wrote: >>> I think because minutes and hours can easily be composed by multiplying >>> seconds. days is separate because you cannot compose days from seconds; >>> leap seconds are applied to days at various times, due to >>> irregularities in the Earth's rotation. >> >> That's an argument that timedelta should *not* have a 'days' attribute, >> because a day is not a fixed number of seconds long (to know how long >> a day is, you have to know which day you're talking about, and where). >> It's an undocumented feature of timedelta that by 'day' it means '86400 >> seconds'. > > When you're working only with dates, timedelta not having a 'days' > attribute would be annoying, especially when you consider that a day is > usually 24 hours, but sometimes 23 or 25 hours (DST). The second half of your sentence is the argument as to why the first half of your sentence is wrong. The difference between noon on the 26th March 2022 in London and noon on the 27th March 2022 is "1 day" from one point of view but is not "1 day" according to timedelta. -- https://mail.python.org/mailman/listinfo/python-list
Re: No shortcut Icon on Desktop
Am 13.04.2022 um 20:39 schrieb Dennis Lee Bieber: > On Thu, 14 Apr 2022 03:38:11 +1000, Tim Deke declaimed > the following: > >> Dear Sir, >> >> I have successfully downloaded Python into my laptop but the shortcut icon >> is not appearing on the desktop. I am using Windows 10 with the PC >> specifications as per snap shot attached below. Can you advise what to do? >> >> Thank you >> >> Tim Deke >> > Python normally does not create "shortcut icon"s -- one downloads an The Python Windows installer *absolutely* should. I do not know much about (modern) Windows, but one thing I do know is, that most Windows users are confused when after an installation there is no easy way to call the program. I do not understand, why the Windows installer *still* does not create a "Python 3.10" _*or similar*_ folder on the desktop with links to IDLE (with an icon text describing it properly as a Python Editor/IDE), the CHM and some introduction text in it. > installer (which on my system would be saved in %userprofile%\downloads), > and executes the installer (once). Python is not an all-in-one GUI > development environment (ie; it is not something like Lazarus/FreePascal, > Visual Studio, etc.). It is an interpreter for script files and depending > upon how the installer sets up the environment, one may never need to > directly invoke the Python interpreter -- one just invokes .py script files > and the OS activates the correct interpreter. With all due respect, but do you really think that it is useful for a Python beginner to know how to run the bare interpreter? ;-) Wouldn't it be much better to educate them about IDLE which can be found in the "Startmenu"? -- https://mail.python.org/mailman/listinfo/python-list
Re: No shortcut Icon on Desktop
On 2022-04-14, Mirko via Python-list wrote: >> Python normally does not create "shortcut icon"s -- one downloads an > > The Python Windows installer *absolutely* should. Agreed. I'm not much of a Windows user, but I do maintain a few Windows applications with installers. They all create desktop shortcuts by default. There's a checkbox for it, and the user can uncheck it. In my experience, if an installer doesn't create a desktop shortcut by default, it just generates a lot of support calls about the installer not working or how do you run the program? Expecting people to go read some documentation on how to run a program, or even expecting them to look through the start menu is asking for headaches. That said, I don't really have much skin in this game since I neither use nor help maintain the windows installer. I do sometimes try to respond to the "installer is broken" or "how do I run it" posts, but I've mostly given up on that. -- Grant -- https://mail.python.org/mailman/listinfo/python-list
Re: error of opening Python
that is not an error, its simply the python console intrepeter -- https://mail.python.org/mailman/listinfo/python-list
Re: No shortcut Icon on Desktop
On 4/14/22 2:42 PM, Mirko via Python-list wrote: Am 13.04.2022 um 20:39 schrieb Dennis Lee Bieber: On Thu, 14 Apr 2022 03:38:11 +1000, Tim Deke declaimed the following: Dear Sir, I have successfully downloaded Python into my laptop but the shortcut icon is not appearing on the desktop. I am using Windows 10 with the PC specifications as per snap shot attached below. Can you advise what to do? Thank you Tim Deke Python normally does not create "shortcut icon"s -- one downloads an The Python Windows installer *absolutely* should. I do not know much about (modern) Windows, but one thing I do know is, that most Windows users are confused when after an installation there is no easy way to call the program. I do not understand, why the Windows installer *still* does not create a "Python 3.10" _*or similar*_ folder on the desktop with links to IDLE (with an icon text describing it properly as a Python Editor/IDE), the CHM and some introduction text in it. installer (which on my system would be saved in %userprofile%\downloads), and executes the installer (once). Python is not an all-in-one GUI development environment (ie; it is not something like Lazarus/FreePascal, Visual Studio, etc.). It is an interpreter for script files and depending upon how the installer sets up the environment, one may never need to directly invoke the Python interpreter -- one just invokes .py script files and the OS activates the correct interpreter. With all due respect, but do you really think that it is useful for a Python beginner to know how to run the bare interpreter? ;-) Wouldn't it be much better to educate them about IDLE which can be found in the "Startmenu"? I think the issue is that the 'python' interpreter/compiler isn't the sort of program that makes sense to make a desktop icon for, as it is a command line utility. Perhaps making an icon for IDLE, if it has also been installed, but then the issue becomes would people recognize 'IDLE' as 'Python' to click on. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list
Re: No shortcut Icon on Desktop
On 4/14/22 17:08, Richard Damon wrote: > I think the issue is that the 'python' interpreter/compiler isn't the > sort of program that makes sense to make a desktop icon for, as it is a > command line utility. > > Perhaps making an icon for IDLE, if it has also been installed, but then > the issue becomes would people recognize 'IDLE' as 'Python' to click on. I think so, the current icon has the Python logo superimposed on what looks like a page of code. -- https://mail.python.org/mailman/listinfo/python-list
Re: No shortcut Icon on Desktop
On 2022-04-14, Richard Damon wrote: > I think the issue is that the 'python' interpreter/compiler isn't the > sort of program that makes sense to make a desktop icon for, as it is a > command line utility. Yes, it is a command line utility. Why does that mean you shouldn't have a desktop shortcut for it? I start up a python REPL prompt in a terminal often enough that were I a windows users, I would probably want a desktop shortcut for it. It would at least let people know that something got installed and show them what a Python is. If they don't want/use that shortcut, it's trivial to delete it. -- Grant -- https://mail.python.org/mailman/listinfo/python-list
Re: No shortcut Icon on Desktop
On 4/14/22 18:06, Grant Edwards wrote: > On 2022-04-14, Richard Damon wrote: > >> I think the issue is that the 'python' interpreter/compiler isn't the >> sort of program that makes sense to make a desktop icon for, as it is a >> command line utility. > > Yes, it is a command line utility. Why does that mean you shouldn't > have a desktop shortcut for it? > > I start up a python REPL prompt in a terminal often enough that were I > a windows users, I would probably want a desktop shortcut for it. > > It would at least let people know that something got installed and > show them what a Python is. If they don't want/use that shortcut, it's > trivial to delete it. > > -- > Grant > > easy to add - it's a windows thing, not a python thing. you can navigate to the install directory and create a shortcut and drag that out of that directiory in explorer and drop it on the desktop. or you can navigate through the start menu, and when you get to the thing you want, pick open folder and then you can create a shortcut and drag off to the desktop. -- https://mail.python.org/mailman/listinfo/python-list