ecent call last):
File "", line 1, in
NameError: name 'a' is not defined
>>> def f():
... global a
... for a in range(10):
... pass
...
>>> f()
>>> a
9
This also means that you can do odd things like:
for self.foo in range(10):
or:
for my_li
On 12/5/14 7:34 AM, Steven D'Aprano wrote:
Ned Batchelder wrote:
On 12/5/14 4:53 AM, Steven D'Aprano wrote:
Oh, I learned something new: strictly speaking, this is implementation-
dependent and not guaranteed to work in the future!
def func():
global math
import math
ough about differing indent widths that they need to use tabs so they
can each have their own way, then you probably have bigger collaboration
issues.
Use four spaces, and be done with it. Agree with your team members on
how your code will look, then innovate on the important things.
--
considering trying to maintain code
using a mix of tabs and spaces like that. That's a nightmare.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
cters deep, and that is akin
to trying to define the value of PI to be 3.
So you've started by trying to use tabs so that people can choose the
indentation width they like, and ended up with a strict rule that you
cannot change the size of tabs.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
On 12/5/14 10:04 PM, Michael Torrie wrote:
On 12/05/2014 07:31 PM, Ned Batchelder wrote:
This is a perfect example! The code (with tabs as >--- and leading
spaces as .) is:
>---if (!list_empty(pending))
>--->---ret = list_first_entry(pending, struct
t a list
comprehension to make result? OK, let's try this:
result = map(next, iters)
Oops, another infinite loop on Py3, right, because map is lazy, so the
StopIteration doesn't happen until the tuple() call. OK, try this:
result = list(map(next, iters))
Nope, still infi
27;s solving your problem.
I'm curious why you care about the "79 characters" part of PEP8 if you
don't care about the "use spaces" part of PEP8.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
On 12/10/14 11:10 AM, Jean-Michel Pichavant wrote:
self.mass = (mass is None and radius**2) or mass
When will this idiom die? We've had actual if-expressions for a while now:
self.mass = radius**2 if mass is None else mass
--
Ned Batchelder, http://nedbatchelder.com
--
have gone
wrong - 'soup' has been defined as an object made of file
'EcologicalPyramid.html
I hope you can help me on this point.
For complex code experiments, it's better to put the code in a file, and
run the file. But if you do want to use the interactive interpreter,
enter code carefully, and watch out for the error messages.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
mmendation that's good for 99% of code may not work
for you.
Be flexible. Do what works.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
, the normal error raised would be TypeError and not SyntaxError; I'd
like to suggest special-casing this so that using getattr(), setattr(), and
hasattr() in this way raise SyntaxError instead as I think that will be less
astonishing.
Thoughts?
Thanks,
Cem Karan
Can you explain why you think it is important that setattr(obj, '3', 3)
raise an error at all? Yes, it surprised you, but there are many
aspects of Python that are surprising. That's not a bad thing in and of
itself.
Did this cause a real problem in your code? Is there a way that
allowing non-identifier attribute names will be harmful?
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
27;setdefault', 'update', 'values']
d.clear()
This cleared the contents of d, which is also sys.modules, so you have
clobbered sys.modules. This will make many things stop working in Python.
Traceback (most recent call last):
File "", line 1, in
d
Traceback (most recent call last):
File "", line 1, in
quit()
Traceback (most recent call last):
File "", line 1, in
Like all of these things.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
= ‘h’ #or b = ‘hh’
Testing cmd: python -m cProfile test.py
So what is wrong here? B has one more malloc than A but is faster than B?
Thanks,
Dave
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
plain why a platform has or doesn't have
lchmod, but "man lchmod" might fail for you also, as it does for me on
Ubuntu.
--
~Ethan~
[1] https://docs.python.org/2/library/os.html#os.lchmod
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
thing:
#sample code line for binary encoding into string output
s_values += "0x" + str(l_data[J][I]).encode("hex").replace("\\", "")
+ ", "
TIA
Jacob Kruger
Blind Biker
Skype: BlindZA
"Roger Wilco wants to welcome you...to the space janitor's closet..."
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
, but I've used:
for b in options.bar or ():
do_stuff(b)
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
ore detail here:
http://nedbatchelder.com/blog/200811/things_i_dont_like_about_doctest.html
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
spell-correct.html
I used it as a walk-through example for a presentation about Python at
the DevDays conference: http://nedbatchelder.com/text/devdays.html
The second half of the presentation is a 25-line nano-templating engine
which shows off some other good characteristics of the
Because, from my own study of Python, I've came to realize that the
distinction between objects and instances of objects actually exists. In
Python, class objects cannot participate in OOP, only their instances.
What does "participate in OOP" mean?
This is why I say that even in P
;>> Sub.func()
TypeError: func() missing 1 required positional argument: 'self'
But somehow I think you knew the answer to all these questions and were
instead being snarky.
I am not being snarky, I'm trying to understand where our mutual
incomprehension lies.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
parameter to the function? If so, then:
fun(*sys.argv)
Robert, this will work, but keep in mind that sys.argv is a list of
strings, always. If your function is expecting integers, you will have
to do an explicit conversion somewhere.
--
Ned Batchelder, http://nedbatchelder.com
--
https
e fine.
Also, look into how you are posting, the code is nearly mangled. :(
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
On 2/9/15 2:24 PM, Ned Batchelder wrote:
On 2/9/15 2:14 PM, Charles Hixson wrote:
I'm trying to write a correct iteration over a doubly indexed container,
and what I've got so far is:def __next__ (self):
for rowinrange(self._rows):
for col in range(
On 2/12/14 5:55 AM, wxjmfa...@gmail.com wrote:
The fascinating aspect of this FSR lies
in its mathematical absurdity.
jmf
Stop.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
ually lie and return the same instance over and over.
It makes them impossible to test: your unit tests all act on the same
object, there's no way to start over with a fresh object.
If you only want one object, create just one, and use it everywhere.
--
Ned Batchelder, http://ne
object for the next time it's needed.
But that's different than a class which pretends to make instances but
actually always returns the same instance.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
to the folks who did the timings (and saved me from the trouble!)
Last but not least... s[::len(s)-1] omg!!? ;-D
If you aren't worried about performance, why are you choosing your code
based on which is the fastest? There are other characteristics
(clarity, flexibility, robustness,
Python refer to values. Thinking in terms of memory locations
might just confuse things.
This is my best explanation of the details:
http://nedbatchelder.com/text/names.html
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
e a list, or it can be something
"simple" like an int.
This covers all the details, including pictures like Marko's, but with
an explanation why we draw the ints inside the boxes:
http://nedbatchelder.com/text/names.html
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
on, but might help...",
or "You can think of it like ...".
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
p left to right, they chain left to right:
a + b + c
is the same as:
(a + b) + c
but:
a < b < c
is not the same as:
(a < b) < c
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
ape", 30),
)
He turned it into:
data = [
(0, 'apple'),
(0+20, 'orange'),
(0+20+50, 'grape'),
]
Each number is the cumulative probability up to but not including the item.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
er to drop out into asm and write
shl $3, %eax
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
programmer new to Python. The latter category is sometimes
the harder to teach, because you have to undo the things they learned
about their earlier language X, but which they mistakenly believe to be
true about all programming languages.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
see a way to disable all
those optimizations. I tried filing a bug about it
(http://bugs.python.org/issue2506), but it did not win the popular
support I had hoped for.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
it does this.
You have to invoke s.upper, with parens:
k = [s.upper() for s in k]
In Python, a function or method is a first-class object, so "s.upper" is
a reference to the method, "s.upper()" is the result of calling the method.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
wrong answer, and I don't know what to do if the file
you're looking for isn't in that directory.
Perhaps the shorter answer is, look in the Python executable directory,
then look in the directories on PATH.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
'/usr/local/virtualenvs/studygroup/bin/python'
>>> os.listdir(os.path.dirname(sys.executable))
['activate', 'activate.csh', 'activate.fish', 'activate_this.py',
'easy_install', 'easy_install-2.7', 'pip', 'pip-2.7', 'python',
'python2', 'python2.7']
>>>
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
On 2/20/14 10:55 AM, Oscar Benjamin wrote:
On 20 February 2014 15:42, Ned Batchelder wrote:
As roundabout and advanced as that code is, it doesn't give the right answer
for me. It returns None. On my Mac, after activating a virtualenv:
Python 2.7.2 (default, Oct 11 2012, 20:
y work exactly the same as Javascript or Ruby
variables.
Python's variables are names bound to values.
http://nedbatchelder.com/text/names.html has lots more details.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
On 2/21/14 9:47 PM, Dennis Lee Bieber wrote:
On Fri, 21 Feb 2014 09:59:17 -0800, Travis Griggs
declaimed the following:
On Feb 21, 2014, at 4:13 AM, Ned Batchelder wrote:
Man, do I hate this idea that Python has no variables. It has variables (names
associated with values, and the values
On 2/21/14 10:28 PM, Steven D'Aprano wrote:
On Fri, 21 Feb 2014 07:13:25 -0500, Ned Batchelder wrote:
On 2/21/14 2:23 AM, dieter wrote:
Sam writes:
I need to pass a global variable into a python function.
Python does not really have the concept "variable".
What appears t
rest of this thread, that Python *does* have the concept
of a variable, it just behaves differently than some other popular
programming languages (but exactly the same as some other popular
programming languages!)
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
nderstand: you show an if/elif chain that cannot be expressed
as a switch statement (because it uses < ), and then conclude that
Python needs a switch statement? That doesn't make any sense.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
On 2/28/14 8:08 PM, Mark H. Harris wrote:
On Friday, February 28, 2014 6:40:06 PM UTC-6, Ned Batchelder wrote:
I don't understand: you show an if/elif chain that cannot be expressed
as a switch statement (because it uses < ), and then conclude that
Python needs a switch statemen
uation. All of the solutions are too extreme, and
bring their own infelicities, and the actual problems caused by this
scenario are vanishingly small.
BTW: I also am mystified why you uses ellipses to end your sentences,
surely one period would be enough? :)
--
Ned Batchelder, h
th braces? It's not like there's
some engineer at Apple who meant for the code to read like this:
if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0) {
goto fail;
goto fail;
}
This looks to me like a poorly handled merge conflict maybe? I wond
than Haskell.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
is Python.
Skip
It's Hy: http://hylang.org
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
about the FSR,
and absurdly seems to think hinting at paper and pencil will convince us
he is right. Don't engage with him on this topic.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
he site is on github, and they are taking and resolving
issues there: https://github.com/python/pythondotorg/issues
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
On 3/8/14 8:31 AM, Ned Batchelder wrote:
On 3/8/14 7:44 AM, Nils-Hero Lindemann wrote:
Hi,
(Please forgive (or correct) my mistakes, i am non native)
http://www.python.org/community/sigs/retired/parser-sig/towards-standard/
* Formatting bug
* Needs breadcrumb navigation ("Where am i?&qu
of Python. It uses a JIT to produce
native code automatically, and can impressively speed up the execution
of Python programs. You should give it a try to see if it will help in
your situation.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python
set of code points in the string. It's specified in PEP 393:
http://legacy.python.org/dev/peps/pep-0393/
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
o do with your
style. It can be brief and contrarian, which puts people off. Perhaps
if you tried to understand the gap and bridge it more, people would be
less inclined to think that you were trying to widen the gap.
--Ned.
Marko
--
Ned Batchelder, http://nedbatchelder.com
--
h
_2.
The last sentence seems telling to me: if you don't care if objects are
equal, then don't use ==.
Of course, a long change of if's to figure out which object you have
seems odd to me...
--Ned.
George
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.py
efore .pyc files) across versions of Python, so if you want to
run from pure .pyc files, you have to be sure to use the same version of
Python that produced the files.
--Ned.
Marko
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
-Linux, python is python3...
Yes, and they have been told many times that this was foolish and wrong,
but it persists, much to our pain.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
your Python project, you decide between Python 2 and Python 3 and go all
in.
Plenty of people have adopted a dual-support strategy, with one code
base that supports both Python 2 and Python 3. The six module can help
a great deal with this.
Marko
--
Ned Batchelder, http://ne
On 3/20/14 4:42 PM, Marko Rauhamaa wrote:
Ned Batchelder :
Plenty of people have adopted a dual-support strategy, with one code
base that supports both Python 2 and Python 3. The six module can help
a great deal with this.
I wonder how easy the resulting code is to the eyes and how easy it
On 3/20/14 4:59 PM, Marko Rauhamaa wrote:
Ned Batchelder :
It's an extreme case, but the latest released version of coverage.py
supports Python 2.3 through 3.3 with one code base. To do it, there's
a compatibility layer (akin to six). Then you stay away from features
that aren'
On 3/20/14 8:32 PM, Steven D'Aprano wrote:
On Thu, 20 Mar 2014 16:26:39 -0400, Ned Batchelder wrote:
On 3/20/14 3:07 PM, Eric Jacoboni wrote:
Le 20/03/2014 16:21, Marko Rauhamaa a écrit :
All tutorials will tell you to start it with
#!/usr/bin/env python
which will start pytho
On 3/20/14 9:06 PM, Ned Batchelder wrote:
On 3/20/14 8:32 PM, Steven D'Aprano wrote:
On Thu, 20 Mar 2014 16:26:39 -0400, Ned Batchelder wrote:
On 3/20/14 3:07 PM, Eric Jacoboni wrote:
Le 20/03/2014 16:21, Marko Rauhamaa a écrit :
All tutorials will tell you to start it with
#
ow squarely in areas that
are 1) politically contentious, 2) wildly subjective, 3) none of our
areas of expertise. No good can come from continuing.
--Ned.
Marko
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
of spaces, and docstring-style comments in
places that aren't docstrings. These seem like unusual choices.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
characters in PropList.txt to
support backwards compatibility
Other_ID_Continue - likewise
All identifiers are converted into the normal form NFKC while parsing;
comparison of identifiers is based on NFKC.
ChrisA
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
wrong in those examples.
We aren't going to engage in this topic. The previous discussions have
always ended the same way. You should refer to those threads if you want
to re-acquaint yourself with other people's views on your theory and
discourse.
--Ned.
jmf
--
Ned Batche
re of course always welcome to write to
JMF privately, although he has never responded to me over that channel.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
choice(PRODUCTS), random.choice(range(10)))
for r in
range(randrange(7))])
The best way to ensure repeatability of random numbers is to avoid the
module-level functions, and instead create your own random.Random()
instance to generate numbers. Then you can be certain it isn't being
use
taken an
inventory of dependencies that must support 3.x before other code(s) can
be ported? Maybe there could be an on-line questionnaire regarding
perceived dependencies?
The Python Wall-Of-Shame/Wall-Of-Superpowers shows popular packages, and
their Python 3 status: http://pyth
:09)
[...]
Yeah, that's the wrong way to do it, and they shouldn't have done that.
"python" needs to mean Python 2.x for a long time.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
On 4/15/14 7:11 PM, Joshua Landau wrote:
On 15 April 2014 23:18, Ned Batchelder wrote:
On 4/15/14 5:34 PM, Joshua Landau wrote:
Arch is on 3.4 *default*.
$> python
Python 3.4.0 (default, Mar 17 2014, 23:20:09)
[...]
Yeah, that's the wrong way to do it, and they s
no need to pull in a new implementation. The stdlib module is
perfectly willing to give you your own private random number sequence to
use.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
7;t realize map accepted a callable of None (TIL!), but it no
longer does in Python 3. You'll have to do this a different way.
But seriously: just use dict() and be done with it. There's a lot here
that can be much simpler if you learn to use Python as it was meant to
be
at sounds like a pretty clean way: len(str(num).partition(".")[2]),
though it also sounds like you understand all of the inaccuracies in
that technique.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
On 4/28/14 2:39 PM, Roy Smith wrote:
On Monday, April 28, 2014 12:07:14 PM UTC-4, Ned Batchelder wrote:
On 4/28/14 12:00 PM, Roy Smith wrote:
38.0 ==> 0
[...]
Is there any clean way to do that? The best I've come up with so far is to
str() them and parse the
remaining string to
n.
Thanks again for your input.
---Andrew
BTW, it's a little easier to follow the threads of conversation if you
put your responses after the text you are responding to. This is known
as bottom-posting, and is preferred to top-posting as you did here.
--
Ned Batchelder, http://ne
, post the links here.
I know some of us will be interested to follow their progress. We all
want to see Python be the best it can be.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
tself, but that could possibly lead to import loops.
Any ideas?
In coverage.py, I used environment variables to control that kind of
behavior.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
a height of exactly 29,000 feet, but to avoid the appearance of an
estimate, they reported it as 29,002: http://www.jstor.org/stable/2684102
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
b1 (default, Dec 16 2013, 21:05:22)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> fine = 1
>>> fine
1
In Python 2 identifiers must be AS
n you be more explicit? It seems like you think it isn't fine. Why
not? What bothers you about it? Should there be an issue?
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
riables, you will have to
also say that neither do Javascript, Ruby, Java, PHP, etc. And if
Javascript has no variables, what does the var keyword mean?
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
On 5/6/14 5:00 PM, Mark H Harris wrote:
On 5/6/14 3:31 PM, Ned Batchelder wrote:
On 5/6/14 12:42 AM, Gary Herron wrote:
This gets confusing, but in fact the most accurate answer is that Python
does not have "variables", so there is no such thing as passing
"variables" by re
On 5/6/14 7:55 PM, Ben Finney wrote:
Ned Batchelder writes:
This meme bugs me so much. Python has variables. They work differently
than variables in C.
Which is why it's useful to intervene right at the start when someone
comes in with assumptions about “variables”; it's better
On 5/7/14 11:06 AM, antoine wrote:
Hi,
Python 2.7.5 (default, Nov 20 2013, 14:20:58)
[GCC 4.7.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
{0.: None, 0:None}
{0.0: None}
The second item disappeared!
Why?
I
sert foo == bar # FAILS, ‘bar’ == [1, 2, 3]
Can we make this concrete by speaking about a specific language? I
don't recognize this. I thought we were concerned with beginners
incorrectly thinking Python worked like C, but this is nothing like C.
--
Ned Batchelder, http://nedbatchel
Note: The contents of this dictionary should not be modified;
changes may not affect the values of local and free variables used
by the interpreter.
This is a tradeoff of practicality for purity: the interpreter runs
faster if you don't make locals() a modifiable dict.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
pyiter It's a PyCon talk
all about iteration in Python, aimed at new learners.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
ents. Then find all the tab characters in your file and
replace them with the proper number of spaces.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
Keep that file up-to-date as you add new requirements.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
. Can you tell us
more about your environment?
Many thanks for your assistance.
Kind regards
Pat
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
ial.py#L46
You don't have assert_raises_regexp because your unittest module doesn't
have assertRaisesRegexp. That method is new in 2.7, but you are using
2.6.5, so it doesn't exist.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
es to unpack".
What am I doing wrong?
Thank you.
You want:
for key, value in my_dict.items(): # or .iteritems()
Iterating over a dictionary gives you its keys. items() will give you
key,value pairs.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
ation) are usually defined as methods on the type.
This is not a black/white distinction, I'm sure there are interesting
counter-examples. But this is the general principle.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
On 5/25/14 10:09 PM, Dave Angel wrote:
Ned Batchelder Wrote in message:
On 5/25/14 8:55 AM, Igor Korot wrote:
Hi, ALL,
I have a following data structure:
my_dict[(var1,var2,var3)] = None
my_dict[(var4,var5,var6)] = 'abc'
What I'm trying to do is this:
for (key,value) in my_
.
How did you determine that it was the return that was taking the time?
----
Cheers,
Lakshmipathi.G
FOSS Programmer.
www.giis.co.in
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
illustrious resident unicode expert?
Let's please not have a recounting of other peoples' posts, especially
if they are posts we try to minimize.
--
Ned Batchelder, http://nedbatchelder.com
--
https://mail.python.org/mailman/listinfo/python-list
On 8/8/13 12:17 PM, adam.pre...@gmail.com wrote:
On Thursday, August 8, 2013 3:50:47 AM UTC-5, Peter Otten wrote:
Peter Otten wrote:
Oops, that's an odd class name. Fixing the name clash in Types.__new__() is
left as an exercise...
I will do some experiments with a custom test loader since I w
501 - 600 of 852 matches
Mail list logo