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
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
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
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
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'
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
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.
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,
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...
>>
>
>
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
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
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
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
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)
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
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 :
>
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
> 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
> 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
> 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.
> 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
> 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
> 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
> 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
On 9/6/2017 9:26 PM, Christopher Reimer wrote:
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
> 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.
On 9/6/2017 7:41 PM, Stefan Ram wrote:
The following code runs here:
Your code runs but that's not how I have mine code set up. Here's the
revised code:
class Requestor(object):
def __init__(self, user_id, user_name ):
self._page_start = -1
@property
def page_start(sel
Greetings,
My web scraper program has a top-level class for managing the other
classes. I went to set up a property for the top-level class that
changes the corresponding property in a different class.
class Scraper(object):
def __init__(self, user_id, user_name):
self.requestor
Greetings,
After reading everyone's comments and doing a little more research, I
re-implemented my function as a callable class.
def __call__(self, key, value):
if key not in self._methods:
return value
return self._methods[key](value)
This behaves like my prev
Greetings,
I was playing around this piece of example code (written from memory).
def filter_text(key, value):
def do_nothing(text): return text
return {'this': call_this,
'that': call_that,
'what': do_nothing
}[key](value)
Is
Ah, shoot me. I had a .join() statement on the output queue but not on
in the input queue. So the threads for the input queue got terminated
before BeautifulSoup could get started. I went down that same rabbit
hole with CSVWriter the other day. *sigh*
Thanks for everyone's help.
Chris R.
--
h
On 8/27/2017 1:50 PM, MRAB wrote:
What if you don't sort the list? I ask because it sounds like you're
changing 2 variables (i.e. list->queue, sorted->unsorted) at the same
time, so you can't be sure that it's the queue that's the problem.
If I'm using a list, I'm using a for loop to input ite
On 8/27/2017 1:31 PM, Peter Otten wrote:
Here's a simple example that extracts titles from generated html. It seems
to work. Does it resemble what you do?
Your example is similar to my code when I'm using a list for the input
to the parser. You have soup_threads and write_threads, but no read_t
On 8/27/2017 1:12 PM, MRAB wrote:
What do you mean by "queue (random order)"? A queue is sequential
order, first-in-first-out.
With 20 threads requesting 20 different pages, they're not going into
the queue in sequential order (i.e., 0, 1, 2, ..., 17, 18, 19) and
coming in at different time
On 8/27/2017 11:54 AM, Peter Otten wrote:
The documentation
https://www.crummy.com/software/BeautifulSoup/bs4/doc/#making-the-soup
says you can make the BeautifulSoup object from a string or file.
Can you give a few more details where the queue comes into play? A small
code sample would be ide
Greetings,
I have Python 3.6 script on Windows to scrape comment history from a
website. It's currently set up this way:
Requestor (threads) -> list -> Parser (threads) -> queue -> CVSWriter
(single thread)
It takes 15 minutes to process ~11,000 comments.
When I replaced the list with a qu
On Jul 5, 2017, at 6:34 AM, Sam Chats wrote:
> Just curious, is it better, performance wise, to read from a text file (css
> or tsv) compared to reading from a binary pickle file?
I prefer CSV because I can load the file into Microsoft Excel and do a quick
search.
Chris R.
--
https://mail.py
> On Jun 18, 2017, at 11:02 PM, Chris Angelico wrote:
>
> On Mon, Jun 19, 2017 at 3:54 PM, Steven D'Aprano wrote:
>>> With a list? No, I would say it's a bad idea.
>>
>>
>> Why a bad idea?
>>
>> As opposed to "can't be done", or "too hard and slow".
>
> Maintaining a record of list indices i
> On Jun 15, 2017, at 3:24 PM, jlada...@itu.edu wrote:
>
> This is hilarious, I have to share:
>
> https://stackoverflow.blog/2017/06/15/developers-use-spaces-make-money-use-tabs/
>
> Thanks to Guido for making us all richer!
One commentator on a tech website admonished programmers for wasting
On 6/5/2017 4:55 PM, Gregory Ewing wrote:
Mahmood Naderan wrote:
from a button on a web page, I chose "export as excel" to download
the data.
Do you get an option to export in any other format?
CSV would be best, since you can trivially read that
with Python's csv module.
If Excel is the onl
Greetings,
I have two functions that I generalized to be nearly identical except
for one line. One function has a yield statement, the other function
appends to a queue.
If I rewrite the one line to be a function passed in as an argument --
i.e., func(data) -- queue.append works fine. If I c
On 5/20/2017 1:19 AM, dieter wrote:
If your (590) pages are linked together (such that you must fetch
a page to get the following one) and page fetching is the limiting
factor, then this would limit the parallelizability.
The pages are not linked together. The URL requires a page number. If I
Greetings,
I'm developing a web scraper script. It takes 25 minutes to process 590
pages and ~9,000 comments. I've been told that the script is taking too
long.
The way the script currently works is that the page requester is a
generator function that requests a page, checks if the page cont
> 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
> 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
> On Jul 1, 2016, at 6:52 AM, Steven D'Aprano wrote:
>
>> On Fri, 1 Jul 2016 10:25 pm, Christopher Reimer wrote:
>>
>> For my BASIC interpreter, each line of BASIC is broken this way into
>> tokens.
> [...]
>> By using * to unpack the split line
> On Jul 1, 2016, at 5:46 AM, Jussi Piitulainen
> wrote:
>
> Christopher Reimer writes:
>
>> For my BASIC interpreter, each line of BASIC is broken this way into
>> tokens.
>>
>> line_number, keyword, *expression = line.split(' ', 2)
>>
> On Jun 30, 2016, at 11:42 PM, Jussi Piitulainen
> wrote:
>
> DFS writes:
>
>> Here's a related program that doesn't require you to tell it what type
>> of operation to perform. Just enter 'num1 operator num2' and hit
>> Enter, and it will parse the entry and do the math.
>>
>> -
On 6/26/2016 8:13 PM, Elizabeth Weiss wrote:
Hi There,
What is the point of this code?:
word=[]
print(word)
The result is []
When would I need to use something like this?
Thank you!
Sometimes you need to assign an empty list to a variable prior to using
it in a looping structure.
Here'
On 6/26/2016 8:41 AM, MRAB wrote:
On 2016-06-26 11:48, BartC wrote:
On 26/06/2016 08:36, Lawrence D’Oliveiro wrote:
One of Python’s few mistakes was that it copied the C convention of
using “=” for assignment and “==” for equality comparison.
One of C's many mistakes. Unfortunately C has bee
On 6/26/2016 6:21 AM, Steven D'Aprano wrote:
On Sun, 26 Jun 2016 08:48 pm, BartC wrote:
On 26/06/2016 08:36, Lawrence D’Oliveiro wrote:
One of Python’s few mistakes was that it copied the C convention of using
“=” for assignment and “==” for equality comparison.
One of C's many mistakes. Unf
> On Jun 22, 2016, at 7:59 AM, Grant Edwards wrote:
>
>> On 2016-06-22, Random832 wrote:
>>> On Wed, Jun 22, 2016, at 10:19, Grant Edwards wrote:
>>>
>>> Is that guaranteed by Python, or just a side-effect of the
>>> implementation? Back in the days when Python used native C
>>> integers I thi
Sent from my iPhone
> On Jun 10, 2016, at 3:52 PM, mad scientist jr
> wrote:
> .
> Now that it's done, I am wondering what kind of things I could do better.
This is Python, not BASIC. Lay off on the CAP LOCK key and delete all the
comments and separation blocks. No one is going to find your
On 6/3/2016 7:31 PM, Steven D'Aprano wrote:
On Sat, 4 Jun 2016 09:06 am, Sayth Renshaw wrote:
I cant create a list with an append method pf.append(thing) in one go .
Correct. You cannot append to a list until the list exists.
Nor can you uppercase a string until the string exists:
s = "hell
> On May 25, 2016, at 3:47 AM, Marko Rauhamaa wrote:
>
> Christopher Reimer :
>
>> Back in the early 1980's, I grew up on 8-bit processors and latin-1 was
>> all we had for ASCII.
>
> You really were very advanced. According to https://en.wikipedia.org/wiki/
> On May 24, 2016, at 11:38 PM, Gregory Ewing
> wrote:
>
> Christopher Reimer wrote:
>> Nope. I meant 8-bit ASCII (0-255).
>> http://www.ascii-code.com
>
> That page is talking about latin-1, which is just one of many
> possible 8-bit extensions of ascii.
Ba
On May 24, 2016, at 7:23 AM, Grant Edwards wrote:
>
>> On 2016-05-24, Steven D'Aprano wrote:
>>> On Tue, 24 May 2016 08:36 am, Christopher Reimer wrote:
>>>
>>> Those symbols are blowing my 8-bit ASCII brain. :)
>>
>> That's cer
> On May 23, 2016, at 1:22 PM, Grant Edwards wrote:
>
>> On 2016-05-23, Ian Kelly wrote:
>>> On Mon, May 23, 2016 at 9:53 AM, Ian Kelly wrote:
>>> I'm not sure where ℝ comes into this in the first place. Existing
>>> Python numeric types only represent various subsets of ℚ (in the case
>>> of f
On 5/21/2016 3:05 AM, Steven D'Aprano wrote:
On Sat, 21 May 2016 03:18 pm, Rustom Mody wrote:
Given that for the most part, most of us are horribly uneducated [
http://www.creativitypost.com/education/9_elephants_in_the_classroom_that_should_unsettle_us
]
how do we go about correcting our wr
On 5/21/2016 1:52 AM, Dirk Bächle wrote:
Hi Christopher,
On 20.05.2016 20:50, Christopher Reimer wrote:
Greetings,
My chess engine has a Piece class with the following methods that use
the @property decorator to read and write the position value.
slightly off topic: is your chess engine
On 5/20/2016 7:31 PM, Chris Angelico wrote:
On Sat, May 21, 2016 at 11:23 AM, Christopher Reimer
wrote:
On 5/20/2016 3:43 PM, Steven D'Aprano wrote:
But the idea that you should avoid a Python feature while programming in
Python because Javascript doesn't have it, or Ruby, or C,
On 5/20/2016 3:43 PM, Steven D'Aprano wrote:
But the idea that you should avoid a Python feature while programming in
Python because Javascript doesn't have it, or Ruby, or C, is surely the
height of muddleheaded thinking. You're not programming Javascript, Ruby or
C, you're programming in Pytho
On 5/20/2016 8:59 AM, Zachary Ware wrote:
On Fri, May 20, 2016 at 3:09 AM, Erik wrote:
On 20/05/16 00:51, Gregory Ewing wrote:
It's not so bad with "else" because you need to look back
to find out what condition the "else" refers to anyway.
With my tongue only slightly in my cheek, if it wa
On 5/20/2016 11:50 AM, Christopher Reimer wrote:
This code does work, blows up the unit test, and keeps PyCharm happy.
@property
def position(self):
return super().position
@position.setter
def position(self, position):
pass
Re-declaring @property and calling
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
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
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
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
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
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-
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
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
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
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
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
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
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
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
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
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
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
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
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.
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
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.
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
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
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
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
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
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
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
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
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
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
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
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
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': '
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
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
1 - 100 of 117 matches
Mail list logo