make_obcallback(): could not import mod_python.apache

2005-02-16 Thread Christopher
hon/apache.py", line 55, in ? import _apache ImportError: No module named _apache Any guidance would be greatly appreciated. Christopher -- http://mail.python.org/mailman/listinfo/python-list

Re: jitpy - Library to embed PyPy into CPython

2014-12-08 Thread Christopher
On Saturday, December 6, 2014 3:30:56 PM UTC-5, Albert-Jan Roskam wrote: > > On Fri, Dec 5, 2014 8:54 PM CET Mark Lawrence wrote: > > >For those who haven't heard thought this might be of interest > >https://github.com/fijal/jitpy > > Interesting, but it is not clear

Re: jitpy - Library to embed PyPy into CPython

2014-12-09 Thread Christopher
To: Albert-Jan Roskam On Saturday, December 6, 2014 3:30:56 PM UTC-5, Albert-Jan Roskam wrote: > > On Fri, Dec 5, 2014 8:54 PM CET Mark Lawrence wrote: > > >For those who haven't heard thought this might be of interest https://github.com/fijal/jitpy > > Interesting,

Re: Building Python 2.5.2 for Itanium

2008-11-23 Thread Christopher
On Nov 21, 3:50 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > >   I need to compile that module for that release and platform, but I > > have been unable to discover which MS compiler version and runtime was > > used to generate the binaries.  My understanding is that Python 2.5.2 > > in gener

Re: 404 not found on for Python 2.6 Itanium

2008-11-23 Thread Christopher
On Nov 21, 7:35 pm, r0g <[EMAIL PROTECTED]> wrote: > Martin v. Löwis wrote: > >> In any case, my concern with dropping a stock python itanium distro > >> involves the vastly diminished probability that others will provide > >> Itanium versions of, for example py2exe and pywin32. > > > Well, I had b

Re: 404 not found on for Python 2.6 Itanium

2008-11-23 Thread Christopher
On Nov 21, 8:55 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > Christopher wrote: > >> Yes. It's too much effort to build, and too few users that actually > >> use it. Users are still free to build it themselves, and to share > >> the build with others. >

Re: Building Python 2.5.2 for Itanium

2008-11-24 Thread Christopher
On Nov 21, 3:50 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > >   I need to compile that module for that release and platform, but I > > have been unable to discover which MS compiler version and runtime was > > used to generate the binaries.  My understanding is that Python 2.5.2 > > in gener

Re: Guido's new method definition idea

2008-12-08 Thread Christopher
> > I'd like this new way of defining methods, what do you guys think? > Anyone ready for writing a PEP? I don't really see any advantage. IMHO, it is not clearer, it is not more concise, it makes the definition of class shared variables look really out of place. It also makes the new programmer

Re: 404 not found on for Python 2.6 Itanium

2008-11-21 Thread Christopher
> Yes. It's too much effort to build, and too few users that actually > use it. Users are still free to build it themselves, and to share > the build with others. I guess that I don't understand why you feel there is so much effort involved. I developed a set of makefiles that build Python and a

Building Python 2.5.2 for Itanium

2008-11-21 Thread Christopher
Hello, A tool that we use needs to be ported to Itanium. It wsa written for Python 2.5.2, and so I was happily using the Itanium version of that release. However, as I have gotten deeper into the port, I see that ctypes was not included with the Itanium Python 2.5.2 release. I need to compi

Re: What text editor is everyone using for Python

2009-06-02 Thread Christopher
On May 25, 1:35 pm, LittleGrasshopper wrote: > With so many choices, I was wondering what editor is the one you > prefer when coding Python, and why. I normally use vi, and just got > into Python, so I am looking for suitable syntax files for it, and > extra utilities. I dabbled with emacs at some

Re: Some syntactic sugar proposals

2010-11-17 Thread Christopher
> ? Of course we can write it as >     t = foo() if pred(foo()) else default_value > but here we have 2 foo() calls instead of one. Why can't we write just > something like this: >     t = foo() if pred(it) else default_value > where "it" means "foo() value"? i don't like magic names. what about:

Python 2.7 re.IGNORECASE broken in re.sub?

2010-08-15 Thread Christopher
I have the following problem: Python 2.7 (r27:82525, Jul 4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> t="Python26" >>> import re >>> re.sub(r"python\d\d", "Python27", t) 'Python26' >>> re.sub(r"python\d\d", "Pyth

Re: Python 2.7 re.IGNORECASE broken in re.sub?

2010-08-16 Thread Christopher
On Aug 15, 8:07 pm, Steven D'Aprano wrote: > On Sun, 15 Aug 2010 16:45:49 -0700, Christopher wrote: > > I have the following problem: > > >>>> t="Python26" > >>>> import re > >>>> re.sub(r"python\d\d", "

Re: www.python.org website is down?

2009-08-10 Thread Christopher
On Aug 8, 5:50 pm, Pouya Khankhanian wrote: > On Aug 8, 11:49 am, Sharath wrote: > > > > > On Aug 8, 11:33 am, Pouya Khankhanian wrote: > > > > On Aug 8, 11:17 am, "Martin v. Löwis" wrote: > > > > > > This is probably a stupid question, but Is there going to be any data > > > > > loss if it tur

Computing win/loss records in Python

2012-08-25 Thread Christopher McComas
Greetings, I have code that I run via Django that grabs the results from various sports from formatted text files. The script iterates over every line in the formatted text files, finds the team in the Postgres database updates their w/l record depending on the outcome on that line, saves the t

Re: The pythonic way equal to "whoami"

2011-06-08 Thread Christopher Head
On Wed, 08 Jun 2011 21:58:17 +0800 TheSaint wrote: > Kushal Kumaran wrote: > > > os.geteuid > This return 0 for *root* . I don't know if it's a standard for all > distro. Mine is Archlinux. > I'd just like to avoid error caused by wrong access by user > It is. Until Linux capabilities, EUID==0

Re: Questions about os.waitpid(pid, options) on windows

2011-07-15 Thread Christopher Head
On Mon, 11 Jul 2011 20:59:29 -0700 (PDT) Fan wrote: > It seems that waitpid take process handle instead of process id as the > first parameter on Windows. On Unices platform, the first parameter > is process id. > > This interface is a little bit confusing. What's the purpose for such > a desig

Messed up Mac installation

2011-08-16 Thread Christopher Brewster
p run on Tue Aug 16 11:46:28 2011 Cannot uninstall requirement reportlab, not installed" So why is it installing to one place (the 2.6 library) and trying to uninstall elsewhere (the 2.7 library)? I know this has been discussed many times but I do not know how to track this down. Thanks

Re: scope of function parameters

2011-05-29 Thread Christopher Head
On Sun, 29 May 2011 16:19:11 -0400 Henry Olders wrote: > > def fnc2(c): > > c = c[:] > >c[1] = 'having' > >return c > > Thank you, Wolfgang. That certainly works, but to me it is still a > workaround to deal with the consequence of a particular decision. > From my per

Python hoodie

2011-05-31 Thread Christopher James
Hi all! I LOVE Python, and want to spread the word by sporting this awesome sweater shown at: http://www.freewear.org/?page=show_item&id=FW0067 which I found by looking on the merchandise page of python.org. However, I live in the United States and before checking out I noticed that on top of the

Re: Setting property for current class from property in an different class...

2017-09-06 Thread Christopher Reimer
> On Sep 6, 2017, at 9:14 PM, Stefan Ram wrote: > > I can run this (your code) without an error here (Python 3.6.0), > from a file named "Scraper1.py": I'll check tomorrow. I recently switched from 3.5.x to 3.6.1 in the PyCharm IDE. It's probably FUBAR in some obscure way. Thanks, Chris R.

Re: Using Python 2

2017-09-08 Thread Christopher Reimer
> On Sep 8, 2017, at 6:57 AM, Ned Batchelder wrote: > > What is it that CompSci folks want that developers don't > want, that ruined Python 3? Long-winded debates about obscure language features that left the layman programmers in the bit bucket about 50+ comments ago. While some of this can b

Re: Merge pdf files using information from two files

2017-09-08 Thread Christopher Reimer
> On Sep 8, 2017, at 1:21 PM, accessnew...@gmail.com wrote: > Ideas as to how to accomplish this? Export your spreadsheets as Comma Separated Values (CSV) files and use the CSV module to read/write those files. https://docs.python.org/3/library/csv.html Chris R. -- https://mail.python.org/m

Re: Simple board game GUI framework

2017-09-11 Thread Christopher Reimer
> On Sep 11, 2017, at 3:58 AM, Paul Moore wrote: > > I'm doing some training for a colleague on Python, and I want to look > at a bit of object orientation. For that, I'm thinking of a small > project to write a series of classes simulating objects moving round > on a chess-style board of squares

Re: "tkinter"

2017-09-13 Thread Christopher Reimer
> On Sep 13, 2017, at 5:28 AM, Stefan Ram wrote: > > I presume that "tkinter" is intended to be pronounced > "logically": > > T K inter (tee kay inter /ti keI In t%/) > > . But it would be faster to pronounce it > > T kinter (tee kinter /ti kIn t%/) > > . So far I've only ever read it, n

Re: The Incredible Growth of Python (stackoverflow.blog)

2017-09-14 Thread Christopher Reimer
> On Sep 13, 2017, at 10:12 PM, Paul Rubin wrote: > > Ben Finney writes: >>> I've never seen one. >> who has told you... they are working on a Python 3 code base. > > Just because they've told me about it doesn't mean I saw it personally. > The ones I've seen, including new ones, are Python 2.

Re: Old Man Yells At Cloud

2017-09-17 Thread Christopher Reimer
> On Sep 17, 2017, at 2:19 PM, Ned Batchelder wrote: > >> On 9/16/17 1:38 AM, Steve D'Aprano wrote: >> /rant on >> >> So apparently everyone who disagrees that Python should be more like >> Javascript >> is an old greybeard fuddy-duddy yelling "Get off my lawn!" to the cool kids >> -- >> and i

Re: Even Older Man Yells At Whippersnappers

2017-09-19 Thread Christopher Reimer
> On Sep 19, 2017, at 9:09 AM, justin walters > wrote: > > On Tue, Sep 19, 2017 at 8:59 AM, Grant Edwards > wrote: > >>> On 2017-09-19, Rhodri James wrote: On 19/09/17 16:00, Stefan Ram wrote: D'Arcy Cain writes: > of course, I use calculators and computers but I still understa

Re: errors with json.loads

2017-09-20 Thread Christopher Reimer
t; Someone has posted programs with \xA0 (NBSP IIRC) > at the start of lines of the soure here before, in: > > From: Christopher Reimer > Newsgroups: comp.lang.python > Subject: Setting property for current class from property in an different > class... > Date: Wed, 6 Sep 2017

Re: Spacing conventions

2017-09-27 Thread Christopher Reimer
On Sep 27, 2017, at 12:50 AM, Bill wrote: > > Ever since I download the MyCharm IDE a few days ago, I've been noticing all > sort of "spacing conventions (from PEP) that are suggested. How do folks > regard these in general? > > For instance, the conventions suggest that > > if x>y : >

Re: How best to initialize in unit tests?

2017-10-04 Thread Christopher Reimer
On Oct 4, 2017, at 6:07 AM, Skip Montanaro wrote: > > Suppose you want to test a package (in the general sense of the word, > not necessarily a Python package). You probably have specific unit > tests, maybe some doctests scattered around in doc strings. Further, > suppose that package requires y

How to determine lowest version of Python 3 to run?

2017-10-04 Thread Christopher Reimer
Greetings, I've always installed the latest and greatest version of Python 3 to develop my own programs. I'm planning to release a program to the public. I could toss in a note that the program runs on the latest version of Python 3.6 but I haven't tested on earlier versions (i.e., 3.4 and 3.5)

Re: Good virtualenv and packaging tutorials for beginner?

2017-10-04 Thread Christopher Reimer
On Oct 4, 2017, at 3:49 AM, Leam Hall wrote: > > 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 p

Re: How to determine lowest version of Python 3 to run?

2017-10-05 Thread Christopher Reimer
On Oct 5, 2017, at 1:11 PM, Irmen de Jong wrote: > >> On 10/05/2017 04:23 AM, Christopher Reimer wrote: >> >> I'm leaning towards installing the latest minor version of each available >> major version, running tox to run the unit tests against each o

Re: How to determine lowest version of Python 3 to run?

2017-10-06 Thread Christopher Reimer
On Oct 5, 2017, at 3:34 PM, Christopher Reimer wrote: > >> On Oct 5, 2017, at 1:11 PM, Irmen de Jong wrote: >> >>> On 10/05/2017 04:23 AM, Christopher Reimer wrote: >>> >>> I'm leaning towards installing the latest minor version of each avail

Re: How to determine lowest version of Python 3 to run?

2017-10-06 Thread Christopher Reimer
On Oct 6, 2017, at 12:58 PM, Stephan Houben wrote: > > Op 2017-10-06, Christopher Reimer schreef : > >> So I got tox and tox-docker installed. When I went to install Docker >> for Windows, it wouldn't work because Hyper-V wasn't available on >> Windows 10

Re: Lies in education [was Re: The "loop and a half"]

2017-10-11 Thread Christopher Reimer
On Oct 11, 2017, at 9:07 AM, Bill wrote: > > Grant Edwards wrote: >> On 2017-10-11, Bill wrote: >> >> >>> [...] I'm not here to "cast stones", I like Python. I just think >>> that you shouldn't cast stones at C/C++. >> Not while PHP exists. There aren't enough stones in the world... >> > >

Re: Best practise for passing time as arguments

2017-10-14 Thread Christopher Reimer
On Oct 14, 2017, at 10:44 AM, Thomas Jollans wrote: > >> On 14/10/17 19:34, Stefan Ram wrote: >> r...@zedat.fu-berlin.de (Stefan Ram) writes: >>> a post. Use whatever is appropriate in the special case >>> given, or - to write a general library -, learn the design >>> of a good existing library,

Can't find latest version of 3.4.x on download page

2017-10-17 Thread Christopher Reimer
Greetings, I'm setting up different test environments for tox. I can't find Windows installer for the latest version of Python 3.4 on the download page. Versions 3.4.5 to 3.4.7 only have the source files available. Version 3.4.4 is the last version with Windows installers. Testing on Python 3.

Re: Application and package of the same name

2017-10-21 Thread Christopher Reimer
On Oct 21, 2017, at 6:08 AM, David Stanek wrote: > This is actually a common pattern I see when teaching the language. For > example, when a student wants to test out a package like requests many > seem to initially want to create a requests.py module. Then they become > very confused when they g

Re: Python noob having a little trouble with strings

2017-10-27 Thread Christopher Reimer
On Oct 27, 2017, at 1:49 AM, Peter J. Holzer wrote: > > BTW, I find it hard to believe that PyCharm for the Mac "comes with" > Python 2.6. Python 2.6 is quite old. The Linux version isn't bundled > with a python interpreter and just uses whatever is already installed on > the machine. I guess it'

Keep or drop index.html from Django?

2017-10-27 Thread Christopher Reimer
Greetings, When I set up my static website using Pelican several years ago, many URLs ended with index.html. Now that I'm looking at Django, I got a small set of URLs working with and without index.html to point to the correct pages. I read somewhere that the Django philosophy was to keep the U

Re: converting numbers into words (Posting On Python-List Prohibited)

2017-11-09 Thread Christopher Reimer
On Nov 9, 2017, at 3:45 AM, John Ladasky wrote: > >> On Wednesday, November 8, 2017 at 11:40:18 PM UTC-8, Lawrence D’Oliveiro >> wrote: >>> On Thursday, November 9, 2017 at 7:51:35 PM UTC+13, r16...@rguktrkv.ac.in >>> wrote: >>> >>> How can I covert numbers into word like ex:-123 One hundred t

Re: How to Generate dynamic HTML Report using Python

2017-11-21 Thread Christopher Reimer
On Nov 21, 2017, at 5:36 AM, Rustom Mody wrote: > >> On Tuesday, November 21, 2017 at 5:27:42 PM UTC+5:30, Ned Batchelder wrote: >>> On 11/20/17 9:50 AM, Stefan Ram wrote: >>> Ned Batchelder writes: Also, why set headers that prevent the Python-List mailing list from archiving your mes

Re: connect four (game)

2017-11-25 Thread Christopher Reimer
On Nov 25, 2017, at 9:16 AM, Ian Kelly wrote: > >> On Sat, Nov 25, 2017 at 10:02 AM, Chris Angelico wrote: >>> On Sun, Nov 26, 2017 at 3:36 AM, Ian Kelly wrote: On Sat, Nov 25, 2017 at 6:00 AM, bartc wrote: Where are your unittests for these unittests? >>> >>> No, the point of havin

Re: [OT] Altair

2016-08-30 Thread Christopher Reimer
> On Aug 30, 2016, at 11:51 AM, Joe wrote: > >> Am 30.08.2016 um 17:52 schrieb D'Arcy J.M. Cain: >> On Tue, 30 Aug 2016 15:56:07 +0200 >> Joe wrote: >>> Am 30.08.2016 um 13:01 schrieb D'Arcy J.M. Cain: On Mon, 29 Aug 2016 21:21:05 -0700 Larry Hudson via Python-list wrote: > I re

Re: Python inner function parameter shadowed

2016-09-14 Thread Christopher Reimer
> On Sep 13, 2016, at 8:58 PM, Lawrence D’Oliveiro > wrote: > >> On Wednesday, September 14, 2016 at 4:34:34 AM UTC+12, Daiyue Weng wrote: >> PyCharm warns about "Shadows name 'func' from outer scope" > > Typical piece of software trying to be too helpful and just getting in the > way. > > Ca

Re: psychocomputational analysis toolkit in Python?

2018-03-08 Thread Christopher Mullins
You might find MNE useful, and if what you're doing happens to fit somewhere in their package you could contribute to it -- they're a good group to work with. https://www.martinos.org/mne/stable/index.html https://github.com/mne-tools/mne-python -- https://mail.python.org/mailman/listinfo/python-

Re: psychocomputational analysis toolkit in Python?

2018-03-08 Thread Christopher Mullins
> Would it be possible to emulate a minimally functional brain-to-brain coupling system entirely in Python? I don't know what that would entail, but the links I shared have a mailing list and a very responsive gitter, both of which would be great places to ask about that! (You're welcome to ask h

Re: Flask: request vs Request

2018-03-10 Thread Christopher Mullins
In the code you linked, I don't see where the *R*equest is used. The request variable is setup by flask when you annotate the function with the resource endpoint and POST method. It contains the content of the request which can be converted to json if that content type was specified. -- https://ma

Re: Flask: request vs Request

2018-03-12 Thread Christopher Mullins
> > Could you please give some context when you reply, TIA > Whoops, thanks for the reminder Mark. So what for the Request is used for then? In general when you see that something in Python starts with a capital letter, that indicates a class. Check out the relevant section of the PEP8 coding

Re: python3.7 error PYQT5 - NameError: name 'self' is not defined

2018-09-21 Thread Christopher Mullins
> > Hi when I disconnect the internet I get an error NameError: name 'self' is > not defined. I really dont get it.. thanks all. Is that a bug? or my fault? Exception in thread Thread-1: > Traceback (most recent call last): > File "C:\programming Alon\stock market app\PROJECT\AlonStockMarket.py"

How much sanity checking is required for function inputs?

2016-04-17 Thread Christopher Reimer
Greetings, I'm currently building a chess engine to learn the finer details of Python. When I learned all flavors of Java in community college a decade ago, we had to sanity check the hell out of the input values for every function and wrote a lot of redundant code in addition to the getters/

Re: How much sanity checking is required for function inputs?

2016-04-17 Thread Christopher Reimer
On 4/17/2016 3:18 PM, Michael Selik wrote: I'd rather turn the question around: how much sanity checking is necessary or useful? You'll find the answer is "surprisingly little" compared to your experience in Java. I'm looking for a pythonic approach to sanity checking. From what I read elsewh

Re: How much sanity checking is required for function inputs?

2016-04-19 Thread Christopher Reimer
On 4/19/2016 1:02 AM, Michael Selik wrote: Why relocate rather than remove? What message would you provide that's better than ``KeyError: 42`` with a traceback that shows exactly which dictionary is being used and how? I think you misread my code. No dictionary exception occurs in the sanity

Re: How much sanity checking is required for function inputs?

2016-04-21 Thread Christopher Reimer
Greetings, Thanks to everyone for providing feedback. Here's my revised code to generate a set of chess pieces. class PieceFactory(object): def factory(color, piece, position): if piece == 'Bishop': return Bishop(color, position) if piece == 'K

Re: How much sanity checking is required for function inputs?

2016-04-21 Thread Christopher Reimer
On 4/21/2016 6:54 PM, Tim Chase wrote: I'd simplify this code to something like class PieceFactory(object): @staticmethod def factory(color, piece, position): try: return { 'Bishop': Bishop, 'King': King, 'Knight': Knight,

Re: How much sanity checking is required for function inputs?

2016-04-21 Thread Christopher Reimer
On 4/21/2016 7:10 PM, Ethan Furman wrote: I do plan to incorporate a sanity test in each Piece class to validate the initial position value. Pawns have 16 specific positions. Bishop, Knight and Rook each have four specific positions. King and Queen each have two specific positions. An invalid val

Re: How much sanity checking is required for function inputs?

2016-04-21 Thread Christopher Reimer
On 4/21/2016 7:20 PM, Stephen Hansen wrote: Whyyy are you using getattr? Something wrong with PieceFactory.factory(color, piece, position)? (Or, better yet, yield piece_factory(color, piece, position) where piece_factory is just a function) Because the example I found used it, I implemented i

Re: How much sanity checking is required for function inputs?

2016-04-23 Thread Christopher Reimer
On 4/21/2016 9:46 PM, Ethan Furman wrote: Oh! and Enum!!! ;) OMG! I totally forgot about Enum. Oh, look. Python supports Enum. Now I don't have to roll my own! Hmm... What do we use Enum for? :) Thank you, Chris R. -- https://mail.python.org/mailman/listinfo/python-list

Re: How much sanity checking is required for function inputs?

2016-04-23 Thread Christopher Reimer
On 4/21/2016 10:25 PM, Stephen Hansen wrote: Why not, 'color in ("black", "white")'? Checkers seems popular around here. What if I want to change "white" to "red," as red and black is a common color scheme for checkers. Do I change a single constant variable or replace all the occurrences in

Re: How much sanity checking is required for function inputs?

2016-04-23 Thread Christopher Reimer
On 4/22/2016 1:40 PM, Michael Selik wrote: Frankly, for someone coming from Java, the best advice is to not write any classes until you must. Of course classes in Python are very useful. It's just that your Java habits are unnecessary and often counter-productive. I disagree. I wrote procedural

Re: How much sanity checking is required for function inputs?

2016-04-23 Thread Christopher Reimer
On 4/23/2016 2:33 PM, Matt Wheeler wrote: This is still backwards to me. It prevents your classes from being suitable for restoring a stored game state, not just custom starting positions (which I think is what Ethan means by custom setups). I haven't thought that far about saving the game stat

Re: How much sanity checking is required for function inputs?

2016-04-23 Thread Christopher Reimer
On 4/23/2016 6:29 PM, Ian Kelly wrote: Python enums are great. Sadly, they're still not quite as awesome as Java enums. I remember enums more from C than Java. Although I haven't used them much in either language. I'm planning to immerse myself back into C via Cython. Depending on far I get i

Re: How much sanity checking is required for function inputs?

2016-04-23 Thread Christopher Reimer
On 4/23/2016 6:38 PM, Michael Selik wrote: Why so many files? Python can easily support thousands of lines in a file. If it's just one file any text editor can do a quick find-replace. That goes back to the Java convention of having one class per file. It took a while to convince myself that

Re: How much sanity checking is required for function inputs?

2016-04-23 Thread Christopher Reimer
On 4/23/2016 7:34 PM, Michael Torrie wrote Procedural programming does not necessarily mean BASIC-style goto hell. Not sure why you would think that. In fact that's not really what procedural programming is about. I mentioned several messages back that I spent two years writing procedural scr

Re: How much sanity checking is required for function inputs?

2016-04-23 Thread Christopher Reimer
On 4/23/2016 8:19 PM, Michael Torrie wrote: The reason you weren't taught beyond class inheritance is because Java implements organization only through a class hierarchy. Whole generations of Java programmers think that program organization is through classes (a static main method means your code

Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-26 Thread Christopher Reimer
Greetings, If I'm using a dictionary to store variables for an object, and accessing the variable values from dictionary via property decorators, would it be better to derive the class from object or dict? class Test1(object): def __init__(self): self.state = {'key': '

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-27 Thread Christopher Reimer
On 4/26/2016 8:56 PM, Random832 wrote: what exactly do you mean by property decorators? If you're just accessing them in a dictionary what's the benefit over having the values be simple attributes rather than properties? After considering the feedback I got for sanity checking my code, I've d

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-27 Thread Christopher Reimer
On 4/27/2016 7:24 AM, Ian Kelly wrote: Some other great questions to ask yourself are "do I really want len(my_object) to return the number of items in this dict" and "do I really want list(my_object) to return all the keys in this dict"? If the answer to all those is yes, then it's probably fa

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-27 Thread Christopher Reimer
On 4/27/2016 7:33 AM, Ian Kelly wrote: This class definition looks muddled. Because Test2 inherits from dict, the object referred to by "self" will be a dict, and self.__dict__ is actually a *different* dict, containing the attributes of self. The line: self.__dict__ = {'key', 'value'} is

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-27 Thread Christopher Reimer
On 4/27/2016 7:00 PM, Michael Torrie wrote: I am guessing that the reason you are storing state as it's own dictionary is so that you can pass the state itself to the constructor? Someone said it was bad to store the object itself to file (my original plan) and that I should use a dictionary

Re: Pythonic style (was: Differences between Class(Object) and Class(Dict) for dictionary usage?)

2016-04-27 Thread Christopher Reimer
On 4/27/2016 7:07 PM, Ben Finney wrote: I would say the latter is more Pythonic, because it: * Better conveys the intention (“set the value of the ‘self.key’ attribute”). * Uses the built-in mechanisms of Python (don't invoke magic attributes, instead use the system that makes use of them

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-27 Thread Christopher Reimer
On 4/27/2016 8:05 PM, Ethan Furman wrote: I ripped out the fetch_state because that will take more work -- you can't pass a Pawn's saved state in to Piece and get the results you want. pickle is worth looking at for saving/restoring. The original idea was to pass a Pawn dictionary to the cons

Re: Pythonic style

2016-04-27 Thread Christopher Reimer
On 4/27/2016 8:23 PM, Ben Finney wrote: If you want items in a mapping, explicitly use a Python ‘dict’ instance. If you want attributes that describe an object, explicitly use attributes of that object. Deliberately choose which one makes more sense. Okay, that makes sense. Thank you, Chris R

Re: Pythonic style

2016-04-27 Thread Christopher Reimer
On 4/27/2016 8:52 PM, Ethan Furman wrote: The point Ben was trying to make is this: you should never* call __dunder__ methods in normal code; there is no need to do so: - use len(), not __len__() - use next(), not __next__() - use some_instance.an_attribute, not some_instance.__dict__['an_a

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-27 Thread Christopher Reimer
On 4/27/2016 8:52 PM, Michael Torrie wrote: In fact if it were me I would save game state to some kind of ini file, which would mean manually going through each object and writing out the relevant data to the ini file using the right syntax. And then reverse the process when restoring from a fi

Not x.islower() has different output than x.isupper() in list output...

2016-04-29 Thread Christopher Reimer
Greetings, I was playing around with a piece of code to remove lowercase letters and leave behind uppercase letters from a string when I got unexpected results. string = 'Whiskey Tango Foxtrot' list(filter((lambda x: not x.islower()), string)) ['W', ' ', 'T', ' ', 'F'] Note the

Re: Not x.islower() has different output than x.isupper() in list output...

2016-04-29 Thread Christopher Reimer
On 4/29/2016 6:29 PM, Stephen Hansen wrote: If isupper/islower were perfect opposites of each-other, there'd be no need for both. But since characters can be upper, lower, or *neither*, you run into this situation. Based upon the official documentation, I was expecting perfect opposites. str.

Re: Not x.islower() has different output than x.isupper() in list output...

2016-04-30 Thread Christopher Reimer
On 4/29/2016 11:43 PM, Stephen Hansen wrote: The official documentation is accurate. That may be true on a technical level. But the identically worded text in the documentation implies otherwise. Maybe I'm nitpicking this. Even if I submitted a bug to request a clearer explanation in the doc

Re: Not x.islower() has different output than x.isupper() in list output...

2016-04-30 Thread Christopher Reimer
On 4/30/2016 10:11 AM, Stephen Hansen wrote: You're thinking of the whole "string", but you're operating on single-character substrings, and when " ".islower() is run, its false. Because the two-pronged test, a) if all cased characters are lowercase and b) there is at least one cased character.

Re: How to become more motivated to learn Python

2016-05-03 Thread Christopher Reimer
On 5/3/2016 4:20 AM, Cai Gengyang wrote: So I have completed up to CodeAcademy's Python Unit 2 , now moving on to Unit3 : Conditionals and Control Flow. But I feel my motivation wavering , at times I get stuck and frustrated when trying to learn a new programming language ? This might not be

Re: How to become more motivated to learn Python

2016-05-03 Thread Christopher Reimer
On 5/3/2016 8:00 PM, DFS wrote: How far along are you in your engine development? I can display a text-based chess board on the console (looks better with a mono font). 8 BR BN BB BQ BK BB BN BR 7 BP BP BP BP BP BP BP BP 6 __ __ __ __ __ __ __ __ 5 __ __ __ __ __ __ __ __ 4

Pylint prefers list comprehension over filter...

2016-05-05 Thread Christopher Reimer
Greetings, Below is the code that I mentioned in an earlier thread. string = "Whiskey Tango Foxtrot" ''.join(list(filter(str.isupper, string))) 'WTF' That works fine and dandy. Except Pylint doesn't like it. According to this link, list comprehensions have replaced filters and the

Re: pylint woes

2016-05-07 Thread Christopher Reimer
On 5/7/2016 9:51 AM, DFS wrote: Has anyone ever in history gotten 10/10 from pylint for a non-trivial program? I routinely get 10/10 for my code. While pylint isn't perfect and idiosyncratic at times, it's a useful tool to help break bad programming habits. Since I came from a Java background

Re: Pylint prefers list comprehension over filter...

2016-05-07 Thread Christopher Reimer
On 5/5/2016 7:57 PM, Stephen Hansen wrote: On Thu, May 5, 2016, at 07:46 PM, Dan Sommers wrote: On Thu, 05 May 2016 18:37:11 -0700, Stephen Hansen wrote: ''.join(x for x in string if x.isupper()) The difference is, both filter and your list comprehension *build a list* which is not needed

Re: pylint woes

2016-05-07 Thread Christopher Reimer
On 5/7/2016 12:23 PM, Stephen Hansen wrote: On Sat, May 7, 2016, at 11:52 AM, Christopher Reimer wrote: You can do better. You should strive for 10/10 whenever possible, figure out why you fall short and ask for help on the parts that don't make sense. I think this is giving far too

Re: Pylint prefers list comprehension over filter...

2016-05-07 Thread Christopher Reimer
On 5/5/2016 6:37 PM, Stephen Hansen wrote: On Thu, May 5, 2016, at 06:26 PM, Christopher Reimer wrote: Which is one is correct (Pythonic)? Or does it matter? First, pylint is somewhat opinionated, and its default options shouldn't be taken as gospel. There's no correct: filter is fin

Re: pylint woes

2016-05-07 Thread Christopher Reimer
On 5/7/2016 12:52 PM, Ray Cote wrote: I’m impressed with 10/10. My approach is to ensure flake8 (a combination of pyflakes and pep8 checking) does not report any warnings and then run pyLint as a final check. I just installed pyflakes and ran it against my 10/10 files. It's not complaining ab

Re: python chess engines

2016-05-07 Thread Christopher Reimer
On 5/3/2016 10:13 PM, DFS wrote: Wanted to start a new thread, rather than use the 'motivated' thread. Can you play your game at the console? Nope. Only displays the board on the console. An early version had the forward movement for pawns implemented. The way I think about a chess engine i

Re: Pylint prefers list comprehension over filter...

2016-05-07 Thread Christopher Reimer
On 5/7/2016 2:22 PM, Chris Angelico wrote: On Sun, May 8, 2016 at 5:17 AM, Christopher Reimer wrote: Since the code I'm working on is resume fodder (i.e., "Yes, I code in Python! Check out my chess engine code on GitHub!"), I want it to be as Pythonic and PEP8-compliant as

Re: Pylint prefers list comprehension over filter...

2016-05-07 Thread Christopher Reimer
On 5/7/2016 1:31 PM, Marko Rauhamaa wrote: Christopher Reimer : Never know when an asshat hiring manager would reject my resume out of hand because my code fell short with pylint. Remember that it's not only the company checking you out but also you checking the company out. Would you wa

Re: Pylint prefers list comprehension over filter...

2016-05-07 Thread Christopher Reimer
On 5/7/2016 6:40 PM, Terry Reedy wrote: On 5/7/2016 3:17 PM, Christopher Reimer wrote: For my purposes, I'm using the list comprehension over filter to keep pylint happy. How sad. The pylint developers arrogantly take it on themselves to revise Python, against the wishes of Guido an

Re: Pylint prefers list comprehension over filter...

2016-05-08 Thread Christopher Reimer
On 5/8/2016 5:02 AM, Steven D'Aprano wrote: On Sun, 8 May 2016 08:01 am, Christopher Reimer wrote: On 5/7/2016 2:22 PM, Chris Angelico wrote: Also, be sure you read this part of PEP 8: https://www.python.org/dev/peps/pep-0008/#a-foolish-consistency-is-the-hobgoblin-of-little-

Re: Python is an Equal Opportunity Programming Language

2016-05-08 Thread Christopher Reimer
On 5/7/2016 11:58 PM, Marko Rauhamaa wrote: Chris Angelico : So the question is: Do we care about country equality or individual equality? You can't have both. That's why there's been a long-standing initiative to split California into multiple states: https://en.wikipedia.org/wiki/Six_Cal

Re: Python is an Equal Opportunity Programming Language

2016-05-08 Thread Christopher Reimer
On 5/8/2016 8:09 AM, Rustom Mody wrote: See: https://www.washingtonpost.com/news/rampage/wp/2016/05/07/ivy-league-economist-interrogated-for-doing-math-on-american-airlines-flight/ Closing line: "In America today, the only thing more terrifying than foreigners is...math." Wonder how close to

Re: Python is an Equal Opportunity Programming Language

2016-05-08 Thread Christopher Reimer
On 5/8/2016 9:27 AM, Steven D'Aprano wrote: On Sun, 8 May 2016 08:22 pm, beliav...@aol.com wrote: There are far more female than male teachers. I don't attribute it to anti-male suppression but to greater female interest in working with children. Of course there is suppression of male teachers

Re: Python PygLatin

2016-05-08 Thread Christopher Reimer
On 5/8/2016 10:53 AM, alister wrote: On Mon, 09 May 2016 03:12:14 +1000, Steven D'Aprano wrote: On Sun, 8 May 2016 08:21 pm, Cai Gengyang wrote: If one looks at the Forbes List, you will see that there are 4 programmers amongst the top ten richest people in the world (Bill Gates, Mark Zuckerb

How do I subclass the @property setter method?

2016-05-20 Thread Christopher Reimer
Greetings, My chess engine has a Piece class with the following methods that use the @property decorator to read and write the position value. @property def position(self): return self._position @position.setter def position(self, position): if self._first_move

  1   2   3   4   5   6   >