Re: OT again sorry [Re: Interactive scripts (back on topic for once) [was Re: The "loop and a half"]]
On 10/08/2017 12:43 PM, Marko Rauhamaa wrote: leam hall <leamh...@gmail.com>: "Linux" means so many things to people. Yes, but just because someone can spell it doesn't mean they can redefine it. :) Closer to home, systemd has taken a central role in the main Linux distributions. I think it would be more accurate to call them "systemd distros" than "Linux distros". I have other words for them; mostly ones I try not to say. It is not at all easy for the Linux user to figure out what configuration options there are, and which ones are intended for end-user configuration. Agree! I had to look this up and I've been doing Linux for a few years. Marko I knew your e-mail address was familiar; saluton! Leam -- Who hasn't practiced that language in years. Sadly... -- https://mail.python.org/mailman/listinfo/python-list
Re: OT again sorry [Re: Interactive scripts (back on topic for once) [was Re: The "loop and a half"]]
On Sun, Oct 8, 2017 at 8:15 AM, Gregory Ewingwrote: > > The thing that *really* annoys me is Linux insisting on colourising > the output to a tty, since it invariably seems to pick an undreadable > colour scheme. And the case-insensitive sorting... there's a reason > Makefile starts with a capital M, dammit! > Actually, it doesn't. The color output may come from /etc/profile.d/colorls.sh configs. Either dump that or "unalias ls" in your ~/.bash_profile. Colorized ls is something the distrobution people like and they put it in. Others of us don't care for it. But it's not "Linux", is the profile. Easy to customize. Leam -- https://mail.python.org/mailman/listinfo/python-list
Re: Good virtualenv and packaging tutorials for beginner?
On Wed, Oct 4, 2017 at 7:15 AM, Ben Finney <ben+pyt...@benfinney.id.au> wrote: > Leam Hall <leamh...@gmail.com> writes: > > > Folks on IRC have suggested using virtualenv to test code under > > different python versions. Sadly, I've not found a virtualenv tutorial > > I understand. Anyone have a link to a good one? > > The Python Packaging Authority has a guide > <URL:https://packaging.python.org/tutorials/installing- > packages/#creating-virtual-environments> > which seems good to me. > > The standard library documentation for the ‘venv’ library > <URL:https://docs.python.org/3/library/venv.html> is essential. > > > The next step will be to figure out how to package a project; a good > > tutorial URL would be appreciated on that, too. > > Follow the documentation maintained by the Python Packaging Authority > <URL:https://packaging.python.org/>. > > Ben, thanks! I'm off to print and study... Leam -- https://mail.python.org/mailman/listinfo/python-list
Python community "welcoming" feedback
A while back I pointed out some challenges for the Python community's intake of new coders. Mostly focusing on IRC and the Python e-mail list. Several people have stepped up their "welcome" game and I've been very impressed with the way things are going. Great job! Leam -- https://mail.python.org/mailman/listinfo/python-list
Good virtualenv and packaging tutorials for beginner?
Folks on IRC have suggested using virtualenv to test code under different python versions. Sadly, I've not found a virtualenv tutorial I understand. Anyone have a link to a good one? The next step will be to figure out how to package a project; a good tutorial URL would be appreciated on that, too. Thanks! Leam -- https://mail.python.org/mailman/listinfo/python-list
Re: Beginners and experts (Batchelder blog post)
On Fri, Sep 29, 2017 at 10:52 AM, justin walterswrote: > > I got through writing all of the above without realizing that you meant you > wanted to build a > desktop application and not a web application. Though, I think the advice > is still helpful. > > Yes and no. Seriously thanks! I am at first targeting a desktop app just to be simpler and to push me to learn Tkinter. However, it's more likely to end up a simple web app once I learn enough Bottle/Flask to make it work. Or I may just skip Tkinter for the nonce and see if I can do it with web forms. Leam -- https://mail.python.org/mailman/listinfo/python-list
Re: Beginners and experts (Batchelder blog post)
On 09/28/2017 04:15 AM, Paul Moore wrote: With Python, I'd say that an appreciation of the available libraries is key - both what's in the stdlib, and what's available from PyPI. That's not to say you should memorise the standard library, but rather cultivate an approach of "hmm, I'm pretty sure I remember there being a library for that" and going to look. The best way of getting this is to actually work with code - you can start with doing coding projects of your own (it's *always* a good exercise to have a problem that interests you, and work on coding it - no matter what it is, you'll learn more about understanding requirements, testing, bug fixing, and practical programming by working on a project you care about than you'll ever get reading books) and/or you can look at existing open source projects that you're interested in, and offer help (there's always a bug tracker, and typically some simpler items - and you'll learn a lot from interacting with a larger project). When I first started in Unix/Linux there was a group called SAGE. They had a list of tasks a system admin was expected to be able to do and they sorted the list by "Junior", "Senior", or somesuch. I started at the bottom of the list and worked my way up. One useful thing was to make a sorted list of commands in /usr/bin, /bin, /usr/sbin, and /sbin, and then read the first bit of the man page that showed what the command did. Fun stuff. Leam -- https://mail.python.org/mailman/listinfo/python-list
Re: Beginners and experts (Batchelder blog post)
On 09/28/2017 07:35 AM, Stefan Ram wrote: But remember that paid programmers usually do not "code", in the sense of "write a program from scratch". Most of the work is maintenance programming, where an important part of the job is to read and understand a piece of code. Coding from scratch also happens, it just less common. (So that would be a reasonable interview test: Being able to understand a piece of given code and do some requested modification to it.) Another Perl story. I used to love Perl and then got to the point where trying to code in it made me physically nauseous. Not sure why. Guy had written a perl based time tracker for our contractor team. We'd enter tasks done and it would give a text based output to send to mgmt. Of course the guy hadn't planned on leaving after a few months and his program stored data by date but didn't separate by year. So I had to go figure out what it was doing since he was using a perl specific data archiver. Eventually just wound up blowing away the data store so each year was new. Told others how to handle it as I didn't want to do more perl and wasn't good enough at anything to replicate it all myself. Leam -- https://mail.python.org/mailman/listinfo/python-list
Re: Beginners and experts (Batchelder blog post)
My question has received several helpful responses, thanks! On 09/28/2017 01:01 PM, Dennis Lee Bieber wrote: On Wed, 27 Sep 2017 12:41:24 -0400, leam hall <leamh...@gmail.com> declaimed the following: "Programmer"... or "Software Engineer"? I haven't kept up on "job titles" but for my history, "programmer" is an entry level position, just a few steps up from "data entry operator" (aka "keypunch operator" -- to show my age) "Person who automates routine tasks". I used to get asked for MAC addresses. I was playing with TCL at the time and it had a built in webserver sort of thing. The boxes were Solaris. Made a cron job to run Explorer on the servers and another to collate them to a node with the TCL webserver. Gave the Network team the URL. I'll show my age; 5 bit ASCII punched tape and actual ferrite core memory. :P As a "programmer" (in my archaic world): be fluent in the language and core of the runtime (though perhaps not a master -- I still don't get Python's decorators and meta-class concepts; my uses haven't needed them). Be able to read language agnostic requirement/design documentation and translate to the language in question. At this level, knowledge of the problem domain is probably not needed. At the higher levels, the language begins to be irrelevant, but more knowledge of the problem domain becomes important -- the difference between designing/coding a web-based store-front (HTTP/HTML, database, security) vs number-crunching image streams from space probes... Afraid I've likely just tossed it back to you -- what really is your goal? As an introvert with a speech impediment I live by "Don't call me, I won't call you." Well, okay, yes. I did to Toastmasters and can shine at an interview. Still, day to day I prefer to create solutions that solve problems and answer questions before they are asked so no one asks me. I know a little Networking, Database, Systems Engineering, Project Management, Security, large datacenter, and other cool buzzwords to easily find a job doing Linux system admin. What I want to move away from is doing now what I was doing 10-15 years ago. A couple years ago I was back into C. A RHEL bug came up and management needed to understand the severity of the issue. I was able to read the reports, dig through the kernel code, and explain the issues and risks to MBA and PM types. I'm not about to represent myself as a C programmer but I can follow #include files. One place brought on Unix people and your first day was split between the Eng team lead and the Ops team lead. They would decide which you were more suited for. The Eng team lead wrote Perl and asked me to explain some of their code. I did and also pointed out a bug. Seems I was a better fit for the Ops team. :P My short term goals are to use Python to get better at OOP coding and to automate in Python stuff that might work in shell/awk but are more fun in python. To that end I'm reading Booch, just ordered an old copy of the Python Cookbook, and am coding a game/fiction tool to help me keep track of characters. It is often said to learn a language you grab the basics and then join a project. I'm happy to contribute to open source projects but the learning curve to "useful" has always been steep for me. There's gap between reading "Learning {language}" and contributing code. Python is very useful because all my RHEL boxes have it installed. If I build a tool I know it will be able to run. While I enjoy Ruby more, it's not on the servers and it ain't going on the servers. I need to be useful to keep getting paid. Due to developer count the ability to instigate a python project is easier than a non-rails ruby project so I can build my "software engineering team" skills as well. I appreciate your guidance and feedback; keep it coming! Leam -- https://mail.python.org/mailman/listinfo/python-list
Re: Beginners and experts (Batchelder blog post)
On Sat, Sep 23, 2017 at 5:26 PM, Ned Batchelder <n...@nedbatchelder.com> wrote: > On 9/23/17 2:52 PM, Leam Hall wrote: > >> On 09/23/2017 02:40 PM, Terry Reedy wrote: >> >>> https://nedbatchelder.com//blog/201709/beginners_and_experts.html >>> >>> Great post. >>> >> >> Yup. Thanks for the link. I often have that "I bet > Fred> doesn't get frustrated." thing going. Nice to know Ned bangs his head >> now and again. :P >> >> > "Ow!" --me Hehe...I've been trying to figure out how to phrase a question. Knowing I'm not the only one who gets frustrated really helps. I'm trying to learn to be a programmer. I can look at a book and read basic code in a few languages but it would be unfair to hire myself out as a programmer. I'm just not yet worth what it costs to pay my bills. To move forward takes a plan and time bound goals. At least for us old folks; we only have so much time left. I want to avoid retirement and just work well until I keel over. I don't come from a CS background but as a Linux sysadmin. My current push is OOP. Grady Booch's book on Analysis and Design is great and I've got the GoF for right after that. I've been doing more testing but need to write more tests. Writing code and starting to work with others on that code as well. The question is, what should a person "know" when hiring out as a programmer? What is 'know" and what should be "known"? Specifically with Python. Thanks! Leam -- https://mail.python.org/mailman/listinfo/python-list
Re: Beginners and experts (Batchelder blog post)
On 09/23/2017 02:40 PM, Terry Reedy wrote: https://nedbatchelder.com//blog/201709/beginners_and_experts.html Great post. Yup. Thanks for the link. I often have that "I bet Fred> doesn't get frustrated." thing going. Nice to know Ned bangs his head now and again. :P Leam -- https://mail.python.org/mailman/listinfo/python-list
Re: Change project licence?
On 09/23/2017 05:14 AM, Chris Angelico wrote: On Sat, Sep 23, 2017 at 7:07 PM, Kryptxywrote: Thank you all! I opened a ticket about the same (on github). I got response from most of them, and all are agreeing to the change. However, one contributor did not respond at all. I tried e-mailing, but no response. Can I still proceed changing the licence? It has been more than a week since the ticket was opened. Nope. Contributions made under the GPL have a guarantee that they will only and forever be used in open source projects. You're trying to weaken that guarantee, so you have to get clear permission from everyone involved. Unless you can show that the contributions in question are so trivial that there's no code that can be pinpointed as that person's, or you replace all that person's code, you can't proceed to relicense it without permission. I'm with Chris on this one. You made a social, and in many places legally binding, agreement. Can't change it without everyone's agreement. Like Chris said, evaluate the level of effort on the code. Wait, or replace. You will be happier when you take the honorable path. Leam -- https://mail.python.org/mailman/listinfo/python-list
Re: How to share class relationship representations?
On 09/19/2017 11:16 AM, Stefan Ram wrote: leam hall <leamh...@gmail.com> writes: I'm working on designing the classes, sub-classes, and relationships in my code. What is a good visual way to represent it so it can be stored in git and shared on the list without large images or attachments? Code /is/ design. I tried that with the small bit of code I have and was told it was too confusing. Still working on this. -- https://mail.python.org/mailman/listinfo/python-list
Re: Research paper "Energy Efficiency across Programming Languages: How does energy, time, and memory relate?"
On Tue, Sep 19, 2017 at 2:37 PM, Stephan Houben < stephan...@gmail.com.invalid> wrote: > Op 2017-09-19, Steven D'Aprano schreefpearwood.info>: > > > There is a significant chunk of the Python community for whom "just pip > > install it" is not easy, legal or even possible. For them, if its not in > > the standard library, it might as well not even exist. > > But numpy *is* in the standard library, provided you download the > correct version of Python, namely the one from: > > https://python-xy.github.io/ > > Stephan > > Many of us can't pip install; it's in the OS supplied vendor repo or it doesn't go on the machines. Leam -- https://mail.python.org/mailman/listinfo/python-list
How to share class relationship representations?
I'm working on designing the classes, sub-classes, and relationships in my code. What is a good visual way to represent it so it can be stored in git and shared on the list without large images or attachments? Thanks! Leam -- https://mail.python.org/mailman/listinfo/python-list
The Python-List community
A few days ago I pointed out that this list's community had "opportunities to improve". While we still have lots of those opportunities, it is good to see several community members raise the bar in welcoming new folks into the community. Thank you for your help and positive attitude! Leam -- https://mail.python.org/mailman/listinfo/python-list
Re: Unicode
Matt wrote: Hi Leam- > > Targeting Python 2.6 for deployment on RHEL/CentOS 6 is a perfectly > valid use case, and after the recent discussions in multiple threads > (your "Design: method in class or general function?" and INADA Naoki's > "People choosing Python 3"), I doubt it would be very useful to > reiterate the same points. > > I can't speak for Peter Otten, but I suspect he was making a very narrow > statement about one of the large backwards-incompatible changes in > Python 3: strict separation between text (str) and binary data (bytes). > This stricter distinction eliminates the conceptual problems you > described, in terms of ensuring that you need to use the right type at > the right time in the right place, and would probably have prevented > your problem entirely. > > Additionally, your note of "this works in Python 2 but fails in Python > 3" shows some text-related confusion that is quite common when dealing > with the text model in Python 2. It is always the case that the > `__str__` method should return a `str` object under whichever version of > Python you're using, and your attempt of `self.name.encode("utf-8")` > returns the wrong type under Python 3. *Encoding* Unicode text (class > `unicode` under Python 2, `str` under 3) produces binary data (class > `str` under Python 2, `bytes` under 3). As such, you're returning a > `bytes` object from `__str__` in Python 3, which is incorrect. It would > be appropriate to do something like > > """ > def __str__(self): > if sys.version_info[0] < 3: > return self.name.encode("utf-8") > return self.name > """ > > Django provides a `python_2_unicode_compatible` decorator that allows > always returning text (class `unicode` under Python 2, `str` under 3) > from `__str__`, and automatically rewrites a class' methods under Python > 2. That decorator renames `__str__` to `__unicode__`, and creates a new > `__str__` method that essentially returns > `self.__unicode__().encode('utf-8')`. > > (Hopefully this is clear enough, but I intended this message to be > practical advice for your current task and mental model of what's going > on, *not* as Python 3 evangelism.) > > MMR... > > Matt, thanks! I figured there was a way to get the python major version, just hadn't gotten there yet. Your code passes user typing and testing. Peter has earned a lot of leeway due to his expert help and reasonable manner. I took his comment as a friendly note and, like yours, not Py3 evangelism. Most of my frustration isn't with the community though I think it has come off that way. I'm not a good enough coder to get a job with pay close to what I make as a Linux guy. I just have to deal with the pay check coming from where I am and not where the rest of the gang is. :( Leam -- https://mail.python.org/mailman/listinfo/python-list
Re: Unicode
On Sun, Sep 17, 2017 at 3:27 PM, Peter Otten <__pete...@web.de> wrote: > leam hall wrote: > > > Doesn't seem to work. The failing code takes the strings as is from the > > database. it will occasionally fail when a name comes up that uses > > a non-ascii character. > > Your problem in nuce: the Python 2 __str__() method must not return > unicode. > > >>> class Character: > ... def __str__(self): return u"Brösel" > ... > >>> print(Character()) > Traceback (most recent call last): > File "", line 1, in > UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in > position > 2: ordinal not in range(128) > > While you may define a __unicode__ method it has to be called explicitly: > > >>> class Character: > ... def __unicode__(self): return u"Brösel" > ... > >>> print(Character()) > <__main__.Character instance at 0x7fc10020f5a8> > >>> print(unicode(Character())) > Brösel > > Another alternative is to convert explicitly, to some encoding, and hope it > works in the actual environment: > > >>> class Character: > ... def __unicode__(self): return u"Brösel" > ... def __str__(self): return unicode(self).encode("utf-8") > ... > >>> print(Character()) > Brösel > Ah! So this works in Py2: def __str__(self): name= self.name.encode("utf-8") It completely fails in Py3: PVT b'Lakeisha F\xc3\xa1bi\xc3\xa1n' 7966A4 [F] Age: 22 Note that moving __str__() to display() gets the same results. Not sure it is an issue with __str__. > The more you think about it the more attractive a switch to Python 3 will > appear. > Not for me, actually. I'm trying to learn better OOP and coding in general. I'm using Python because there's a work related use case for Py2. There isn't one for Py3. If the work use case it removed then there are lots of languages to try out. -- https://mail.python.org/mailman/listinfo/python-list
Re: Unicode
On Sun, Sep 17, 2017 at 9:13 AM, Peter Otten <__pete...@web.de> wrote: > Leam Hall wrote: > > > On 09/17/2017 08:30 AM, Chris Angelico wrote: > >> On Sun, Sep 17, 2017 at 9:38 PM, Leam Hall <leamh...@gmail.com> wrote: > >>> Still trying to keep this Py2 and Py3 compatible. > >>> > >>> The Py2 error is: > >>> UnicodeEncodeError: 'ascii' codec can't encode character > >>> u'\xf6' in position 8: ordinal not in range(128) > >>> > >>> even when the string is manually converted: > >>> name= unicode(self.name) > >>> > >>> Same sort of issue with: > >>> name= self.name.decode('utf-8') > >>> > >>> > >>> Py3 doesn't like either version. > >> > >> You got a Unicode *EN*code error when you tried to *DE* code. That's a > >> quirk of Py2's coercion behaviours, so the error's a bit obscure, but > >> it means that you (most likely) actually have a Unicode string > >> already. Check what type(self.name) is, and see if the problem is > >> actually somewhere else. > >> > >> (It's hard to give more specific advice based on this tiny snippet, > >> sorry.) > >> > >> ChrisA > >> > > > > Chris, thanks! I see what you mean. > > I don't think so. You get a unicode from the database, > > $ python > Python 2.7.6 (default, Oct 26 2016, 20:30:19) > [GCC 4.8.4] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import sqlite3 > >>> db = sqlite3.connect(":memory:") > >>> cs = db.cursor() > >>> cs.execute("select 'foo';").fetchone() > (u'foo',) > >>> > > and when you try to decode it (which is superfluous as you already have > unicode!) Python does what you ask for. But to be able to decode it has to > encode first and by default it uses the ascii codec for that attempt. For > an > all-ascii string > > u"foo".encode("ascii") --> "foo" > > and thus > > u"foo".decode("utf-8) > > implemented as > > u"foo".encode("ascii").decode("utf-8") --> u"foo" > > is basically a noop. However > > u"äöü".encode("ascii") --> raises UnicodeENCODEError > > and thus > > u"äöü".decode("utf-8") > > fails with that. Unfortunately nobody realizes that the encoding failed and > thus will unsuccessfully try and specify other encodings for the decoding > step > > u"äöü".decode("latin1") # also fails > > Solution: if you already have unicode, leave it alone. > Doesn't seem to work. The failing code takes the strings as is from the database. it will occasionally fail when a name comes up that uses a non-ascii character. Lines 44, 60, 66, 67. https://github.com/makhidkarun/py_tools/blob/master/lib/character.py Leam -- https://mail.python.org/mailman/listinfo/python-list
Re: Old Man Yells At Cloud
Hmm... scratch the "young" and "Javascripters". Why lump them together since I bet it's just a vocal few? Better to have said "people who don't want to really learn the new language". On 09/17/2017 06:03 AM, Leam Hall wrote: Different view, I guess. I'm glad all the young Javascripters have that issue. As an old guy trying to re-learn more python it gives me an advantage. I'm usually interested in the best thislanguage-native way to do something. Doing so makes me learn the language faster and tends to generate better code. That said, I'll often steal what I've learned before to understand the new. Some helpful folks on IRC asked why I was using getopt instead of argparse. Mostly because I come from a bash background. Looking at Python's argparse would have stumped me if I hadn't already done the same thing with Ruby's argparse. I'm still trying to figure out how to convert a string to unicode in Python 2. I've done it in Ruby 1.8.7 so I assume Python 2 can do it and that I'm just a bit slow. Leam -- https://mail.python.org/mailman/listinfo/python-list
Re: Old Man Yells At Cloud
Different view, I guess. I'm glad all the young Javascripters have that issue. As an old guy trying to re-learn more python it gives me an advantage. I'm usually interested in the best thislanguage-native way to do something. Doing so makes me learn the language faster and tends to generate better code. That said, I'll often steal what I've learned before to understand the new. Some helpful folks on IRC asked why I was using getopt instead of argparse. Mostly because I come from a bash background. Looking at Python's argparse would have stumped me if I hadn't already done the same thing with Ruby's argparse. I'm still trying to figure out how to convert a string to unicode in Python 2. I've done it in Ruby 1.8.7 so I assume Python 2 can do it and that I'm just a bit slow. Leam -- https://mail.python.org/mailman/listinfo/python-list
Re: the core values of the Python "platform"
On Wed, Sep 13, 2017 at 9:08 AM, Darin Gordonwrote: > Bryan Cantrill gave an interesting talk recently at a Node conference about > "platform values" [1]. The talk lead me to think about what the core values > of the Python "platform" are and I thought it would be good to ask this > question of the community. What would you consider the top (<= 5) core > values? > > Would that be close to the Zen of Python? -- https://mail.python.org/mailman/listinfo/python-list
Re: Python dress
On 09/12/2017 04:00 PM, Ben Finney wrote: Larry Martellwrites: https://svahausa.com/collections/shop-by-interest-1/products/python-code-fit-flare-dress (And if any guys want to wear this, there's nothing wrong with that.) Boo, the code is not PEP 8 conformant :-) If it weren't for the bad code style, I might consider it. The dress looks good! Note that a google search of "python muscle shirt" didn't seem to come up with any code. Wonder why? :P -- https://mail.python.org/mailman/listinfo/python-list
Re: The Incredible Growth of Python (stackoverflow.blog)
On Tue, Sep 12, 2017 at 8:28 AM, Steve D'Aprano <steve+pyt...@pearwood.info> wrote: > On Tue, 12 Sep 2017 09:20 pm, Leam Hall wrote: > > > But if someone comes onto the list, or IRC, and says they need to stay > > on Python 2 then please drop the dozens of e-mails and comments about > > upgrading. > [...] > > My recent experience with some people's inability to take "Sorry, I > > can't" for an answer has been a real turn-off. I have requirements that > > dictate Python. If this was a personal venture I'd already be elsewhere > > purely because the Python community on the list and IRC is so > unwelcoming. > > Leam, I've defended people choosing to remain on older versions of Python, > even > as old as 1.5. The most recent was just a couple of minutes ago, in my > response > to Chris. It's not nice or friendly of you to tar the entire community > with a > reputation because of one or two people saying something you don't want to > debate. > > But it isn't all about you. Just because you started this thread -- oh > wait, you > didn't *wink* -- doesn't mean you control its direction. If people want to > discuss the pros and cons of upgrading, without specifically badgering > you, you > should remember that *it isn't about you* and don't take it personally. > Steve, just a quick follow-up. Thank you for calling me out on this! It's wrong for me to do something I complain about others doing. Feel free to reach through the ether and smack me if I do this again. Leam -- https://mail.python.org/mailman/listinfo/python-list
Re: The Incredible Growth of Python (stackoverflow.blog)
On 09/12/2017 08:28 AM, Steve D'Aprano wrote: On Tue, 12 Sep 2017 09:20 pm, Leam Hall wrote: But if someone comes onto the list, or IRC, and says they need to stay on Python 2 then please drop the dozens of e-mails and comments about upgrading. [...] My recent experience with some people's inability to take "Sorry, I can't" for an answer has been a real turn-off. I have requirements that dictate Python. If this was a personal venture I'd already be elsewhere purely because the Python community on the list and IRC is so unwelcoming. Leam, I've defended people choosing to remain on older versions of Python, even as old as 1.5. The most recent was just a couple of minutes ago, in my response to Chris. It's not nice or friendly of you to tar the entire community with a reputation because of one or two people saying something you don't want to debate. But it isn't all about you. Just because you started this thread -- oh wait, you didn't *wink* -- doesn't mean you control its direction. If people want to discuss the pros and cons of upgrading, without specifically badgering you, you should remember that *it isn't about you* and don't take it personally. WHAT?!?!?! It isn't all about me? Dang... Steve, you're right; sorry for painting with such a broad brush. Even the people who occasionally post something that seems problematic (to me) are usually helpful. A few months ago my manager asked about what direction I recommended for the team. I'm the opinionated old guy who is new to this team. At the time I was really enjoying Ruby; just so dang fun! I told my manager that we should use python. It is the best choice for the team since we're on RHEL 6. Ruby wasn't on the machines but Python 2.6.6 is. Any code I write that is python 2.6.6 compatible should run on every machine. My answer meant I had to re-direct personal time and attention so I could help the team move forward. There are certain things I can do; learn to code better, write more tests, and figure out OOP. Some things I can't do; changing the supported python version is on that list. Python is the right choice for a lot of use cases. Python 3 is the right choice for a large sub-set of those use cases. Python 2 is the best choice for a much smaller subset. -- https://mail.python.org/mailman/listinfo/python-list
Re: The Incredible Growth of Python (stackoverflow.blog)
Steve, Thank you very much. I appreciate your wisdom and support. Leam -- https://mail.python.org/mailman/listinfo/python-list
Re: Design: method in class or general function?
On Mon, Sep 11, 2017 at 7:48 AM, Stefan Ram <r...@zedat.fu-berlin.de> wrote: > Leam Hall <leamh...@gmail.com> writes: > >Haven't read the GoF book. Last time I checked it said "this is only > >useful if you know Java" > > In the edition of 1997, some design patterns are accompanied > with examples in C++ or Smalltalk, but the majority of the > patterns is language agnostic (often UML diagrams are used). > Also, I may have been thinking of the "Head First Design Patterns" book. Looks like I need to talk to my good buddy Amazon... -- https://mail.python.org/mailman/listinfo/python-list
Python in Perspective
y'all, My god-kids and their proginators lost most everything because of Harvey. I spent much of yesterday worrying about a friend who had gone quiet as he evacuated his family ahead of Irma. Please keep Python in perspective. Whether we use 1.5 or 4rc1 is a lot less critical than using Python to work together well and solving big problems as friends. In years gone by I spent time on the soapbox but never came away cleaner or with stronger friendships. I just ranted and spent years wondering why nothing actually changed. Please don't make my mistake; come up with your own. Together. As friends. Leam -- https://mail.python.org/mailman/listinfo/python-list
Re: Using Python 2
Various responses in no particular order: On 09/08/2017 09:57 AM, Ned Batchelder wrote: I've heard a lot of FUD about the Python 3 transition, but this one is new to me. What is it that CompSci folks want that developers don't want, that ruined Python 3? It's not FUD if it's true. Calling it FUD without checking is, um, FUD. The phrase was "many of the changes in Python 3 are theoretically based, cleaning up of how Python does things to make them fit with what Computer Science teaches." On 09/08/2017 08:51 AM, Chris Angelico wrote: > Let's see. You can port your code from Python 2.7 to Python 3.6 by > running a script and then checking the results for bytes/text > problems. I ran 2to3 on some code that worked under 2.6.6. and 3.6.2. 2to3 broke it for both versions and it was a fairly trivial script. On 09/08/2017 08:42 AM, Marko Rauhamaa wrote: > That's somewhat irrelevant. Point is, Python 2 will quickly become a > pariah in many corporations during or after 2018, and we are going to > see emergency measures similar to the Y2K craze twenty years ago. > > The risk to Python will be whether the occasion is exploited by > fanboys of competing programming languages. The migration from Python2 > might be to something else than Python 3 in some circles. To me this is where the Python community comes in. Moving 3,000 servers from RHEL 6 to something that uses Python 3 isn't a trivial task when most of those servers are not homogenous HPC nodes. If Python 2 has bugs that aren't going to be fixed, then let's ask the question. If Python 3 was a total re-write that is not backwards compatible then it likely has some of the same bugs (due to same coders) plus new ones. If Python 3 is not a total re-write then why break compatibility? To say Python 2 is old is true. What does it matter though? Unless Python 3 provides a business value for spending lots of time and money to change then "old" doesn't matter. You're right that people may migrate to something besides Python. For me that question is real and some of the fuel is how the community can't understand that I work on servers that only have an old version of python. So far one person has answered the original design question. Everyone else has tried to convince me of something that is financially and professionally impossible and completely useless. If you want to encourage people to move from Python 2 to 3 then continue to help answer questions when they are Python 2 based. Over time an individuals preference will be to move to Python 3 since 90% of the skill is already there. From a purely "is python a good language for many use cases" perspective the answer is yes. Welcome people and let their task needs and passions drive the change. Leam -- https://mail.python.org/mailman/listinfo/python-list
Re: Using Python 2
On 09/08/2017 06:40 AM, Marko Rauhamaa wrote: Leam Hall <leamh...@gmail.com>: However, those millions of servers are running Python 2.6 and a smaller number running 2.7. At least in the US market since Red Hat Enterprise Linux and its derivatives run 2.6.6 (RHEL 6) or 2.7.5 (RHEL 7). Not sure what Python SuSE uses but they seem to have a fairly large European footprint. RHEL 7 goes out the active support door (End of Production Phase 3) mid-2024. Ok, the owners of those millions of servers have a problem in their hands. What you are saying is that there will be a bonanza next year for Python 2-to-3 consultants. It will also involve a forced upgrade to RHEL 8 (which is nowhere in sight yet). Not really, though a growing market is good. The OS system tools are in Python 2 so that's what is installed. Nothing prevents an application from installing Python 3, it just can't overwrite the OS python. Application developers can put Python 3 in /usr/local or can use one of the probably older python3 rpm stacks. My dev box has both the OS Python 2.6.6 and Python 3.6.2 called as python3. -- https://mail.python.org/mailman/listinfo/python-list
Re: Design: method in class or general function?
On 09/08/2017 03:06 AM, Peter Otten wrote: I'm pleading "method" as it allows per-class implementation. Peter, as always you are a wealth of information! I have some extra time today to digest your notes and visualize tap dancing Marines. Thank you! -- https://mail.python.org/mailman/listinfo/python-list
Re: Design: method in class or general function?
On Thu, Sep 7, 2017 at 8:16 AM, Steve D'Aprano <steve+pyt...@pearwood.info> wrote: > On Thu, 7 Sep 2017 07:20 pm, Leam Hall wrote: > > > OOP newbie on Python 2.6. > > Python 2.6 is ancient, and is missing many nice features. You should > consider > using the latest version, 3.6. > I've wrestled with that discussion for a while and Python 3 loses every time. There's literally no good reason for me to move to Python 3 earlier than mid-2020's. Please accept the fact that there are hundreds of thousands of servers, if not millions, running Python 2.x. Whether or not Python 3 has any neat cool stuff is irrelevant to those of us seeking to use Python to get today's work done. > I create instances of Character class with an attribute dict of > > 'skills'. The 'skills' dict has the name of a skill as the key and an > > int as a value. The code adds or modifies skills before outputting the > > Character. > > > > Is it better design to have a Character.method that takes a 'skill' key > > and optional value or to have a general function that takes an instance, > > a dict, a key, and an optional value? > > I'm afraid your example is too generic for me to give an opinion. Do you > literally mean a method called "method"? What does it do? > Using this: https://github.com/makhidkarun/py_tools/blob/master/lib/character.py Line 19 sets "self.skills" either from the passed in data or from https://github.com/makhidkarun/py_tools/blob/master/lib/character_tools.py#L34-L48 So Character.skills is a dict with a string key and an int value. I need to be able to add skills and my first attempt is a function: https://github.com/makhidkarun/py_tools/blob/master/lib/character_tools.py#L52-L56 Should the "add_skills" function be a method in the character class or be made a more generic function to add/modify a key/value pair in a dict that is an attribute of an instance? Other tasks will require the add/modify functionality but coding that increases complexity. At least for me, anyway. Sorry about being unclear earlier, coffee was still kicking in and I'm still a newbie that mixes up terms. Leam -- https://mail.python.org/mailman/listinfo/python-list
Re: doctest random output?
On 08/28/2017 11:40 AM, Dennis Lee Bieber wrote: ... a bunch of good stuff ... I'm (re-)learning python and just trying make sure my function works. Not at the statistical or cryptographic level. :) Thanks! Leam -- https://mail.python.org/mailman/listinfo/python-list
doctest random output?
Is this a good way to test if random numeric output? It seems to work under Python 2.6 and 3.6 but that doesn't make it 'good'. ### Code import random def my_thing(): """ Return a random number from 1-6 >>> 0 < my_thing() <=6 True >>> 6 < my_thing() False """ return random.randint(1,6) if __name__ == "__main__": import doctest doctest.testmod() ### Results python3 test_doctest.py -v Trying: 0 < my_thing() <=6 Expecting: True ok Trying: 6 < my_thing() Expecting: False ok 1 items had no tests: __main__ 1 items passed all tests: 2 tests in __main__.my_thing 2 tests in 2 items. 2 passed and 0 failed. Test passed. -- https://mail.python.org/mailman/listinfo/python-list
Re: SQLObject 3.4.0
#I'm pleased to announce version 3.4.0, the first stable release of branch #3.4 of SQLObject. # # #What's new in SQLObject #=== # #* Python 2.6 is no longer supported. The minimal supported version is # Python 2.7. Is there a particular reason to eliminate RHEL 6 (Python 2.6) support? That would seem to limit your enterprise adoption. -- https://mail.python.org/mailman/listinfo/python-list
Re: PyYaml not using Yaml 1.2?
On Fri, Aug 4, 2017 at 11:52 AM, Skip Montanarowrote: > > Getting in to Ansible and back into Python. Ansible uses pyyaml which > says > > it parses yaml version 1.1. Is there a reason it doesn't do yaml version > > 1.2? > > Nobody's done the work? Note that on the PyPI page: > > https://pypi.python.org/pypi/PyYAML > > the last release was almost a year ago. That said, 1.2 has been out > for awhile. There is an open ticket, nearly four years old: > > https://bitbucket.org/xi/pyyaml/issues/23/support-yaml-12 > > Perhaps you can help move that forward. > > Skip > Hey Skip, thanks! Tracked down the GitHub repo (https://github.com/yaml/pyyaml) and it seems to be gearing back up. I'll see what I can do to help. Leam -- https://mail.python.org/mailman/listinfo/python-list
PyYaml not using Yaml 1.2?
Getting in to Ansible and back into Python. Ansible uses pyyaml which says it parses yaml version 1.1. Is there a reason it doesn't do yaml version 1.2? Thanks! Leam -- https://mail.python.org/mailman/listinfo/python-list