Re: Should nested classes in an Enum be Enum members?
On Thu, Jun 28, 2018 at 7:01 PM Ben Finney wrote: > > Ian Kelly writes: > > > On Thu, Jun 28, 2018 at 4:38 AM Ben Finney > > wrote: > > > > > > Ethan Furman writes: > > > > > > Specifically, I can't make sense of why someone would want to have a > > > class that is simultaneously behaving as an enumerated type, *and* > > > has an API of custom callable attributes. > > > > You don't see value in enum members having properties? > > Is a Python property a callable attribute? I was referring to properties generically in the OOP sense, not to Python properties specifically. -- https://mail.python.org/mailman/listinfo/python-list
Python27.dll module error from Python 2.7.15/PCbuild/get_externals.bat
I am trying to compile the freshly downloaded Python 2.7.15. When the PCBuild/build.bat goes to pull-in the external modules along with their dependencies it encounters this error for each of the external modules. F:\Dev\depot\tools\source\python\Python-2.7.15>.\PCbuild\get_externals.bat Using "F:\Dev\depot\tools\source\python\Python-2.7.15\PCbuild\\..\externals\pyth onx86\tools\python.exe" (found in externals directory) Fetching external libraries... e is e Fetching bzip2-1.0.6... Traceback (most recent call last): File "F:\Dev\depot\tools\source\python\Python-2.7.15\PCbuild\\get_external.py" , line 7, in from urllib.request import urlretrieve File "F:\Dev\depot\tools\source\python\Python-2.7.15\externals\pythonx86\tools \lib\urllib\request.py", line 88, in import http.client File "F:\Dev\depot\tools\source\python\Python-2.7.15\externals\pythonx86\tools \lib\http\client.py", line 71, in import email.parser File "F:\Dev\depot\tools\source\python\Python-2.7.15\externals\pythonx86\tools \lib\email\parser.py", line 12, in from email.feedparser import FeedParser, BytesFeedParser File "F:\Dev\depot\tools\source\python\Python-2.7.15\externals\pythonx86\tools \lib\email\feedparser.py", line 27, in from email._policybase import compat32 File "F:\Dev\depot\tools\source\python\Python-2.7.15\externals\pythonx86\tools \lib\email\_policybase.py", line 9, in from email.utils import _has_surrogates File "F:\Dev\depot\tools\source\python\Python-2.7.15\externals\pythonx86\tools \lib\email\utils.py", line 29, in import socket File "F:\Dev\depot\tools\source\python\Python-2.7.15\externals\pythonx86\tools \lib\socket.py", line 49, in import _socket ImportError: Module use of python27.dll conflicts with this version of Python. Fetching bsddb-4.7.25.0... Traceback (most recent call last): File "F:\Dev\depot\tools\source\python\Python-2.7.15\PCbuild\\get_external.py" I tried installing python versions 3.6.4 and 2.7.15 to see if it works because I read in the build script that if python is already installed then it will use that else it will install it's own python in externals and use it. But no luck! It keeps giving me the same error again and again. Even if I execute "builds.bat -e" it gets into the same trap though it goes ahead and compiles but then compiler throws error due to half-baked external modules. Any help will be highly appreciated ! --Amit Kumar Singh -- https://mail.python.org/mailman/listinfo/python-list
Re: Should nested classes in an Enum be Enum members?
On Thu, Jun 28, 2018 at 10:06 PM Ben Finney wrote: > > Ethan Furman writes: > > > On 06/28/2018 05:58 PM, Ben Finney wrote: > > > > > So I remain dumbfounded as to why anyone would want a class to *both* be > > > an enumerated type, *and* have callable attributes in its API. > > > > Perhaps I am using Enum incorrectly, but here is my FederalHoliday > > Enum. […] > > Thanks for the example. Yes, my personal impression is that class > is not a good use of enum.Enum (nor enum.AutoEnum). > > To inherit from enum.Enum (or enum.AutoEnum) signals, to my mind, that > the class is not really intended as a typical Python class, but instead > is intended to be that special beast known as an “enumerated type” which > has little behaviour other than being a namespace for constant values. That sounds like a C attitude talking. Python enums are heavily inspired by Java enums, which also permit enum members to have attributes and methods. In fact, that planets example that Steven mentioned is ripped straight out of the Java documentation. You may find it weird, but I actually find it really, really useful to be able to attach methods to enums. For example: class Color(Enum): RED = 'red' GREEN = 'green' BLUE = 'blue' def __str__(self): return 'the color %s' % self.value How else is one to override the str() of an enum? Another example: @total_ordering class ChessPiece(Enum): PAWN = 1, 'P' KNIGHT = 2, 'N' BISHOP = 3, 'B' ROOK = 4, 'R' # ... @property def label(self): return self.value[1] def __lt__(self, other): assert isinstance(other, ChessPiece) return self.value < other.value This enum type defines its own ordering based on the relative values of the chess pieces. To be fair, Java does this a bit better than Python does. For example, Java allows enum methods to be overridden by individual enum members. This makes it easy to, e.g., implement a Strategy pattern where the Strategy of choice depends upon an enum value. If you want to do that in Python, you're pretty much stuck with passing either lambdas or functions defined elsewhere as part of the enum member's value. But we can do it, which leads us to our next example: def pawn_moves(board, from_square): "Generate all pawn moves possible from the given square." # ... def knight_moves(board, from_square): "Generate all knight moves possible from the given square." # ... def pawn_attacks(board, from_square): "Generate all squares that would be attacked by a pawn a the given square." # ... # ... class ChessPiece(Enum): PAWN = 'P', pawn_moves, pawn_attacks KNIGHT = 'N', knight_moves, knight_attacks BISHOP = 'B', bishop_moves, bishop_attacks ROOK = 'R', rook_moves, rook_attacks # ... def moves(self, board, from_square): return self.value[1](board, from_square) def attacks(self, board, from_square): return self.value[2](board, from_square) Now, elsewhere we can easily do something like: all_moves = [] for square in board: piece = board[square] if piece: all_moves.extend(piece.moves(board, square)) Et voila. ChessPiece is still an enum as it should be, and it also has a useful API on top of that. -- https://mail.python.org/mailman/listinfo/python-list
Python 3.7 Windows Help Behaviour
In Python 3.7.0 on Windows the help file (python370.chm) displays with a fixed line length and does not adjust its line length when the user expands the help window horizontally. This behaviour is different to that of the Python 3.6 help file (python360.chm) which adjusts its text to fit the horizontal width of the help window. Is this a deliberate change or one that can be turned on or off in some way (I prefer the Python 3.6 behaviour)? -- https://mail.python.org/mailman/listinfo/python-list
EuroPython 2018: Beginners’ Day Workshop
Maybe you’ve come to EuroPython as a programmer from another language. Or perhaps you have other tech skills or you really want to understand what it’s like to program in Python. Then come to our Beginners’ Day at EuroPython. https://ep2018.europython.eu/en/events/beginners-day/ What is Beginners’ Day ? Beginners’ Day is a session we are running, just for newcomers to the Python programming language, on Tuesday, July 24th from 09:30 - 16:45, at the Edinburgh International Conference Center (EICC), the EuroPython 2018 venue, and just in time to get you ready for all the talks which follow on Wednesday, Thursday and Friday. You will need a conference pass to attend, but otherwise, it’s free, so if you’re thinking of coming to the conference, but you’re new to Python or programming, this could be the session for you. The workshop will be run by: - Vincent D. Warmerdam (PyData Amsterdam) - Christian Barra (EuroPython board member) Sign up for Beginners’ Day -- Whether you’re totally new to programming or you already know another language - this full day session will give you a crash-course in Python, and the ecosystem around it. You’ll get the context you need to get the most out of the rest of the EuroPython conference. Bring your laptop, because this will be a hands-on session! This session will be presented in English (although a few of the coaches do speak basic Spanish, French, Italian and Portuguese). Please see the Beginners’ Day page for the full program: https://ep2018.europython.eu/en/events/beginners-day/ If you’d like to come, please do register in advance for this session, so that we know how to plan to make it the best yet. We need to know the numbers for planing the workshop. Sign up for Beginners’ Day https://docs.google.com/forms/d/e/1FAIpQLSf7hTdKbYm_Jn8SSYNyC4iQXe-W68ndj93NxQacOSJKhyUeIQ/viewform Call for Mentors Already know Python ? Want to be a mentor ? Fantastic ! Especially if you can add an extra language to help non-English speakers feel comfortable asking questions, or if you’ve never mentored before and want to try to share your knowledge for the first time. Please sign up as a mentor on our mentor registration form: https://docs.google.com/forms/d/e/1FAIpQLSdkqmu8o2R0FN7BqlaLrv5trOKHqhEQyHtt5_RR2kYhqI-pJw/viewform Help spread the word Please help us spread this message by sharing it on your social networks as widely as possible. Thank you ! Link to the blog post: https://blog.europython.eu/post/175370423057/europython-2018-beginners-day-workshop Tweet: https://twitter.com/europython/status/1012671128790290432 Enjoy, -- EuroPython 2018 Team https://ep2018.europython.eu/ https://www.europython-society.org/ -- https://mail.python.org/mailman/listinfo/python-list
EuroPython 2018: Invoices available
We have great news ! After many months of sorting the UK VAT registration issue, we have finally been registered for VAT in the UK. This is the number, we’ve all been waiting for: GB 297620469 We’ve now generated all the missing invoices for existing purchases and hope that this will make it easier for companies to now register their employees as well. EuroPython 2018: Get your tickets before we sell out https://ep2018.europython.eu/en/registration/buy-tickets/ Downloading Invoices If you have already purchased tickets, you can find the invoices in your account. Simply log in, go to the profile page, select “Orders, invoices & coupons” on the right and you should find the invoice links for your orders. The invoices are generated as PDFs, so you can print or archive them easily. Sorry for keeping you waiting so long. Help spread the word Please help us spread this message by sharing it on your social networks as widely as possible. Thank you ! Link to the blog post: https://blog.europython.eu/post/175370400437/europython-2018-invoices-available Tweet: https://twitter.com/europython/status/1012670816352382977 Enjoy, -- EuroPython 2018 Team https://ep2018.europython.eu/ https://www.europython-society.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: EXTERNAL: OSError: [Errno 48] Address already in use
On Thursday, June 28, 2018 at 1:21:32 AM UTC-4, T Berger wrote: > Hi Guys, > > Thanks for all the suggestions. I found the problem. I had saved my program > in IDLE and quit out of the shell, and then tried to run the program in > Terminal. Previously, restarting the shell was enough to break the connection > with the port. This time, I guess, it wasn't. So after thinking about your > suggestions, I bypassed IDLE and went directly to Terminal, and the program > worked. > > Tamara I have to backtrack on my optimistic pronouncement. I know why I'm getting "address already in use" error messages, but I don't know how to avoid getting them. The problem is that I'm working with both IDLE and my Terminal at the same time. I have to close out of IDLE in some decisive way so that the connection with the port is cut. Otherwise I will get the error message. At first, just restarting the shell in IDLE worked. Then I actually had to close the app (which didn't seem like a flexible option to me). Now, even quitting out of IDLE doesn't work. So my revised question is: How do I work with both apps together so these error messages don't keep recurring? Thanks, Tamara -- https://mail.python.org/mailman/listinfo/python-list
Re: EXTERNAL: OSError: [Errno 48] Address already in use
On Friday, June 29, 2018 at 10:45:10 AM UTC-4, T Berger wrote: > On Thursday, June 28, 2018 at 1:21:32 AM UTC-4, T Berger wrote: > > Hi Guys, > > > > Thanks for all the suggestions. I found the problem. I had saved my program > > in IDLE and quit out of the shell, and then tried to run the program in > > Terminal. Previously, restarting the shell was enough to break the > > connection with the port. This time, I guess, it wasn't. So after thinking > > about your suggestions, I bypassed IDLE and went directly to Terminal, and > > the program worked. > > > > Tamara > > I have to backtrack on my optimistic pronouncement. I know why I'm getting > "address already in use" error messages, but I don't know how to avoid > getting them. The problem is that I'm working with both IDLE and my Terminal > at the same time. I have to close out of IDLE in some decisive way so that > the connection with the port is cut. Otherwise I will get the error message. > At first, just restarting the shell in IDLE worked. Then I actually had to > close the app (which didn't seem like a flexible option to me). Now, even > quitting out of IDLE doesn't work. So my revised question is: How do I work > with both apps together so these error messages don't keep recurring? > > Thanks, > > Tamara Addendum I'm using the flask test web address http://127.0.0.1:5000/ for both IDLE and Terminal. -- https://mail.python.org/mailman/listinfo/python-list
Re: Should nested classes in an Enum be Enum members?
On 29/06/2018 09:01, Ian Kelly wrote: On Thu, Jun 28, 2018 at 10:06 PM Ben Finney wrote: @total_ordering class ChessPiece(Enum): PAWN = 1, 'P' KNIGHT = 2, 'N' BISHOP = 3, 'B' ROOK = 4, 'R' # ... @property def label(self): return self.value[1] def __lt__(self, other): assert isinstance(other, ChessPiece) return self.value < other.value This enum type defines its own ordering based on the relative values of the chess pieces. class ChessPiece(Enum): PAWN = 'P', pawn_moves, pawn_attacks KNIGHT = 'N', knight_moves, knight_attacks BISHOP = 'B', bishop_moves, bishop_attacks ROOK = 'R', rook_moves, rook_attacks # ... def moves(self, board, from_square): return self.value[1](board, from_square) def attacks(self, board, from_square): return self.value[2](board, from_square) Now, elsewhere we can easily do something like: all_moves = [] for square in board: piece = board[square] if piece: all_moves.extend(piece.moves(board, square)) Et voila. ChessPiece is still an enum as it should be, and it also has a useful API on top of that. I get the feeling is that the enum (PAWN, BISHOP etc) is a property of a piece, rather than being the cornerstone of everything you might think of doing with a chess-piece. That thinking keeps the that property as a simple type, a simple enum of six distinct values with nothing else piled on top to complicate matters. And it means the same enum can be used in other contexts associated with chess where that other data may be irrelevant. -- bart -- https://mail.python.org/mailman/listinfo/python-list
Re: Python27.dll module error from Python 2.7.15/PCbuild/get_externals.bat
On 6/29/2018 3:42 AM, amit.singh2...@gmail.com wrote: I am trying to compile the freshly downloaded Python 2.7.15. When the PCBuild/build.bat goes to pull-in the external modules along with their dependencies it encounters this error for each of the external modules. F:\Dev\depot\tools\source\python\Python-2.7.15>.\PCbuild\get_externals.bat Using "F:\Dev\depot\tools\source\python\Python-2.7.15\PCbuild\\..\externals\pyth onx86\tools\python.exe" (found in externals directory) Fetching external libraries... e is e Fetching bzip2-1.0.6... Traceback (most recent call last): File "F:\Dev\depot\tools\source\python\Python-2.7.15\PCbuild\\get_external.py" , line 7, in from urllib.request import urlretrieve File "F:\Dev\depot\tools\source\python\Python-2.7.15\externals\pythonx86\tools \lib\urllib\request.py", line 88, in import http.client File "F:\Dev\depot\tools\source\python\Python-2.7.15\externals\pythonx86\tools \lib\http\client.py", line 71, in import email.parser File "F:\Dev\depot\tools\source\python\Python-2.7.15\externals\pythonx86\tools \lib\email\parser.py", line 12, in from email.feedparser import FeedParser, BytesFeedParser File "F:\Dev\depot\tools\source\python\Python-2.7.15\externals\pythonx86\tools \lib\email\feedparser.py", line 27, in from email._policybase import compat32 File "F:\Dev\depot\tools\source\python\Python-2.7.15\externals\pythonx86\tools \lib\email\_policybase.py", line 9, in from email.utils import _has_surrogates File "F:\Dev\depot\tools\source\python\Python-2.7.15\externals\pythonx86\tools \lib\email\utils.py", line 29, in import socket File "F:\Dev\depot\tools\source\python\Python-2.7.15\externals\pythonx86\tools \lib\socket.py", line 49, in import _socket ImportError: Module use of python27.dll conflicts with this version of Python. Fetching bsddb-4.7.25.0... Traceback (most recent call last): File "F:\Dev\depot\tools\source\python\Python-2.7.15\PCbuild\\get_external.py" I tried installing python versions 3.6.4 and 2.7.15 to see if it works because I read in the build script that if python is already installed then it will use that else it will install it's own python in externals and use it. But no luck! It keeps giving me the same error again and again. Even if I execute "builds.bat -e" it gets into the same trap though it goes ahead and compiles but then compiler throws error due to half-baked external modules. Any help will be highly appreciated ! I updated my repository, including the 2.7 branch and ran PCbuild\build.bat -e -d Everything built fine, but no external fetches were done. I renamed the bz dir and built again. Using py -3.6 (found with py.exe) Fetching external libraries... Fetching bzip2-1.0.6... ... blocksort.c bzlib.c compress.c crctable.c decompress.c huffman.c randtable.c Generating Code... bz2.vcxproj -> f:\dev\27\PCBuild\bz2_d.pyd as expected. So the .bat files are ok. You had > Using "F:\Dev\depot\tools\source\python\Python-2.7.15\PCbuild\\..\externals\pyth > onx86\tools\python.exe" (found in externals directory) and got > ImportError: Module use of python27.dll conflicts with this version of Python. I don't understand that at all, but I would remove the python.exe within external, as it did not work, so it cannot be used. Did you install the py launcher when you installed 3.6 (3.6.6 was just released). Here is the list of what you need. Fetching bzip2-1.0.6... bsddb-4.7.25.0 already exists, skipping. openssl-1.0.2o already exists, skipping. sqlite-3.14.2.0 already exists, skipping. tcl-8.5.19.0 already exists, skipping. tk-8.5.19.0 already exists, skipping. tix-8.4.3.5 already exists, skipping. Fetching external binaries... nasm-2.11.06 already exists, skipping. I would delete anything not in the list. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.7 Windows Help Behaviour
On 6/29/2018 6:14 AM, BlindAnagram wrote: In Python 3.7.0 on Windows the help file (python370.chm) displays with a fixed line length and does not adjust its line length when the user expands the help window horizontally. This behaviour is different to that of the Python 3.6 help file (python360.chm) which adjusts its text to fit the horizontal width of the help window. Is this a deliberate change or one that can be turned on or off in some way (I prefer the Python 3.6 behaviour)? I believe that this is a deliberate regression imposed by 'experts' who believe in form over function and 'controlling the user experience'. 3.6.6 has been 'fixated' also. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: EXTERNAL: OSError: [Errno 48] Address already in use
On 06/29/18 08:05, T Berger wrote: On Friday, June 29, 2018 at 10:45:10 AM UTC-4, T Berger wrote: On Thursday, June 28, 2018 at 1:21:32 AM UTC-4, T Berger wrote: Hi Guys, Thanks for all the suggestions. I found the problem. I had saved my program in IDLE and quit out of the shell, and then tried to run the program in Terminal. Previously, restarting the shell was enough to break the connection with the port. This time, I guess, it wasn't. So after thinking about your suggestions, I bypassed IDLE and went directly to Terminal, and the program worked. Tamara I have to backtrack on my optimistic pronouncement. I know why I'm getting "address already in use" error messages, but I don't know how to avoid getting them. The problem is that I'm working with both IDLE and my Terminal at the same time. I have to close out of IDLE in some decisive way so that the connection with the port is cut. Otherwise I will get the error message. At first, just restarting the shell in IDLE worked. Then I actually had to close the app (which didn't seem like a flexible option to me). Now, even quitting out of IDLE doesn't work. So my revised question is: How do I work with both apps together so these error messages don't keep recurring? Thanks, Tamara Addendum I'm using the flask test web address http://127.0.0.1:5000/ for both IDLE and Terminal. That's not a "web address" - it's the address of your own machine. In other words, you're connecting to yourself. You can't use it simultaneously for both applications - you'll need to change the port number to something other than 5000 in one of them. -Jim -- https://mail.python.org/mailman/listinfo/python-list
Re: Should nested classes in an Enum be Enum members?
On 06/28/2018 10:52 PM, Steven D'Aprano wrote: On Thu, 28 Jun 2018 18:33:31 -0700, Ethan Furman wrote: Perhaps I am using Enum incorrectly, but here is my FederalHoliday Enum. Note that date(), next_business_day, and year() are all callables. The AutoEnum parent assigns values from 1 to n for each member. It's at Stackoverflow [1] if you'd like up- or down-vote it. ;) It isn't clear to me why FederalHoliday is an Enum, especially as the API seems extremely baraque. Huh. I had to look that word up, and I still don't know what you meant exactly, although I suspect it wasn't complimentary. ;-) class FederalHoliday(AutoEnum): NewYear = "First day of the year.", 'absolute', Month.JANUARY, 1 MartinLutherKingJr = "Birth of Civil Rights leader.", \ 'relative', Month.JANUARY, Weekday.MONDAY, 3 ... I think I get the idea... the first field is a description, the second tells us what month the holiday is in (hope you don't have to deal with movable holidays which can change months...). I'm not quite sure what the "absolute/relative" flags are (or why they are strings instead of enums). Possibly they determine whether the next field is treated as an ordinal (first, second, third...) or numerical (1, 2, 3...) value. - description - type (absolute or relative) - month - if absolute: - date - else: - week day - which one But what isn't clear to me is why these holidays are *enums*. They're obviously date instances, with a rich API (at least three methods) and an extremely complex constructor (one with variable numbers of arguments). They are the list of dates in which US banks are closed for electronic business (funds transfers and things). What makes them enums? Under what circumstances would you be comparing something to MartinLutherKingJr (Day) without caring about a *specific* Martin Luther King Jr Day? Enums are also useful when the underlying value is relevant; the usual example is communicating with other languages' APIs. While those relevant values may have no intrinsic value, why is it a problem if they do? -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] Why are BBSes? [was Where's the junk coming from?]
On 06/29/18 07:15, Dennis Lee Bieber wrote: On 6/28/2018 9:05 PM, Avon wrote: Being able to send messages by ham radio is useful in disasters as well as nostalgic. I just don't know what people are doing these days. Though I haven't heard much of the AX.25 Packet BBS systems in decades... It seems APRS is mostly what remains of packet. AX.25 Packet Radio BBS's are still alive and well, though the number of active nodes has decreased significantly over the past 20 years. There are 3 of them within a 50 mile radius of me, but I haven't tried passing a message from coast to coast in several years. I suspect that some nodes are tunneling via the Internet, which sort of defeats the purpose. -Jim -- https://mail.python.org/mailman/listinfo/python-list
Re: Where's the junk coming from?
On 29/06/18 01:53, Avon wrote: On 06/28/18, Tim Golden pondered and said... TG> (Wearing my List Moderator hat) TG> TG> Thanks very much for addressing this for us, and to Cameron and others TG> who did the detective work. I admit I assumed at first it was some kind TG> of odd attack perhaps related to a dissatisfied poster so I'm glad it TG> was a misconfiguration issue. Hi Tim. You're most welcome. I try to jump on anything amiss as soon as I know about it. At the time of posting this reply I have not re-linked the node with the issue to my NNTP server but will likely do so in a few more days time. I just want to give him some time to sort his end out first :) Best wishes from New Zealand Cheers, Paul. As the person who started this thread I'll add my thanks for trying to sort things. Nothing last night is a good start :-) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: EXTERNAL: OSError: [Errno 48] Address already in use
On 29Jun2018 09:50, Jim Lee wrote: On 06/29/18 08:05, T Berger wrote: On Friday, June 29, 2018 at 10:45:10 AM UTC-4, T Berger wrote: On Thursday, June 28, 2018 at 1:21:32 AM UTC-4, T Berger wrote: I have to backtrack on my optimistic pronouncement. I know why I'm getting "address already in use" error messages, but I don't know how to avoid getting them. The problem is that I'm working with both IDLE and my Terminal at the same time. I have to close out of IDLE in some decisive way so that the connection with the port is cut. Otherwise I will get the error message. At first, just restarting the shell in IDLE worked. Then I actually had to close the app (which didn't seem like a flexible option to me). Now, even quitting out of IDLE doesn't work. So my revised question is: How do I work with both apps together so these error messages don't keep recurring? Addendum I'm using the flask test web address http://127.0.0.1:5000/ for both IDLE and Terminal. That's not a "web address" - it's the address of your own machine. In other words, you're connecting to yourself. You can't use it simultaneously for both applications - you'll need to change the port number to something other than 5000 in one of them. The key point here from Jim is "simultaneously". Are you properly shutting down the Flask instance in IDLE before running from Terminal, and vice versa? Otherwise both will try to use the same local port and There Can Be Only One. Do you need to run from both environments at the same time? I'd have thought not, which also leads me to: why are you flicking from IDLE to Terminal? I would have imagined using one or the other normally, not both. It isn't wrong to use both, just surprising. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list
Re: Should nested classes in an Enum be Enum members?
On 29Jun2018 10:36, Ethan Furman wrote: On 06/28/2018 10:52 PM, Steven D'Aprano wrote: On Thu, 28 Jun 2018 18:33:31 -0700, Ethan Furman wrote: Perhaps I am using Enum incorrectly, but here is my FederalHoliday Enum. Note that date(), next_business_day, and year() are all callables. The AutoEnum parent assigns values from 1 to n for each member. It's at Stackoverflow [1] if you'd like up- or down-vote it. ;) It isn't clear to me why FederalHoliday is an Enum, especially as the API seems extremely baraque. Huh. I had to look that word up, and I still don't know what you meant exactly, although I suspect it wasn't complimentary. ;-) It tends to mean "weird", but perhaps a more nuanced phrasing might be unusual and strange, and usually connotes some degree of over complication. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list
Re: Should nested classes in an Enum be Enum members?
On 06/29/18 16:02, Cameron Simpson wrote: On 29Jun2018 10:36, Ethan Furman wrote: On 06/28/2018 10:52 PM, Steven D'Aprano wrote: On Thu, 28 Jun 2018 18:33:31 -0700, Ethan Furman wrote: Perhaps I am using Enum incorrectly, but here is my FederalHoliday Enum. Note that date(), next_business_day, and year() are all callables. The AutoEnum parent assigns values from 1 to n for each member. It's at Stackoverflow [1] if you'd like up- or down-vote it. ;) It isn't clear to me why FederalHoliday is an Enum, especially as the API seems extremely baraque. Huh. I had to look that word up, and I still don't know what you meant exactly, although I suspect it wasn't complimentary. ;-) It tends to mean "weird", but perhaps a more nuanced phrasing might be unusual and strange, and usually connotes some degree of over complication. Cheers, Cameron Simpson It's actually "baroque", not "baraque", and Cameron has the right idea - lavish, extravagant, overly complicated. -Jim -- https://mail.python.org/mailman/listinfo/python-list
Re: Should nested classes in an Enum be Enum members?
Ethan Furman wrote: They are the list of dates in which US banks are closed for electronic business (funds transfers and things). That sems like something that would be better specified in a configuration file than hard-wired into the code, in case the rules change. -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: Should nested classes in an Enum be Enum members?
Cameron Simpson wrote: It tends to mean "weird", but perhaps a more nuanced phrasing might be unusual and strange, and usually connotes some degree of over complication. When used in a derogatory way it means "excessively elaborate". The Baroque period was characterised by extremely ornate architecture, music, etc. -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: I lost nearly all my modules installing 3.7
On 29 Jun 2018, Terry Reedy wrote (in article): > On 6/28/2018 6:45 PM, Elliott Roper wrote: > > On 28 Jun 2018, Terry Reedy wrote > > > > There is a pip command for making an editable file of installed > > > packages. Run that in 3.6, perhaps after updating everything. > > > > > > > > > There is another pip command for using that file to install everything > > > listed. Run that in 3.7. > > > > I can't see the pip commands you mention for writing a file from 3.6 > and > > reading it back for 3.7 > > Is it pip freeze -r followed by pip install -r? If so, what is > > meant by 'the given requirements file' in the freeze options? > > 'pip freeze' sends the requirements list to stdout in alphabetical > order. You redirect or copy-paste to a file. I have not done this, but > apparently -r uses file as a template for selecting and ordering > the requirements. I presume pip will ignore any versions in the > template and list the actual installed versions. Thanks Terry. The freeze worked but the install -r looked like it was doing the right thing but ended up doing nothing after complaining about matplotlib being unable to install one of its dependencies IIRC I have deleted every trace of python following every element on sys.path for every version I had except for Apple's 2.6 and then reinstalled 3.7 from python.org's downloads. Then using the output from my 3.6 freeze, I installed each package on that list one by one with the --user option. That worked well except for two of the biggies I wanted to play with -- scipy and matplotlib. I did get numpy and pandas to install that way, which is a large part I need for what I am playing with. install scipy wrote an error message longer than War and Peace that finished with:- error: library dfftpack has Fortran sources but no Fortran compiler found Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/v2/gj68t3zx3bd6764zxc332ctcgr/T/pi p-install-np76k73m/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/v2/gj68t3zx3bd6764zxc332ctcgr/T/pip-record- 0norcg4s/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /private/var/folders/v2/gj68t3zx3bd6764zxc332ctcgr/T/pip-install- np76k73m/scipy/ __ _ and matplotlib produced a beautifully formatted report that started with: __ Complete output from command python setup.py egg_info: IMPORTANT WARNING: pkg-config is not installed. matplotlib may not be able to find some of its dependencies Edit setup.cfg to change the build options ___ and finished with * The following required packages can not be built: * png Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/v2/gj68t3zx3bd6764zxc332ctcgr/T/pip-install- 3fnvrt2b/matplotlib/ ___ Both look like not having write access to /private/var/folders/v2/gj68t3zx3bd6764zxc332ctcgr/T/pip-install- np76k73m/ since I was installing with the --user switch, it looks like a bug in pip. It should have guessed I was a non-priviliged user. But then that "Edit setup.cfg to change the build options" is intriguing, especially since 'pip3 config list' returns nothing. Still. I have got a fair way there. Thanks so much for your help. It would be great if there were a Mac user with as much patience for numpties. To de-mung my e-mail address:- fsnospam$elliott$$ PGP Fingerprint: 1A96 3CF7 637F 896B C810 E199 7E5C A9E4 8E59 E248 -- https://mail.python.org/mailman/listinfo/python-list
Baroque [was Re: Should nested classes in an Enum be Enum members?]
On Sat, 30 Jun 2018 09:02:37 +1000, Cameron Simpson wrote: > On 29Jun2018 10:36, Ethan Furman wrote: >>On 06/28/2018 10:52 PM, Steven D'Aprano wrote: >>>It isn't clear to me why FederalHoliday is an Enum, especially as the >>>API seems extremely baraque. >> >>Huh. I had to look that word up, and I still don't know what you meant >>exactly, although I suspect it wasn't complimentary. ;-) > > It tends to mean "weird", but perhaps a more nuanced phrasing might be > unusual and strange, and usually connotes some degree of over > complication. It might have helped if I spelled it correctly, sorry. It should not mean "weird or bizarre", although I've seen a couple of lesser-quality dictionaries give that as a meaning. Which is itself weird and bizarre :-) The more established meanings are: - literally, it refers to the Baroque style of art, music and architecture popular in Europe between (approximately) 1600 and 1750; - figuratively, it means to be highly ornate and elaborate, with strong connotations of being *excessively* complicated to the point of being convoluted. https://en.oxforddictionaries.com/definition/baroque http://www.dictionary.com/browse/baroque So not especially complimentary (sorry Ethan, but that was my first impression) but not *necessarily* a bad thing either. The Jargon File adjective that comes closest is probably gnarly: http://www.catb.org/jargon/html/G/gnarly.html but that's probably stronger with even worse connotations than baroque. -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- https://mail.python.org/mailman/listinfo/python-list
Re: Baroque [was Re: Should nested classes in an Enum be Enum members?]
On Sat, Jun 30, 2018 at 10:51 AM, Steven D'Aprano wrote: > ["Baroque"] should not mean "weird or bizarre", although I've seen a couple of > lesser-quality dictionaries give that as a meaning. Which is itself weird > and bizarre :-) > I guess those dictionaries are baroque. Or maybe just broke. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Should nested classes in an Enum be Enum members?
On Fri, 29 Jun 2018 10:36:45 -0700, Ethan Furman wrote: >> What makes them enums? Under what circumstances would you be comparing >> something to MartinLutherKingJr (Day) without caring about a *specific* >> Martin Luther King Jr Day? > > Enums are also useful when the underlying value is relevant; the usual > example is communicating with other languages' APIs. While those > relevant values may have no intrinsic value, why is it a problem if they > do? But surely the underlying value of holidays *is* something we care about: the date it falls. We don't just care about "Martin Luther King Jr Day" as an abstraction, we do care about the specific day it falls, we care about its relationship to other days: - what's the last business day before MKKJ Day? - what's the next business day after it? - what's the date of it this year? - will it ever fall on my birthday? etc. I think that once we start adding methods to enums, we're starting to move into a gray area where they aren't *really* arbitrary enumerated values any longer. (Maybe.) If your methods use "self", then they implicitly care about the value of the enum. I think it's a matter of degree. Past a certain level of complexity, the object isn't an enum any more. I don't have a problem with the "planets" example for enums. (Maybe I should?) But your example seems to have crossed that line for me. At one extreme, we have pure symbols, or atoms, where the values don't support any significant operations apart from such trivial operations such as a human-readable string representation. Examples in Python include None, Ellipsis and NotImplemented. https://en.wikipedia.org/wiki/Symbol_%28programming%29 On the other extreme, we have rich, complex data types which support many non-trivial operations, like dicts, tuples, floats and web server objects. These typically (but not always) support a notion of equality beyond just identity. I think enums naturally belong very close to the Symbol end of the continuum, and I can't help but feel your Federal Holiday example is sufficiently far from that end that using Enum feels uncomfortable to me. -- Steven D'Aprano "Ever since I learned about confirmation bias, I've been seeing it everywhere." -- Jon Ronson -- https://mail.python.org/mailman/listinfo/python-list
Re: Baroque [was Re: Should nested classes in an Enum be Enum members?]
On 06/29/2018 05:51 PM, Steven D'Aprano wrote: So not especially complimentary (sorry Ethan, but that was my first impression) but not *necessarily* a bad thing either. No worries! :) The Jargon File adjective that comes closest is probably gnarly: Wow, I haven't heard that word in a long time. Just for the record: https://en.wiktionary.org/wiki/baraque baraque f (plural baraques) shack, hut stall, stand (colloquial) pad, crib (house) (informal) a musclehead So, you can see why I was confused! -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list
Re: Where's the junk coming from?
On 06/29/18, Mark Lawrence pondered and said... ML> As the person who started this thread I'll add my thanks for trying to ML> sort things. Nothing last night is a good start :-) Thanks Mark... you're welcome :) Best, Paul -- https://mail.python.org/mailman/listinfo/python-list
Re: I lost nearly all my modules installing 3.7
Elliott Roper writes: > ... > install scipy wrote an error message longer than War and Peace that finished > with:- > > error: library dfftpack has Fortran sources but no Fortran compiler found An error message of the type I like: precise: Install a "Fortran compiler" and try again. > ... > and matplotlib produced a beautifully formatted report that started with: > __ > Complete output from command python setup.py egg_info: > IMPORTANT WARNING: This is a warning only (even though it is marked as important). > pkg-config is not installed. > matplotlib may not be able to find some of its dependencies And the warning message is precise again: install "pkg-config" to get rid of it. I do not know "pkg-config". The name seems to indicate an operating system package; but, it might also be a Python extension package (less likely). I would start with the "matplotlib" installation instructions to look for information about it. -- https://mail.python.org/mailman/listinfo/python-list
Re: EXTERNAL: OSError: [Errno 48] Address already in use
On Thu, Jun 28, 2018 at 10:30 PM, Marko Rauhamaa wrote: > Well, the same security issue can be demonstrated without SO_REUSEADDR: > > The security issue can be real but is not directly related with > SO_REUSEADDR. > Yes, it can. It just takes longer. -- https://mail.python.org/mailman/listinfo/python-list
Re: I lost nearly all my modules installing 3.7
On 06/29/18 21:48, dieter wrote: I do not know "pkg-config". The name seems to indicate an operating system package; but, it might also be a Python extension package (less likely). I would start with the "matplotlib" installation instructions to look for information about it. https://www.freedesktop.org/wiki/Software/pkg-config/ "pkg-config is a helper tool used when compiling applications and libraries. It helps you insert the correct compiler options on the command line so an application can use|gcc -o test test.c `pkg-config --libs --cflags glib-2.0`|for instance, rather than hard-coding values on where to find glib (or other libraries). It is language-agnostic, so it can be used for defining the location of documentation tools, for instance." -Jim -- https://mail.python.org/mailman/listinfo/python-list