On 06/22/2014 11:03 AM, pyt...@bdurham.com wrote:
Should I have any performance concerns with the index position used
to pop() values off of large lists? In other words, should pop(0) and
pop() be time equivalent operations with long lists?
I believe lists are optimized for adding and removin
On 06/24/2014 08:58 AM, Chris Angelico wrote:
Basically, C is for writing high level languages in, and Python and
Pike are for writing applications. Life is good.
+1 QOTW
--
https://mail.python.org/mailman/listinfo/python-list
On 06/24/2014 07:04 AM, Chris Angelico wrote:
Here's what I'd try:
import sys
sys.modules[d1.__class__.__module__].__file__
sys.modules[d2.__class__.__module__].__file__
Do those in both environments and see where things are actually coming
from.
Debugging tips always appreciated.
Thanks,
On 06/25/2014 07:24 AM, Grant Edwards wrote:
On 2014-06-25, Marko Rauhamaa wrote:
Some years back my employer switched ISPs in Southern California. The
following morning Google displayed everything in Hebrew. It took a week
or two to be corrected.
Learning Hebrew in a week or two is a pretty
On 06/30/2014 07:44 AM, pyt...@bdurham.com wrote:
Nice!!!
I need to study your solution, but at first blush it looks exactly like
what I wanted to implement.
Keep in mind that dict /will not/ call your overridden methods, so if, for example, you provide your own __getitem__ you
will also nee
On 06/30/2014 09:47 AM, pyt...@bdurham.com wrote:
Keep in mind that dict /will not/ call your overridden methods, so if,
for example, you provide your own __getitem__ you will also need to
provide your own copies of any dict method that calls __getitem__.
I'm not sure I understand. Are you say
On 06/30/2014 12:34 PM, Peter Otten wrote:
RainyDay wrote:
def __eq__(self, other):
return self._loc == getattr(other, "_loc", None)
Note that None is not a good default when _loc is expected to be a tuple:
In this case None is not being returned, but will be comparid with sel
On 07/01/2014 10:30 AM, Skip Montanaro wrote:
This is only Python-related because the package in question (lockfile
at PyPI) is written in Python and hosted (at least in part) on PyPI. I
have not had any interest in maintaining this package for a few years.
I wrote it mostly as an exercise, and w
On 07/02/2014 04:22 PM, Wolfgang Maier wrote:
So, everything's just fine except that it may be more convenient to use
Popen().communicate() to avoid raising the error in the first place :)
Nice sleuthing! :)
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
On 07/08/2014 07:53 AM, Anders J. Munch wrote:
>
Most people don't need to deal with NaN's in Python at all,
fortunately. They just don't appear in normal computation, because the
interpreter raises an exception instead.
What exception? Apparently your claims about NaN in Python are all
wrong
On 07/08/2014 12:04 PM, Anders J. Munch wrote:
Ethan Furman skrev:
What exception? Apparently your claims about NaN in Python are all wrong --
have you been using a custom interpreter?
>>> float('inf') - float('inf')
nan
If you deliberately try to manufacture
On 07/08/2014 12:50 PM, Ian Kelly wrote:
On Tue, Jul 8, 2014 at 1:16 PM, Ethan Furman wrote:
What you said is: "They just don't appear in normal computation, because the
interpreter raises an exception instead."
I just ran a calculation that created a NaN, the same as 4 - 3 c
On 07/08/2014 11:54 AM, Anders J. Munch wrote:
If a standard tells you to jump of a cliff...
because a bunch of tanks are chasing you down, there's water at the bottom, and
not a helicopter in sight...
well, jumping off the cliff could easily be your best chance. ;)
--
~Ethan~
--
https://m
On 07/08/2014 02:04 AM, Steven D'Aprano wrote:
On Tue, 08 Jul 2014 09:48:08 +0100, Mark Lawrence wrote:
A GIL-less Python? See
http://morepypy.blogspot.co.uk/2014/07/pypy-stm-first-interesting-
release.html
Both Jython and IronPython are GIL-less, and have been forever.
Yeah, but one requi
On 07/09/2014 12:00 AM, Steven D'Aprano wrote:
I propose:
[adding new operators]
-1
Too much added confusion, too little gain.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
On 07/08/2014 07:53 AM, Anders J. Munch wrote:
So I make this claim: float.__eq__ implementing IEEE-754 NaN
comparison rules creates real problems for developers. And it has
never, ever, helped anyone do anything.
"Never" is a strong claim, and easily disproven if false: Simply
provide a counte
On 07/09/2014 02:09 PM, Anders J. Munch wrote:
Ethan Furman:
I would suggest you ask for this on the numerical mailing lists instead of here
-- and you may not want to offer a
beer to everyone that has an anecdote for NaN behavior being useful.
I don't have time to start this discu
On 07/09/2014 04:03 PM, Anders J. Munch wrote:
Joel Goldstick wrote:
I've been following along here, and it seems you haven't received the answer
you want or need.
So far I received exactly the answer I was expecting. 0 examples of NaN!=NaN
being beneficial.
python-list (in whichever fro
On 07/10/2014 05:20 PM, Cameron Simpson wrote:
I posted this the other day and haven't seen a response, not even a scathing
rejection...
Here's an alternative proposal that doesn't involve a new operator.
[snip float-context manager stuff]
Decimal has a context manager like that already (I
On 07/11/2014 10:07 PM, Alan Bawden wrote:
Steven D'Aprano writes:
But perhaps we only care about changes in value, not type. NAN or no NAN,
list equality works fine:
py> data = [1.0, 2.0, float('nan'), 4.0]
py> old = data[:]
py> old == data # No changes made yet, should return True
True
Y
On 07/11/2014 11:39 PM, Chris Angelico wrote:
On Sat, Jul 12, 2014 at 4:11 PM, Ethan Furman wrote:
class list:
def __eq__(self, other):
if len(self) != len(other):
return False
for this, that in zip(self, other):
if this is that or this == that
On 07/14/2014 06:01 PM, Wes Turner wrote:
From
http://www.reddit.com/r/Python/comments/17c69p/i_was_told_by_a_friend_that_learning_python_for/c84bswd
:
* http://www.python.org/community/jobs/
* https://jobs.github.com/positions?description=python
* http://careers.joelonsoftware.com/jobs?searc
On 07/16/2014 02:32 PM, MRAB wrote:
On 2014-07-16 21:40, Skip Montanaro wrote:
Sorry, who is "rr"? I went looking in the referenced thread but found
nobody with those initials. Not so helpfully, Gmail elides most sigs,
so I couldn't reliably scan the full text either.
"rr" is "rantingrickjohn
On 07/16/2014 08:35 PM, alex23 wrote:
On 15/07/2014 3:28 PM, Steven D'Aprano wrote:
# === module params.py ===
class Params(object):
a = 1
b = 2
@property
def c(self):
return self.a**2 + self.b**2 - self.a + 1
params = Params()
del Params # hide the class
Then c
On 07/23/2014 01:14 PM, Joseph L. Casale wrote:
I am doing some scripting with pyVmomi under 2.6.8 so the code may
run directly on a vmware esxi server.
As the code is long running, it surpasses the authentication timeout. For
anyone familiar with this code and/or this style of programming, doe
On 07/30/2014 01:20 PM, guirec.cor...@gmail.com wrote:
I'm looking for online courses and any ressources I can have on the subject.
Udacity [1] has some free computer courses, a few of which use Python as the
language -- what I have seen so far is decent.
O'Reilly [2] has four very good Pyth
On 07/31/2014 10:46 AM, Je Ph wrote:
Ethan et al, has anyone completed the oreilly python 1 through python 4
training courses (part of their Python
Certificate track)? Looks like it will take over 2 months to complete it and
it's expensive.
I have completed all four courses. The time it tak
On 08/06/2014 03:26 PM, Ben Finney wrote:
Virgil Stokes writes:
Suppose I have a directory C:/Test that is either empty or contains
more than 200 files, all with the same extension (e.g. *.txt). How
can I determine if the directory is empty WITHOUT the generation of a
list of the file name
On 08/08/2014 04:51 AM, cool-RR wrote:
If I want to acquire a `threading.Lock` using the context manager protocol,
is it possible to specify the `blocking` and `timeout` arguments that
`acquire` would usually take?
Not that I know of, but why would you want to? There's no built-in 'if' with
On 08/13/2014 09:00 AM, Steven D'Aprano wrote:
What is the rationale for str not having __radd__ method?
At a guess I would say because string only knows how to add itself to other
strings, so __add__ is sufficient.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
On 08/13/2014 10:55 AM, Steven D'Aprano wrote:
Ethan Furman wrote:
On 08/13/2014 09:00 AM, Steven D'Aprano wrote:
What is the rationale for str not having __radd__ method?
At a guess I would say because string only knows how to add itself to
other strings, so __add__ is
On 08/13/2014 07:01 PM, luofeiyu wrote:
help(int.__init__)
Help on wrapper_descriptor:
__init__(self, /, *args, **kwargs)
Initialize self. See help(type(self)) for accurate signature.
what is the "/" mean in __init__(self, /, *args, **kwargs) ?
The '/' means that all arguments before i
On 08/13/2014 07:12 PM, Tim Chase wrote:
Where are you seeing this?
Probably in 3.4, or the tip (what will be 3.5).
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
On 08/18/2014 07:51 AM, Grant Edwards wrote:
To all of us out here in user-land a change in the first value in the
version tuple means breakage and incompatibilities. And when the
second value is "0", you avoid it until some other sucker has found
the bugs and a few more minor releases have come
On 08/18/2014 10:00 AM, ElChino wrote:
"Grant Edwards" wrote:
To all of us out here in user-land a change in the first value in the
version tuple means breakage and incompatibilities. And when the
second value is "0", you avoid it until some other sucker has found
the bugs and a few more minor
On 08/18/2014 01:58 PM, ElChino wrote:
"Marko Rauhamaa" wrote:
In almost all cases, both tests would result in the same behavior.
However, the "is not" test is conceptually the correct one since you
want to know if x is the one and only None object. You don't want to be
fooled by an imposter o
On 08/18/2014 03:04 PM, Chris Kaynor wrote:
On Mon, Aug 18, 2014 at 2:42 PM, Ethan Furman wrote:
If you are not dealing with singletons (which is most cases), such as numbers,
strings, lists, and most other
arbitrary objects, you will need to use "!=" or anytime the two objec
On 08/27/2014 10:29 AM, Rustom Mody wrote:
Git has won the battle
Good thing there's room for more than one technology.
I use hg because 1) python-dev uses hg; and 2) I understand the simple hg commands. I find git confusing, and my main
uses are commit, pull, update, an occasional merge, a
On 08/27/2014 11:51 AM, Skip Montanaro wrote:
Thank God for StackOverflow. :-)
+1 QotW
--
https://mail.python.org/mailman/listinfo/python-list
On 08/27/2014 08:32 PM, Chris Angelico wrote:
I'm not sure I understand how your 'common' value works, though. Does
the default 0.6 mean you take the 60% most common words? Those above
the 60th percentile of frequency? Something else?
What's the value in ruling out less common words? I would
On 08/29/2014 10:04 AM, Skip Montanaro wrote:
On Fri, Aug 29, 2014 at 9:54 AM, Roy Smith wrote:
Yeah, schema migration is an ugly problem.
It's not really any worse than any other sort of complex data
structure change, is it? If your persistent data lived in a pickle
file, it would likely be
On 08/29/2014 04:47 PM, Skip Montanaro wrote:
On Aug 29, 2014 5:34 PM, "Chris Angelico" wrote:
I'm not sure how suckitude is affected by bugs, exactly; possibly O(N
log N), because each bug has a small probability of affecting another
bug.
OTOH, bug fixes often have a fairly high probability
On 09/03/2014 11:10 AM, Seymore4Head wrote:
import math
import random
import sys
b=[]
steve = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
for x in steve:
print (steve[x])
Traceback (most recent call last):
File "C:\Functions\blank.py", line 7, in
print (steve[x])
IndexError: list index
On 09/03/2014 11:49 AM, Seymore4Head wrote:
On Wed, 03 Sep 2014 14:10:42 -0400, Seymore4Head
wrote:
import math
import random
import sys
b=[]
steve = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
for x in steve:
print (steve[x])
Traceback (most recent call last):
File "C:\Functions\blank.py",
On 09/03/2014 11:41 AM, Seymore4Head wrote:
On Wed, 03 Sep 2014 11:33:46 -0700, Ethan Furman wrote:
Python will be incredibly hard if you don't read any of the docs or tutorials
available.
You can't accuse me of that. I have actually read quite a bit. I may
not be picking it up
On 09/03/2014 02:52 PM, jaron.br...@gmail.com wrote:
Ethan, Steve, Tim, and others:
I'm thinking of taking the program. How long, in hours, does it take to
complete all four Python courses?
That is an impossible question to answer accurately.
I took the classes already having extensive knowl
On 09/03/2014 08:22 PM, Rustom Mody wrote:
On Thursday, September 4, 2014 7:26:56 AM UTC+5:30, Chris Angelico wrote:
On Thu, Sep 4, 2014 at 11:48 AM, Rustom Mody wrote:
NO PRINT
Yes, or the OP could work with actual saved .py files and the
reliability that comes from predictable execution e
On 09/05/2014 09:48 AM, Seymore4Head wrote:
I'm still doing practice problems. I haven't heard from the library
on any of the books I have requested.
http://www.practicepython.org/exercise/2014/04/16/11-check-primality-functions.html
This is not a hard problem, but it got me to thinking a litt
On 09/05/2014 10:17 AM, Ian Kelly wrote:
I would not worry about the else clause as a beginner, as it's
relatively unique to Python and tends to be somewhat confusing. Use a
flag or refactor the function instead.
I don't disagree with this, but early exposure to "for..else is for search loops"
On 09/23/2014 07:48 AM, Steven D'Aprano wrote:
alas, the CUTOVER point is likely to be machine-dependent. Take it as a
given that inserting a fixed CUTOVER point into the source code (say,
``CUTOVER = 123456``) is not likely to be very effective, and dynamically
calculating it at import time is
On 09/23/2014 09:32 AM, Rob Gaddi wrote:
On Tue, 23 Sep 2014 05:34:19 -0700 (PDT) Miki Tebeka wrote:
Before I start writing my own. Is there something like collections.Counter (fore
frequencies) that does "fuzzy" matching?
Meaning x is considered equal to y if abs(x - y) < epsilon. (x, y and
On 09/26/2014 06:30 PM, Dave Angel wrote:
Not Found
Worked fine for me.
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
On 10/02/2014 10:01 AM, Mark Lawrence wrote:
My apologies if this has been discussed before but I thought it may be of
interest
wphomes.soic.indiana.edu/jsiek/files/2014/08/retic-python-v3.pdf
Looks interesting, thanks for the link!
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/pyth
On 10/08/2014 12:09 PM, Terry Reedy wrote:
On 10/8/2014 6:57 AM, Steven D'Aprano wrote:
According to the documentation, operator.__add__ is the "official" function,
and operator.add is just there for convenience.
You are paraphrasing "The function names are those used for special class
metho
[redirecting back to the list]
On 10/08/2014 02:23 PM, random...@fastmail.us wrote:
On Wed, Oct 8, 2014, at 15:53, Ethan Furman wrote:
On 10/08/2014 12:49 PM, random...@fastmail.us wrote:
On Wed, Oct 8, 2014, at 15:38, Ethan Furman wrote:
LOL, no kidding! The main reason I bother using the
On 10/08/2014 03:46 PM, Terry Reedy wrote:
On 10/8/2014 5:49 PM, Ethan Furman wrote:
[redirecting back to the list]
I'm not sure what situation you would have to type them (as opposed to
simply a + b) that the operator module would help with.
unittest springs to
Chris Angelico wrote:
On Sat, Sep 10, 2011 at 10:24 PM, Alister Ware
wrote:
Ignoring the docttests my process would be to process each word & then
manually capitalize he 1st word, .I would als0 use a comprehension as
makes for cleaner code:-
def capitalize(word):
if word in small_words:
Terry Reedy wrote:
On 9/11/2011 12:01 AM, Ian Kelly wrote:
On Sat, Sep 10, 2011 at 1:36 PM, Terry Reedy wrote:
The statement containing the explicit next(items) call can optionally be
wrapped to explicitly handle the case of an empty iterable in whatever
manner is desired.
try:
except St
Nick Stinemates wrote:
I'm honestly missing the point of this mail.
rantingrick is a well-known troll, and doesn't need to have a point.
Please do not feed the troll.
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano wrote:
On Wed, 14 Sep 2011 02:12 pm Stefan Behnel wrote:
Matt Joiner, 14.09.2011 04:23:
i'm curious as to what can be done with (and handled better) by
adjusting sys.setswitchinterval
i've opened a question on SO for this, that people might find of
interest: http://stackoverflo
Roy Smith wrote:
In article ,
Henrik Faber wrote:
On 19.09.2011 13:23, Paul Rudin wrote:
Henrik Faber writes:
How can I make this commutative?
Incidentally - this isn't really about commutativity at all - the
question is how can you define both left and right versions of add,
irrespectiv
Peter Pearson wrote:
On Mon, 19 Sep 2011 05:48:07 -0700, Ethan Furman wrote:
[snip]
Also, if the right-hand operand is a subclass of the left-hand operand
then Python will try right-hand_operand.__radd__ first.
I don't think it works that way for me:
Python 2.6.5 (r265:79063, Apr 16
Mark Dickinson wrote:
On Sep 21, 2:07 am, Steven D'Aprano wrote:
After playing around with various combinations of C1, C2, D1 and D2, it
seems to me that the rule is:
If the right-hand argument is a subclass of the left-hand argument, AND also
defines __radd__ directly rather than inheriting i
Steven D'Aprano wrote:
After playing around with various combinations of C1, C2, D1 and D2, it
seems to me that the rule is:
If the right-hand argument is a subclass of the left-hand argument, AND also
defines __radd__ directly rather than inheriting it, then its __radd__
method is called before
I remember that 'class' is sugar for type().
I don't remember if 'def' is sugar for something besides lambda.
Any clues for me? Heck, I'll even be grateful for outright answers!
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Petite Abeille wrote:
On Sep 29, 2011, at 8:49 PM, Devin Jeanpierre wrote:
It could certainly be _interpreted_ as an attack
(and was interpreted that way), and that's really all that's necessary
for a hostile environment.
In other news:
http://alt.textdrive.com/assets/public/non/nq050616.gi
Ben Finney wrote:
But whoever takes that joke and says it's deliberately hurtful is being
presumptuous and censorious and unreasonable. If they then castigate the
joker for supposedly hurting someone's feelings, it's at that point the
atmosphere turns hostile to discussion.
Um, wasn't it Rantin
Ethan Furman wrote:
Ben Finney wrote:
But whoever takes that joke and says it's deliberately hurtful is being
presumptuous and censorious and unreasonable. If they then castigate the
joker for supposedly hurting someone's feelings, it's at that point the
atmosphere turns hostil
rusi wrote:
On Sep 30, 9:41 pm, Chris Angelico wrote:
On Sat, Oct 1, 2011 at 2:38 AM, Dennis Lee Bieber wrote:
And I would argue that by starting with "Look out your window..."
you have explicitly excluded the rest of the world from consideration in
answering; you have narrowed the fo
Tim Chase wrote:
On 10/07/11 07:38, Peter Otten wrote:
Are there best practices for testing dates that are properties
which take the current date into consideration
The problem is that the behavior of the window_date function
depends on the current date (the function makes a guess about
adding
Ian Kelly wrote:
On Thu, Oct 20, 2011 at 12:00 PM, Hans Mulder wrote:
There's already a discussion about this on python-ideas. But somebody
please tell me, why would you ever need to compare ranges?
It could be useful if you're unit-testing a function that returns a range.
Easy:
list(range
dhyams wrote:
Python 2.7.2
I'm having trouble in a situation where I need to mix-in the
functionality of __getattr__ after the object has already been
created. Here is a small sample script of the situation:
=snip
import types
class Cow(object):
pass
# this __getattr__ works
Devin Jeanpierre wrote:
Well. It reads fine in a certain sense, in that I can figure out
what's going on (although I have some troubles figuring out why the
heck certain things are in the code). The issue is that what's going
on is otherworldly: this is not a Python pattern, this is not a normal
Benjamin Kaplan wrote:
You're still misunderstanding Python's object model. del does NOT
delete an object. It deletes a name. The only way for an object to be
deleted is for it to be inaccessible (there are no references to it,
or there are no reachable references to it).
foo = object()
bar = fo
Devin Jeanpierre wrote:
The only reason valid python identifiers come into it at all is
because they get pasted into a string where identifiers would go, and
that string is passed to exec().
So really, does it have "nothing" to do with exec? Or does your
argument eventually boil down to the use
Asking on behalf of Sven Marnach:
-
Assume we have the type Noddy as defined in the tutorial on writing C
extension modules for Python. Now we want to create a derived type,
overwriting only the __new__() method of Noddy.
Cur
The question is on StackOverflow if you want to answer it directly:
http://stackoverflow.com/questions/8066438
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
The code in 'else' in a 'try/except/else[/finally]' block seems
pointless to me, as I am not seeing any difference between having the
code in the 'else' suite vs having the code in the 'try' suite.
Can anybody shed some light on this for me?
~Ethan~
--
http://mail.python.org/mailman/listinfo/p
Thanks, all!
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Roy Smith wrote:
class User(Document):
@staticmethod
def _get_next_id():
[blah, blah, blah]
return id
user_id = IntField(required=True, default=_get_next_id)
If you don't call '_get_next_id()' from any class methods (in other
words, if you don't need to ever say 'se
Den wrote:
With respect, I disagree with advice that the use of a language
construct should be rare. All constructs should be used
*appropriately*.
+1
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
plsulliv...@gmail.com wrote:
s = GIS.GIS.Cadastral\GIS.GIS.Citylimit
NeededValue = Citylimit
NeededValue = s.rsplit('.', 1)[1]
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Lie Ryan wrote:
On 12/05/2011 11:52 AM, 8 Dihedral wrote:
On Monday, December 5, 2011 7:24:49 AM UTC+8, Ian wrote:
On Sun, Dec 4, 2011 at 4:17 PM, 8 Dihedral
wrote:
Please explain what you think a hash function is, then. Per
Wikipedia, "A hash function is any algorithm or subroutine
Benjamin Kaplan wrote:
On Thu, Dec 8, 2011 at 1:42 PM, Roy Smith wrote:
(some,
very,
long,
list,
of,
variable,
names,
to,
get,
the,
stuff,
unpacked,
into) = function_that_should_return_a_14_tuple()
raises
ValueError: too many values to unpack
Quick, what's the bug? Did I forget
Jean-Michel Pichavant wrote:
You have to opportunity to not use unpacking anymore :o) There is a
recent thread were the dark side of unpacking was exposed. Unpacking is
a cool feautre for very small applications but should be avoided
whenever possible otherwise.
Which thread was that?
~Etha
Benjamin Kaplan wrote:
On Thu, Dec 8, 2011 at 2:09 PM, Ethan Furman wrote:
Benjamin Kaplan wrote:
If the RHS was a tuple or a list, yes you could know immediately. But
unpacking works with any iterable, so it probably doesn't special-case
lists and tuples. Iterables don't have a
Chris Angelico wrote:
One piece of sophistication that I would rather like to see, but don't
know how to do. Instead of *args,**kwargs, is it possible to somehow
copy in the function's actual signature? I was testing this out in
IDLE, and the fly help for the function no longer gave useful info
a
Chris Angelico wrote:
One piece of sophistication that I would rather like to see, but don't
know how to do. Instead of *args,**kwargs, is it possible to somehow
copy in the function's actual signature? I was testing this out in
IDLE, and the fly help for the function no longer gave useful info
a
Jean-Michel Pichavant wrote:
Ethan Furman wrote:
Jean-Michel Pichavant wrote:
You have to opportunity to not use unpacking anymore :o) There is a
recent thread were the dark side of unpacking was exposed. Unpacking
is a cool feautre for very small applications but should be avoided
whenever
Massi wrote:
Thank you all for your replies, first of all my Sum function was an
example simplifying what I have to do in my real funciton. In general
the D dictionary is complex, with a lot of keys, so I was searching
for a quick method to access all the variables in it without doing the
explici
alex23 wrote:
On Dec 11, 4:42 pm, Nobody wrote:
If just you're trying to avoid getting a repetitive strain injury in your
right-hand little finger from typing all the [''], you could turn
the keys into object attributes, e.g.:
class DictObject:
def __init__(self, d):
alex23 wrote:
On Dec 9, 8:08 pm, Robert Kern wrote:
On 12/9/11 5:02 AM, alex23 wrote:
The 3rd party 'decorator' module takes care of issues like docstrings
& function signatures. I'd really like to see some of that
functionality in the stdlib though.
Much of it is:
http://docs.python.org
Andrea Crotti wrote:
I'm not sure for how long I had this bug, and I could not understand the
problem.
I had a function which would return a boolean
def func_bool():
if x:
return True
else: return False
Now somewhere else I had
if func_bool:
# do something
I could not qu
In the near future I will need to parse and rewrite parts of a xml files
created by a third-party program (PrintShopMail, for the curious).
It contains both binary and textual data.
There has been some strong debate about the merits of minidom vs
ElementTree.
Recommendations?
~Ethan~
--
http:
Tim Chase wrote:
On 12/15/11 10:48, Roy Smith wrote:
I've got a list, ['a', 'b', 'c', 'd']. I want to generate the string,
"a, b, c, and d" (I'll settle for no comma after 'c'). Is there some
standard way to do this, handling all the special cases?
[] ==> ''
['a'] ==> 'a'
['a', 'b'] ==>
Terry Reedy wrote:
On 12/16/2011 4:22 AM, Steven D'Aprano wrote:
On Thu, 15 Dec 2011 19:39:17 -0500, Terry Reedy wrote:
[...]
After reading your post, I think I have worked out where our disagreement
lies: you think that bound methods and instance methods are not the same
thing,
Do you agree
Ethan Furman wrote:
Terry Reedy wrote:
On 12/16/2011 4:22 AM, Steven D'Aprano wrote:
On Thu, 15 Dec 2011 19:39:17 -0500, Terry Reedy wrote:
[...]
After reading your post, I think I have worked out where our
disagreement
lies: you think that bound methods and instance methods are no
Rami Chowdhury wrote:
On Tue, Dec 20, 2011 at 16:56, Ulrich Eckhardt
wrote:
To be extra safe or in more complicated scenarios, I could wrap this in a
try-except and explicitly close those that were already created, but
normally I'd expect the garbage collector to do that for me ... or am I then
Neal Becker wrote:
Clarification: where can packing/unpacking syntax be used?
It would be great if it were valid essentially anywhere (not limited to
parameter passing).
What about constructs like:
a, @tuple tail, b = sequence?
You mean like Python 3's:
a, *middle, b = sequence
?
--
htt
Steven D'Aprano wrote:
I'm just glad that you've put your money
where your mouth is, and released the package, instead of demanding
others do the work. Thank you.
+1000!
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
1201 - 1300 of 1928 matches
Mail list logo