Re: installation problem
On Thu, 24 Oct 2019 at 00:50, fateme jbr wrote: > > Dear Python team > > I have installed Python 3.7.4 on windows 10. I have access to IDLE and I > can run simple programs, but when I type python in command window nothing > happens. I wanna install pip and afterward some libraries and it is when > the problem occurs. > > why doesn't prompt window recognize python. What shall I do? You probably didn't choose "add Python to your PATH" when installing (it's an option, that's off by default). You can manually add Python to your PATH (if you don't know how to do this, there are plenty of resources that can help - it's a fairly basic thing you need to be aware of if you're using the command line), or you can reinstall, or "repair" your installation and select the option. Or you can use the Python launcher, py.exe, which is on PATH and which will launch Python for you: * Run python: py * Run pip: py -m pip Paul -- https://mail.python.org/mailman/listinfo/python-list
graphics with python
Hello Can you show me the correct way to programming with graphics? I want to take some action detection, for instance, recognize dancing etc. Thanks, Maggie -- https://mail.python.org/mailman/listinfo/python-list
Pytthon 3.8.0 Installation failed
Hi, I got an issues while installing python 3.8.0. If I choose to install Python 3.8.0 using default configuration, then everything is going well. However, if I choose to install it using customized settings, e.g., installation folder being “c:\python38”, and “Download debugging symbols” and “Download debug binaries”, then it failed. I have attached the log file for your reference. Could you please help me out of this issue? Thank you very much. Kind Regards, Richard -- https://mail.python.org/mailman/listinfo/python-list
Re: graphics with python
On Thu, 24 Oct 2019 16:06:21 +0800, Maggie Q Roth wrote: [snip] > Can you show me the correct way to programming with graphics? > > I want to take some action detection, for instance, recognize dancing etc. That description of your goals is very vague. The more specific you can be about what you want to do, the more likely you are to get a helpful response. "Programming with graphics" sounds like drawing charts, or graphs, or pictures, or games. "Recognize dancing etc." sounds like image processing, maybe involving huge neural networks. The most useful thing you could provide would be a statement of the form, "I want to produce software that will take X as input and produce output Y." -- To email me, substitute nowhere->runbox, invalid->com. -- https://mail.python.org/mailman/listinfo/python-list
Re: Instantiating sub-class from super
On 2019-10-19 12:37 AM, DL Neil via Python-list wrote: On 16/10/19 6:33 PM, Frank Millman wrote: On 2019-10-14 10:55 PM, DL Neil via Python-list wrote: Is there a technique or pattern for taking a (partially-) populated instance of a class, and re-creating it as an instance of one of its sub-classes? Here is a link to an article entitled 'Understanding Hidden Subtypes'. It dates back to 2004, but I think it is still relevant. It addresses precisely the issues that you raise, but from a data-modelling perspective, not a programming one. http://tdan.com/understanding-hidden-subtypes/5193 I found it invaluable, and applied the concepts in my own business/accounting application. Having created the ability to make subtypes visible and explicit, I found all kinds of unexpected uses for them. The article seems to be missing a couple of images (Figure 1 and Figure 2) showing the data relationships. I downloaded the original article onto my computer years ago, and my local copy does have the images, so if you would like to see them let me know and I will upload my version somewhere to make it accessible. Superb! Yes please Frank - I've also approached it from the data/DB side, and thus presumably why I was puzzling over how one implements in Python. (alternatively, email a PDF/similar directly) Hi I have just got back from a few days break and have only seen your message now. Did you see the message I posted on the 17th with a download link? If not, would you like me to post it again? Frank -- https://mail.python.org/mailman/listinfo/python-list
Congratulations to @Chris
Chris Angelico: [PSF's] 2019 Q2 Community Service Award Winner http://pyfound.blogspot.com/2019/10/chris-angelico-2019-q2-community.html ...and for the many assistances and pearls of wisdom he has contributed 'here'! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list
Re: Congratulations to @Chris
On Fri, Oct 25, 2019 at 7:20 AM DL Neil via Python-list wrote: > > Chris Angelico: [PSF's] 2019 Q2 Community Service Award Winner > http://pyfound.blogspot.com/2019/10/chris-angelico-2019-q2-community.html > > ...and for the many assistances and pearls of wisdom he has contributed > 'here'! Thanks! It's been great hanging out on these channels/lists/whatever you call 'here'. I originally joined python-list in relation to a project that moved away from Python, then got badly bogged down in everyone's favourite problem, scope creep. And then it died. But in the meantime, I was very much appreciating the community here, and both learning and contributing. It's been an awesome ride, and I've learned so much from so many people here. So, a big thank you to all the regulars here - you know who you are - and also to the occasional contributors too. (I feel like I'm thanking everyone at the end of a live stream or something, but it's true - lurkers are important too.) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
How to debug asyncio.exceptions.CancelledError?
I'm using a library for Django Channels that I've somehow misconfigured and is causing asyncio.exceptions.CancelledError when trying to connect a websocket. Because of how the stack isn't particularly straightforward with asyncio I'm at a loss to debug this. Any tips to find out what's going on? Reference to other questions in other fora that are related: GitHub issue: https://github.com/datadvance/DjangoChannelsGraphqlWs/issues/28 Django-Users: https://groups.google.com/forum/#!topic/django-users/lSBYzKZ3sFE -- https://mail.python.org/mailman/listinfo/python-list
Blasphemy
What about, if Python would have optional end keyword. In fact most of blocks have starting : sign. What if you would have also keyword to optionaly mark end of block. That would be big win for IDEs to format code and ensure that there is no problems with intendation. There could be some keyword to mark script as strictly marking blocks and then it would have this kind of validation. Cheers, Marek Mosiewicz -- https://mail.python.org/mailman/listinfo/python-list
Re: Blasphemy
Space. On Thu, Oct 24, 2019, 18:53 Marek Mosiewicz wrote: > What about, if Python would have optional end keyword. In fact most of > blocks have starting : sign. What if you would have also keyword to > optionaly mark end of block. > > That would be big win for IDEs to format code and ensure that there is > no problems with intendation. There could be some keyword to mark > script as strictly marking blocks and then it would have this kind of > validation. > > Cheers, > Marek Mosiewicz > > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list
Re: Blasphemy
On Fri, Oct 25, 2019 at 9:54 AM Marek Mosiewicz
wrote:
>
> What about, if Python would have optional end keyword. In fact most of
> blocks have starting : sign. What if you would have also keyword to
> optionaly mark end of block.
>
> That would be big win for IDEs to format code and ensure that there is
> no problems with intendation. There could be some keyword to mark
> script as strictly marking blocks and then it would have this kind of
> validation.
Python already actually HAS support for an optional end keyword. It
does make your code uglier when you use it, though.
for factor in (2, 3, 4, 8):
audio.frame_data = (data * factor).tobytes()
try:
sphinxamp = r.recognize_sphinx(audio)
# end
except (sr.UnknownValueError, sr.RequestError):
continue
# end
if sphinxamp != sphinx:
print("Sphinx*%d:" % factor, sphinxamp, file=log, flush=True)
# end
# end
Fully supported by all current versions of Python.
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
Re: keying by identity in dict and set
Regarding my question "Is there some fatal reason that this approach must never be used, besides the lack of documentary support for it?" If finally dawned on me that there is a use-case for containers that would preclude using object identity for keys. That is, if the object is to be serialized, or otherwise stored past the run-time of the program. Of course, all the identities (all the id() values) will be meaningless once the current run ends. That is not my use-case, however. My containers are already stored by completely different means. As to my other questions, I am now fairly convinced that, at least in CPython and PyPy, on both 32 bit and 64 bit machines, it is safe to assume that __eq__() is never called if __hash__() returns id(), and that this results in a perfect hash. It works splendidly. That leads me to the problem of the documentation. I hope to pursue a change in the documentation, at least to provide a little more explanation of the reason for the requirements of __hash__() and __eq__(). I would like to first discuss it with somebody who understands the history and internals of Python, to make sure I have all my facts straight. Cheers! On Sat, Oct 19, 2019 at 1:31 PM Steve White wrote: > > Hi, > > I have an application that would benefit from object instances > distinguished by identity being used in dict's and set's. To do this, > the __hash__ method must be overridden, the obvious return value being > the instance's id. > > This works flawlessly in extensive tests on several platforms, and on > a couple of different Python versions and implementations. > > The documentation seems to preclude a second requirement, however. > > I also want to use the == operator on these objects to mean a natural > comparison of values, different from identity, so that two instances > comparing equivalent does not imply that they are identical. > > But the documentation for __hash__ has: > "The only required property is that objects which compare equal > have the same hash value" > > Yet it seems something more is going on, because as near as I can > tell, it just works, perfectly, every time, despite this requirement. > If the the __hash__ method returns the object's id, the __eq__ method > of the *never* called when the object is added to a dict. (See > examples below.) > > It would appear that if __hash__ returns the id, then that id is used > internally as the key, and since the id is by definition unique, no > key collision ever occurs -- at least in every Python implementation > I've tried. It also seems that, for a class instance obj, > hash( hash( obj ) ) == hash( obj ) > hash( id( obj ) ) == id( obj ) > These are very strong and useful properties. Where are they documented? > > It looks like the existing Python built-in containers do exactly what > I need, but the documentation suggests that they may not. > > Taking the documentation at face value, I'm in the position of > choosing between abandoning the natural use of operator '==', or of > introducing an unfamiliar container implementation. As my package is > intended for the use by other people, neither option is attractive. > > Questions: > > Is all this apparent behaviour documented somewhere that I have missed? > > Is there some fatal reason that this approach must never be used, > besides the lack of documentary support for it? > > Is it in fact safe to assume that __eq__ is never called under these > circumstances? > > === > from __future__ import print_function > from sys import stdout > > class A( object ):# minimal hashable object > def __init__( self, v1, v2 ): > self.v = ( v1, v2 ) > > def __eq__( self, b ): > #return self.v[0] == b.v[0] and self.v[1] == b.v[1] > raise Exception( "CALLED __eq__" ) > > def __hash__( self ):# instances distinguished by identity > return id( self ) > > # It was suggested that set and dict internally use some representation > # of keys that contains less information than the id() value returned by > # __hash__, thus causing key collisions, which are resolved by calls to > # __eq__. > # In that case, one would expect __eq__ to be called eventually if enough > # objects were added to a set. I don't see that, though. > > NINSTANCES = 300# play with this number -- carefully! > STATUS_INTERVAL = 10 > > def test(): > """ hammer the set algorithms """ > s = set() > instances = [] > for i in range( 0, NINSTANCES ): > p = A( 1, 0 ) > s.add( p ) > instances.append( p ) > if not i % STATUS_INTERVAL: > stdout.write( str( i // STATUS_INTERVAL ) + " " ) > stdout.flush() > stdout.write( "\n" ) > > print( "length of set", len( s ) ) > print( "number of instances", len( instances ) ) > > for i in instances: > if not i in s: > print( "INSTANCE DROPPED OUT!
Re: Instantiating sub-class from super
On 25/10/19 4:29 AM, Frank Millman wrote: On 2019-10-19 12:37 AM, DL Neil via Python-list wrote: On 16/10/19 6:33 PM, Frank Millman wrote: On 2019-10-14 10:55 PM, DL Neil via Python-list wrote: Is there a technique or pattern for taking a (partially-) populated instance of a class, and re-creating it as an instance of one of its sub-classes? Here is a link to an article entitled 'Understanding Hidden Subtypes'. It dates back to 2004, but I think it is still relevant. It addresses precisely the issues that you raise, but from a data-modelling perspective, not a programming one. http://tdan.com/understanding-hidden-subtypes/5193 I found it invaluable, and applied the concepts in my own business/accounting application. Having created the ability to make subtypes visible and explicit, I found all kinds of unexpected uses for them. The article seems to be missing a couple of images (Figure 1 and Figure 2) showing the data relationships. I downloaded the original article onto my computer years ago, and my local copy does have the images, so if you would like to see them let me know and I will upload my version somewhere to make it accessible. Superb! Yes please Frank - I've also approached it from the data/DB side, and thus presumably why I was puzzling over how one implements in Python. (alternatively, email a PDF/similar directly) Hi I have just got back from a few days break and have only seen your message now. Did you see the message I posted on the 17th with a download link? If not, would you like me to post it again? I did spot the later post - but only after I'd written the above. I've been amused by the similarities between their case and ours, and enjoyed learning a lesson (or two?). Thanks and apologies. -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list
Re: installation problem
On 10/23/2019 9:43 PM, MRAB wrote: On 2019-10-24 00:47, fateme jbr wrote: Dear Python team I have installed Python 3.7.4 on windows 10. I have access to IDLE and I can run simple programs, but when I type python in command window nothing happens. What 'command window' do you mean? Windows' Command Prompt? or IDLE's Shell? If the latter, you will get a NameError. I wanna install pip and afterward some libraries and it is when the problem occurs. why doesn't prompt window recognize python. What shall I do? what do you mean by "nothing happens"? It should either start Python or show an error. Python 3.7 comes with pip; it should be installed already. The recommended way of starting Python on Windows these days is to use the Python launcher "py". You can use it run to pip: py -m pip install library_name Do this in Command Prompt, with a 'path>' prompt. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
