list gatewayed to usenet though, there's
really nothing so good as usenet for proper discourse (!).
Hear, hear!
--
Erik Max Francis && m...@alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 18 N 121 57 W && Skype erikmaxfrancis
The quality
. See
[Full list of changes between EmPy 3._x_ and
4.0](http://www.alcyone.com/software/empy/ANNOUNCE.html#all-changes)
for a more
comprehensive list.
--
Erik Max Francis && m...@alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 18 N 121 57 W &am
nges between EmPy 3._x_
and
4.0](http://www.alcyone.com/software/empy/ANNOUNCE.html#full-list-of-changes-between-empy-3-x-and-4-0)
for a more comprehensive list.
--
Erik Max Francis && m...@alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 18 N 121 57
On 3 Sep 2023, at 18:10, Jan Erik Moström via Python-list wrote:
> I'm looking for some advice for how to write this in a clean way
Thanks for all the suggestion, I realize that I haven't written Python code in
a while. I should have remembered this myself !!! Thanks for remindi
On 3 Sep 2023, at 19:13, MRAB via Python-list wrote:
> You could use pass an anonymous function (a lambda) to re.sub:
Of course !! Thanks.
= jem
--
https://mail.python.org/mailman/listinfo/python-list
I'm looking for some advice for how to write this in a clean way
I want to replace some text using a regex-pattern, but before creating
replacement text I need to some file checking/copying etc. My code right now
look something like this:
def fix_stuff(m):
# Do various things that invol
how to resolve this module import error? I can provide files
and/or more details as well.
Thank you all for the help!
Take care,
Erik Brown
--
https://mail.python.org/mailman/listinfo/python-list
I'm doing something that I've never done before and need some advise for
suitable libraries.
I want to
a) create diagrams similar to this one
https://www.dropbox.com/s/kyh7rxbcogvecs1/graph.png?dl=0 (but with more
nodes) and save them as PDFs or some format that can easily be converted
to PD
I want to do some text substitutions but a bit more advanced than what
string.Template class can do. I addition to plain text substitution I
would like to be able to do some calculations:
$value+1 - If value is 16 this would insert 17 in the text. I would also
like to subtract.
$value+1w - I
On 14 Nov 2019, at 15:15, R.Wieser wrote:
Too bad though, it means that procedures that want to share/use its
callers
variables using nonlocal can never be called from main. And that a
caller
of a procedure using nonlocal cannot have the variable declared as
global
(just tested it).
So wha
On 14 Nov 2019, at 14:06, R.Wieser wrote:
I've also tried moving "MyVar = 7" to the first line, but that doesn't
change anything. Using "global MyVar" works..
Try
def outer():
MyVar = 10
def Proc1():
nonlocal MyVar
MyVar = 5
Proc1()
class Status:
valid = 1
invalid = 2
unknown = 3
On Fri, Jul 26, 2019, 3:37 PM Chris Angelico wrote:
> On Sat, Jul 27, 2019 at 5:16 AM Erik Aronesty wrote:
> >
> > I just spend a while tracking down and killing all "if Enum" and "if not
> > En
I just spend a while tracking down and killing all "if Enum" and "if not
Enum" bugs in my code. I was frankly shocked that this didn't raise a
ValueError to begin with.
Apparently all enums are true/false depending on whether the underlying
value is truthy or falsy.
Which breaks the abstraction
I am trying to dynamically add a site-package to a script that is run as a cron
job. The method adduseristepackages does not seem to do anything.
import sys
import site
print('-')print(site.getusersitepackages())
print('add',
site.addusersitepackage
I am trying to dynamically add a site-package to a script that is run as a cron
job. The method adduseristepackages does not seem to do anything.
import sys
import site
print('-')print(site.getusersitepackages())
print('add',
site.addusersitepackage
On 4 Apr 2018, at 9:27, Steven D'Aprano wrote:
Its as hard to wrap your brain around as parallel processing in
general,
but with even worse performance than sequential processing.
Am I totally wrong?
I would say that it all depends on what kind of stuff you're doing. I'm
no scheduling exper
On 14 Mar 2018, at 21:40, Larry Martell wrote:
I've been trying to find some example of how to read calendar info on
macOS
but I haven't found anything ... I'm probably just bad at searching
!!
What I want to do is to read calendar info for a date range. Does
anyone
know of an example of ho
I've been trying to find some example of how to read calendar info on
macOS but I haven't found anything ... I'm probably just bad at
searching !!
What I want to do is to read calendar info for a date range. Does anyone
know of an example of how to do this?
= jem
--
https://mail.python.org/m
On 10 Jan 2018, at 13:40, Jan Erik Moström wrote:
I'm looking for a really easy to use graphic library. The target users
are teachers who have never programmed before and is taking a first
(and possible last) programming course.
Thanks for all the suggestions, I'm going to take
I'm looking for a really easy to use graphic library. The target users
are teachers who have never programmed before and is taking a first (and
possible last) programming course.
I would like to have the ability to draw lines, circles, etc. Nothing
fancy, as little window management as possibl
On 19 Sep 2017, at 13:01, bartc wrote:
My bill in a store came to £3.20 (GBP3.20), so I handed over £10.20.
I was given back £16.90 in change!
It turned out the cashier had entered £20.10 as the amount tendered.
It was sorted out in the end.
Sometimes its easier not to be bother making the
On 7 Sep 2017, at 8:14, Andrej Viktorovich wrote:
If I use command print "aaa" in console I get error. So, why this is
allowed in sample?
You're probably using Python 2 for the listed script and Python 3 when
you try in the console.
= jem
--
https://mail.python.org/mailman/listinfo/python-l
On 17 Aug 2017, at 0:48, Sayth Renshaw wrote:
> what exactly am I doing wrong?
Outdent the if-statement
= jem
--
https://mail.python.org/mailman/listinfo/python-list
On 28/06/17 03:46, Steve D'Aprano wrote:
All of this is irrelevant if beginners don't read the error message.
"if".
End-users
don't read error messages, no matter how well written they are,
Reference?
and every word
you add probably cuts the number of people reading it by half.
"probabl
On 27/06/17 15:05, Steve D'Aprano wrote:
On Tue, 27 Jun 2017 08:34 am, Erik wrote about the print function error message:
To be fair, this already seems to be a special case:
[...]
>>> len "bar"
File "", line 1
len "bar"
On 27/06/17 00:21, Stefan Ram wrote:
Erik writes:Using 'print' as a
statement is obsolete syntax in Python 3.
»print« never was a statement.
»print« was a keyword (2.7.6 2.3.1).
*sigh* Whatever.
You have completely ignored my point (that perhaps the message c
On 26/06/17 18:30, Chris Angelico wrote:
On Tue, Jun 27, 2017 at 2:41 AM, Rurpy via Python-list
wrote:
How about:
In Python 2, 'print' was a statement and did not require
parenthesis around its argument. In Python 3 'print' has
been changed to a function and now, like all functions,
On 16/06/17 12:03, alister wrote:
(The non native English speaker excuse is not an option for me)
Does that mean it's mandatory for you? I'm confused :D :D
E.
--
https://mail.python.org/mailman/listinfo/python-list
On 15/06/17 15:10, Chris Angelico wrote:
On Fri, Jun 16, 2017 at 12:00 AM, alister wrote:
Json is designed to be legal Javascript code & therefore directly
executable so no parser is posible.
"no parser is possible"???
I *think* alister meant "so it is possible to not use a parser
[librar
On 15/06/17 01:30, Ray Cote wrote:
On Wed, Jun 14, 2017 at 6:14 PM, Erik <mailto:pyt...@lucidity.plus.com>> wrote:
If that makes it definitely JSON, then this makes it definitely
Python ;) :
>>>
[{"itemNumber":"75-5044",
On 15/06/17 00:45, Chris Angelico wrote:
Add all that
kind of thing together, and you get my original conclusion that this
is JSON. It's also perfectly parseable as various other things, but
it's still most likely to be JSON.
It "is JSON" but is also "parsable as various other things" yet is "m
On 15/06/17 00:08, justin walters wrote:
I should also specify that the data you have received is malformed.
JSON should always have an object as the top level structure, not an
array as in your data.
So it's not JSON then? :D
E.
--
https://mail.python.org/mailman/listinfo/python-list
On 14/06/17 22:30, Chris Angelico wrote:
It wouldn't be the repr() of a Python structure, as that wouldn't have
all those trailing zeroes.
That depends on what class represents those float values. It doesn't
have to be the built-in float. Same with the double-quotes instead of
single-quotes o
On 14/06/17 22:54, Ray Cote wrote:
Definitely JSON:
json.loads(“""[{"itemNumber":"75-5044","inventory":[{"warehouseCode":"UT-1-US","quantityAvailable":0.0},{"warehouseCode":"KY-1-US","quantityAvailable":0.0},{"warehouseCode":"TX-1-US","quantityAvailable":14.
On 14/06/17 22:16, Matt Wheeler wrote:
? JSON keys are quoted
Thanks Matt,
I was confusing myself between JS source and JSON. Good to have this
reminder (I always use libraries for reading and writing JSON in
whatever language, so while I view it often I very rarely have to type
it in direc
On 14/06/17 22:18, Grant Edwards wrote:
What makes it look like JSON to you?
The fact that it _is_ valid JSON (at least according to the parsers
I've tried on it, both locally and using things like jsonlint.com).
And I tried it on the Python REPL. It's Python too.
If someone wrote the follow
On 14/06/17 21:47, Erik wrote:
What makes it look like JSON to you? (I'm not arguing, I'm asking what
I've missed).
If I cut-and-paste the OP's structure into the REPL, it replies with a
valid Python structure that's equivalent (albeit with single-quotes
instead
On 14/06/17 21:38, Chris Angelico wrote:
On Thu, Jun 15, 2017 at 6:33 AM, Bradley Cooper
wrote:
I am working with an API and I get a return response in this format.
[{"itemNumber":"75-5044","inventory":[{"warehouseCode":"UT-1-US","quantityAvailable":0.0},{"warehouseCode":"KY-1-US"
On 10/06/17 00:18, Terry Reedy wrote:
On 6/9/2017 6:00 PM, Erik wrote:
On 09/06/17 19:39, sondes kalboussi wrote:
Am a bit confused I was thinking that the order of execution of
functions in a code is from the first to the last function but
sometimes it is the opposite, for instance, some
On 09/06/17 19:39, sondes kalboussi wrote:
Am a bit confused I was thinking that the order of execution of
functions in a code is from the first to the last function but
sometimes it is the opposite, for instance, some parameters or
outputs from the second function are called in the first one eve
On 04/06/17 00:42, Jon Forrest wrote:
On 6/3/2017 12:38 PM, Thomas Jollans wrote:
>> I'd like to suggest an explanation of what a sequence is
>> that doesn't use the word 'object' because an object has
>> a specific meaning in Python.
>>
>> Am I on the right track here?
>
> No, strings do
On 23/05/17 22:14, Mahmood Naderan via Python-list wrote:
sorted=[[int(name.split("_")[-1]), name] for name in files]
This isn't sorting anything. At no point do you invoke a sort operation.
It's processing the list in the original order and generating a new list
with a different format but *
On 10/05/17 23:41, Dan Stromberg wrote:
On Wed, May 10, 2017 at 1:46 PM, MRAB wrote:
NEVER use a 'bare except' to suppress exceptions! It'll catch _all_
exceptions, even NameError (if you've misspelled a name, it'll catch that
too). Catch only those exceptions that you're prepared to deal with
On 10/05/17 20:25, aaron.m.weisb...@gmail.com wrote:
As my code stands right now, it counts through the stateList[0] and
then when associationsCount gets to 0 it just stops. I know I need
to add another couple lines of code to get it back going again
It's very difficult to see what you're tryi
On 03/05/17 23:21, Larry Martell wrote:
But not for a variable like a list or dict?
What name should "[1, 2, 3]", or "{1, 'a': 2: 'b'}" be given?
The thing about functions or classes is that you can't (at the literal
source level) define them *without* giving them a name:
def func(): pass
c
On 02/05/17 23:28, Larry Martell wrote:
Anyone have any thoughts on how I can monitor the variables' memory
usage as the script runs?
This is application-specific, but sometimes it helps to look at the
objects' types, or even their values.
The types are dict and list, so they are not very use
On 30/04/17 01:17, breamore...@gmail.com wrote:
On Sunday, April 30, 2017 at 12:23:19 AM UTC+1, Erik wrote:
The other is that the documentation of collections.OrderedDict seems to
be lacking (it is talking in terms of being a "dict" subclass, but it
actually isn't one).
E.
Co
On 30/04/17 01:31, Ben Finney wrote:
Erik writes:
On 29/04/17 23:40, Ned Batchelder wrote:
For creating your own class that acts like a dict, you should derive
from collections.abc.MutableMapping, which only requires
implementing __getitem__, __setitem__, __delitem__, __iter__, and
__len__
On 29/04/17 23:40, Ned Batchelder wrote:
For creating your own class that acts like
a dict, you should derive from collections.abc.MutableMapping, which
only requires implementing __getitem__, __setitem__, __delitem__,
__iter__, and __len__.
Or, I could derive from collections.OrderedDict and j
I have a subclass of dict that enforces which keys are allowed to be set
and only allows each key to be set at most once:
class StrictDict(dict):
def __init__(self, validkeys, *args, **kwargs):
self.validkeys = validkeys
super(StrictDict, self).__init__(*args, **kwargs)
def __setite
[Disclaimer: I have not fully read this thread. If I'm jumping in with
something that's irrelevant for other reasons, please just ignore me]
On 19/04/17 22:06, Venkatachalam Srinivasan wrote:
On Thursday, April 6, 2017 at 12:55:41 AM UTC+2, Gregory Ewing
wrote:
sensor_data=$(python execute_sen
On 19/04/17 21:25, Ethan Furman wrote:
Asking that you not denigrate non-Python ideas on the Python list is not
asking for "special respect",
I have no idea what you just said! :D
This is why I dislike code such as:
if not no_results(data) != not_valid:
pass
... and I've seen lots of
On 19/04/17 01:31, Matt wrote:
In perl I did it with this at the start of every script:
use Fcntl ':flock';
[snip]
How can I do something like this in Python?
>>> import fcntl
>>> help(fcntl.flock)
E.
--
https://mail.python.org/mailman/listinfo/python-list
On 19/04/17 00:33, bartc wrote:
So that's 'label-pointers' which I assume must correspond to computed
goto.
Yes - just different terminology. Being able to take the address of a
label and "goto address" rather than "goto label".
(I don't know why they should be faster than a switch; they ju
On 19/04/17 00:08, Gregory Ewing wrote:
Erik wrote:
When considering special-casing this opcode sequence, remember that
in-place operations can be performed on anonymous objects (i.e., those
referenced by a collection and not bound directly to a namespace):
I think this means you would want
On 18/04/17 11:30, bartc wrote:
On 18/04/2017 10:32, Erik wrote:
the
improvements over the original huge switch() to dispatch the bytecodes
to the correct handler appear to have made this type of optimization
less effective.
What did they do to it, and on which version?
It's the com
On 13/04/17 18:50, MRAB wrote:
On 2017-04-13 09:08, Steven D'Aprano wrote:
On Wed, 12 Apr 2017 16:30:38 -0700, bart4858 wrote:
Is it possible to skip the STORE_NAME op-code? If you knew *for sure*
that the target (x) was a mutable object which implemented += using an
in-
place mutation, then you
On 13/04/17 07:30, Peter Otten wrote:
Verdict: not greedy ;)
Great (as I mentioned I did look at the code VERY quickly whilst VERY
tired and at first glance missed that it's doing almost exactly what my
code is doing except using the heapq to manage tracking the smallest
value rather than so
Hi Ian,
On 13/04/17 00:09, Erik wrote:
On 12/04/17 23:44, Ian Kelly wrote:
I would
just use "lowest = min(items, key=itemgetter(0))".
I had it in my head for some reason
that min() would return the smallest key, not the object (and hence I
wouldn't be able to know which seq
Hi Peter,
On 12/04/17 23:42, Peter Otten wrote:
Erik wrote:
I need to be able to lazily merge a variable number of already-sorted(*)
variable-length sequences into a single sorted sequence.
https://docs.python.org/dev/library/heapq.html#heapq.merge
AFAICT (looking at the Python 3.5 heapq
On 12/04/17 23:44, Ian Kelly wrote:
This might be okay since Timsort on an already-sorted list should be
O(n). But there's not really any need to keep them sorted and I would
just use "lowest = min(items, key=itemgetter(0))".
Sure (and this was my main worry). I had it in my head for some reaso
Hi.
I need to be able to lazily merge a variable number of already-sorted(*)
variable-length sequences into a single sorted sequence. The merge
should continue until the longest sequence has been exhausted.
(*) They may in practice be a lazy source of data known to only ever be
generated in
On 10/04/17 03:23, Chris Angelico wrote:
Okay, I have a pretty thick skin, but this is getting a bit obnoxious.
Can you PLEASE post something that isn't just insulting me? Thanks.
Are you suggesting he should post something that insults you *and*
others? If so, I'm up for being insulted too ;)
On 09/04/17 22:22, john polo wrote:
The new attempt gives me a list, now I have to figure out how to deal
with unwanted quotation marks and spaces.
datFil = open("apelist.txt")
datObj = datFil.read()
datObj2 = datObj.replace('" ','') #added this comment while writing
this email: I guess I c
On 6 Apr 2017, at 14:43, aldersilva...@gmail.com wrote:
> Hello, how can I start programming?
Let me google that for you => http://www.learnpython.org
--
https://mail.python.org/mailman/listinfo/python-list
On 25/03/17 20:26, MRAB wrote:
On 2017-03-25 20:10, Terry Reedy wrote:
On 3/25/2017 6:50 AM, Steve D'Aprano wrote:
they BCC or CC me without a good excuse. As I was in this case: the OP
BCCed me in his post. I'm not *that* special, so my guess is that he
did a
mass BCC of many regulars here, wh
On 22/03/17 21:57, M. R.P. wrote:
does anyone know were I can [find?] python source code programs?
Are you looking for the source to a Python language implementation
itself? If so, see this link:
https://www.python.org/downloads/
If not, what are you looking for, exactly? What sort of Pytho
On 19/03/17 23:23, Jon Ribbens wrote:
On 2017-03-19, Erik wrote:
On 19/03/17 22:29, Jon Ribbens wrote:
Not to mention plenty of editors (e.g. vim) will unindent when you
press backspace.
I don't think that's strictly true. If you have just indented with a tab
character, then back
On 19/03/17 22:29, Jon Ribbens wrote:
On 2017-03-19, breamore...@gmail.com wrote:
On Sunday, March 19, 2017 at 9:54:52 PM UTC, Larry Hudson wrote:
A trivial point (and irrelevant)... The thing I find annoying
about an editor set to expand tabs to spaces is that it takes one
keypress to indent
On 14/03/17 13:56, Chris Angelico wrote:
On Wed, Mar 15, 2017 at 12:30 AM, Jon Ribbens wrote:
rm does not ask before deleting. However some Linux distributions
take it upon themselves to put "alias rm='rm -i'" in /etc/profile.
I have no such alias, but it still prompts.
[snip]
This is the
Hi Paulo,
On 11/03/17 22:01, Paulo da Silva wrote:
I have a dir with lots of csv files. These files are updated +- once a
day. I could see that some values are converted, during output, to very
close values but with lots of digits. I understand that is caused by the
internal bits' representation
On 09/03/17 13:09, Chris Green wrote:
Michael Torrie wrote:
On 03/08/2017 12:27 PM, Chris Green wrote:
I have a fairly simple application that populates a GUI window with
fields from a database table. The fields are defined/configured by a
dictionary as follows:-
Instead of ordering the dat
On 24/02/17 22:18, kar wrote:
Thanks, what is the idea behind storing the keys and values in a list, I assume
looking up for a value in a map is faster getting the value from the list.
What do you not understand? MRAB's extensive comments explain what is
being done and why.
In summary, the
On 24/02/17 18:54, kar6...@gmail.com wrote:
for example is the search string is not a variable we can say
re.search(r"\$%^search_text", "replace_text", "some_text") but when I
read from the dict where shd I place the "r" keyword, unfortunately
putting inside key doesnt work "r key" like this
On 23/02/17 23:00, Deborah Swanson wrote:
It looks to me like you are indexing into a single-element
list that you
are creating using the literal list syntax in the middle of
the expression.
Actually, group is essentially a 2-element list. Each group has a list
of rows, and each row has a set o
Hi,
On 23/02/17 09:38, Deborah Swanson wrote:
group[[idx][records_idx[label]]]
gets an Index Error: list index out of range
[snip]
Can anyone see why I'm getting this Index error? and how to fix it?
It looks to me like you are indexing into a single-element list that you
are creating usin
On 15/02/17 21:53, Erik wrote:
process(data)
Before I get jumped on by a pack of rabid wolves, I of course meant:
process(d)
E.
--
https://mail.python.org/mailman/listinfo/python-list
Hi,
On 15/02/17 09:36, Makoto Kuwata wrote:
I'm sorry that my explanation is not enough.
I'm looking for bad python code, not refactoring examples.
I think you need to explain what you mean by "bad". Do you mean
something like:
i = 0
data = ["bad", "example", "of", "python", "code"]
while i
On 13/02/17 00:34, Chris Angelico wrote:
The unit "\t" always means U+0009, even if it's following a raw string
literal; and the unit "\d" always means "\\d", regardless of the
rawness of any of the literals involved. The thing that's biting you
here is that unrecognized escapes get rendered as b
On 13/02/17 00:23, Erik wrote:
r"hello \the" "worl\d" "\t"
'hello \\theworl\\d\t'
The initial string is raw. The following string adopts that (same as the
second example), but the _next_ string does not!
Why is the first string token parsed as a &q
On 13/02/17 00:13, Chris Angelico wrote:
On Mon, Feb 13, 2017 at 11:11 AM, Chris Angelico wrote:
The string "\t" gets shown in the repr as "\t". It is a string
consisting of one character, U+0009, a tab. The string r"\t" is shown
as "\\t" and consists of two characters, REVERSE SOLIDUS and LATI
On 13/02/17 00:11, Chris Angelico wrote:
Firstly, be aware that there's no such thing as a "raw string" - what
you have is a "raw string literal". It's a purely syntactic feature.
I do understand that. When I said "is raw"/"rawness", I am talking about
what the _parser_ is doing. I don't think
On 12/02/17 23:56, Erik wrote:
r"hello \the" "worl\d"
'hello \\theworl\\d'
Slightly surprising. The concatenated string adopts the initial string's
'rawness'.
"hello \the" r"worl\d" "\t"
'hello \theworl\\d\
On 12/02/17 04:53, Steve D'Aprano wrote:
py> s = r'documents\'
File "", line 1
s = r'documents\'
^
SyntaxError: EOL while scanning string literal
(I still don't understand why this isn't just treated as a bug in raw string
parsing and fixed...)
I would imagine that i
[Dan, this isn't "aimed" at you personally, it's just a follow-up on the
general point I am (and I think you are also) making]
On 11/02/17 02:17, Dan Sommers wrote:
At least it works both ways:
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118] on linux
Type "help", "copyright"
On 10/02/17 19:15, Peter Pearson wrote:
> On Fri, 10 Feb 2017 13:59:45 +0200, Amit Yaron
wrote:
>> Use:
>>
>> try:
>>num=int(str)
>> except ValueError e:
>>print "Error: not an integer"
>
> What should happen if the user types "1.0"?
>
> To be flexible about this possibility, you could
On 06/02/17 12:56, Skip Montanaro wrote:
Is there a better way to approach this problem? (I also
have valgrind at my disposal, but am not very skilled in its use.)
valgrind is what I was going to suggest. You have to compile Python with
extra flags to get it to integrate well with valgrind tho
On 02/02/17 01:41, Chris Angelico wrote:
On Thu, Feb 2, 2017 at 10:49 AM, Erik wrote:
Well, _logically_ there is a flag (in as much as it could be thought of like
that to make it easy to understand - and in C, that's pretty much what you
have to actually do unless you really want to use
On 02/02/17 02:05, MRAB wrote:
Both suggestions are a little long-winded. Couldn't we just abbreviate
them to "else:"? :-)
You are not wrong ;)
E.
--
https://mail.python.org/mailman/listinfo/python-list
On 01/02/17 23:20, Wildman via Python-list wrote:
On Wed, 01 Feb 2017 21:29:00 +, Chris Green wrote:
Wildman wrote:
On Wed, 01 Feb 2017 19:15:13 +, Chris Green wrote:
OK, no problem, but isn't it very non-portable?
I don't see why not. It should work on any system
that has Python3
On 30/01/17 02:14, Steve D'Aprano wrote:
On Mon, 30 Jan 2017 10:52 am, Erik wrote:
It would be even better if it was "else if not break:" to make the
meaning clearer.
break is not the only way to exit the for loop
Fine - "else if not break or raise or return:"
On 29/01/17 14:42, Steve D'Aprano wrote:
1. for...else is misspelled, and should be for...then;
2. Same for while...else;
I don't think I'll ever agree with you on this one.
"then", to me, implies the code following it is always executed.
"else" implies it's conditional.
In those constructs
On 27/01/17 21:36, MRAB wrote:
"loose"? Don't you mean "lose"? (Or possible "lack"?)
Don't you mean 'Or possibly "lack"'?
https://en.wikipedia.org/wiki/Muphry%27s_law ;)
E.
--
https://mail.python.org/mailman/listinfo/python-list
Hi Steven,
On 17/01/17 07:05, Steven D'Aprano wrote:
I wish to emulate a "final" class using Python, similar to bool:
[snip]
It doesn't have to be absolutely bulletproof, but anyone wanting to subclass my
class should need to work for it, which hopefully will tell them that they're
doing som
Hi,
On 15/01/17 19:58, David D wrote:
I am creating a parent class and a child class. I am inheriting from
the parent with an additional attribute in the child class. I am
using __str__ to return the information. When I run the code, it
does exactly what I want, it returns the __str__ informa
[Replying to direct email. David - please respond to the list so that
you can receive other people's suggestions also]
Hi David,
On 14/01/17 15:30, David D wrote:
> 1) No this is not homework, I am doing this all on my own.
In that case I apologise - I gave you the benefit of the doubt though
Hi,
On 13/01/17 22:26, daviddsch...@gmail.com wrote:
The issue I am having is that when i enter the sentinel value of QUIT, it gets
initialized as the name and printed out. How can I get around this?
If I understand the question correctly (which looks like it's just a
re-worded homework que
On 10/01/17 03:02, Deborah Swanson wrote:
Erik wrote, on January 09, 2017 5:47 PM
IIRC, you create it using a list comprehension which creates the
records. A list comprehension always creates a list.
Well no. The list is created with:
records.extend(Record._make(row) for row in rows)
No
On 10/01/17 00:54, Deborah Swanson wrote:
Since I won't change the order of the records again after the sort, I'm
using
records.sort(key=operator.attrgetter("Description", "Date"))
once, which also works perfectly.
So both sorted() and sort() can be used to sort namedtuples. Good to
know!
A
On 04/01/17 02:47, Callum Robinson wrote:
> On Wednesday, January 4, 2017 at 3:35:53 PM UTC+13, Erik wrote:
> I did it and this is what it states when i run it
>
> hello.
> I have thought of a number between 1 and 100.
> Can you guess it?
> 5
> Low
> Sorry , you are to
1 - 100 of 984 matches
Mail list logo