On Apr 14 2012, 2:47 pm I wrote:
Miki Tebeka wrote:
If you have an interesting/common Gotcha (warts/dark corners ...) please
share.
Python 3(K) likes to use the same '.py' file extension as its
incompatible predecessors, and in some/many/most *nix implementations,
it likes to install in
In article 4f7de152$0$29983$c3e8da3$54964...@news.astraweb.com,
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
On Thu, 05 Apr 2012 08:32:10 -0400, Roy Smith wrote:
In article 4f7d896f$0$29983$c3e8da3$54964...@news.astraweb.com,
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info
On Thu, Apr 19, 2012 at 11:11 PM, Albert van der Horst
alb...@spenarnc.xs4all.nl wrote:
I still think the doubling convention of Algol68 is superior:
Help me Obiwan, she said, You're my only hope!
No special treatment of any other symbol than the quote itself.
A quoting symbol is such a
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes:
Running both Python 2 and Python 3 on Windows is painful where it
doesn't need to be.
And how is that different from any other two versions of Python?
1. The backwards incompatibility between 2 and 3 is much more serious
than between
Steven D'Aprano wrote:
And how is that different from any other two versions of Python?
Python 3.0, also known as “Python 3000” or “Py3K”, is the first ever
*intentionally backwards incompatible* Python release. --GVR
Unless both versions include the same libraries (either standard modules
or
On Apr 16, 11:44 am, Bryan bryanjugglercryptograp...@yahoo.com
wrote:
Steven D'Aprano wrote:
And how is that different from any other two versions of Python?
Python 3.0, also known as “Python 3000” or “Py3K”, is the first ever
*intentionally backwards incompatible* Python release. --GVR
rusi rustompm...@gmail.com writes:
Costs can be single-cased (s) -- basically those that can be handled
by a 2to3 module
You can't really 2to3 a large python application and expect to then just
start using it without further attention or testing. You may have to do
a fairly complete (i.e.
On 16/04/2012 06:34, Steven D'Aprano wrote:
The situation is worse on Windows, as Windows doesn't support hash-bang
syntax. But that is being looked at now:
http://www.python.org/dev/peps/pep-0397/
which should make supporting multiple Python versions much more pleasant
Real Soon Now.
No
Steven D'Aprano wrote:
Bryan wrote:
Python 3(K) likes to use the same '.py' file extension as its
incompatible predecessors,
And so it should.
We disagree. Not surprising in a gotcha's thread.
and in some/many/most *nix implementations,
it likes to install in the same place.
I won't
On Sun, Apr 15, 2012 at 7:23 PM, Bryan
bryanjugglercryptograp...@yahoo.com wrote:
Yes, that was just silly of me to write that. All I want is a new
general convention for the most-likely-to-work invocation that won't
break with the change: #!/usr/bin/env python for Python 2 versus,
for
On 15/04/2012 10:23, Bryan wrote:
My perspective is simply different from yours. I'm not the one who
installs python on most of the boxes where I work or play. There's
little consistency, so I love conventions that usually work. I'd like
to advocate for Python 3, but the default install on
On Sun, 15 Apr 2012 02:23:27 -0700, Bryan wrote:
Steven D'Aprano wrote:
Bryan wrote:
Python 3(K) likes to use the same '.py' file extension as its
incompatible predecessors,
And so it should.
We disagree. Not surprising in a gotcha's thread.
Yes, but I have reasons for disagreeing,
On 2012-04-15, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
We disagree. Not surprising in a gotcha's thread.
Yes, but I have reasons for disagreeing, which you trimmed out of your
response. If you have reasons for thinking that a separate file extension
for Python 3 is a
On Sun, 15 Apr 2012 15:30:39 +, Curt wrote:
On 2012-04-15, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info
wrote:
We disagree. Not surprising in a gotcha's thread.
Yes, but I have reasons for disagreeing, which you trimmed out of your
response. If you have reasons for thinking
Steven wrote:
Yes, but I have reasons for disagreeing, which you trimmed out of your
response. If you have reasons for thinking that a separate file extension
for Python 3 is a good idea, you are keeping it to yourself.
On Windows the file extension determines what executable opens the
file.
On 4/15/2012 4:01 PM, Bryan wrote:
On Windows the file extension determines what executable opens the
file. Running both Python 2 and Python 3 on Windows is painful where
it doesn't need to be. I'd like to encourage my users to check out
Python 3, but installing it on Windows will take over the
On 15/04/2012 21:01, Bryan wrote:
Steven wrote:
Yes, but I have reasons for disagreeing, which you trimmed out of your
response. If you have reasons for thinking that a separate file extension
for Python 3 is a good idea, you are keeping it to yourself.
On Windows the file extension
On Sun, Apr 15, 2012 at 4:01 PM, Bryan
bryanjugglercryptograp...@yahoo.com wrote:
On Windows the file extension determines what executable opens the
file. Running both Python 2 and Python 3 on Windows is painful where
it doesn't need to be. I'd like to encourage my users to check out
Python 3,
On 4/15/2012 3:01 PM, Bryan wrote:
I'd like to encourage my users to check out
Python 3, but installing it on Windows will take over the '.py'
extension and break stuff that currently works.
Have you tried telling your users to tell the installer not to do that?
IIRC, it's a simple checkbox
On Sun, 15 Apr 2012 13:01:54 -0700, Bryan wrote:
Steven wrote:
Yes, but I have reasons for disagreeing, which you trimmed out of your
response. If you have reasons for thinking that a separate file
extension for Python 3 is a good idea, you are keeping it to yourself.
On Windows the file
On Apr 16, 3:34 pm, Steven D'Aprano steve
+comp.lang.pyt...@pearwood.info wrote:
The situation is worse on Windows, as Windows doesn't support hash-bang
syntax. But that is being looked at now:
http://www.python.org/dev/peps/pep-0397/
which should make supporting multiple Python versions
Miki Tebeka wrote:
If you have an interesting/common Gotcha (warts/dark corners ...) please
share.
Python 3(K) likes to use the same '.py' file extension as its
incompatible predecessors, and in some/many/most *nix implementations,
it likes to install in the same place. Python 3 is an
On Sun, Apr 15, 2012 at 8:47 AM, Bryan
bryanjugglercryptograp...@yahoo.com wrote:
Python 3(K) likes to use the same '.py' file extension as its
incompatible predecessors, and in some/many/most *nix implementations,
it likes to install in the same place. Python 3 is an improvement upon
Python
On 14/04/2012 23:47, Bryan wrote:
Miki Tebeka wrote:
If you have an interesting/common Gotcha (warts/dark corners ...) please
share.
Python 3(K) likes to use the same '.py' file extension as its
incompatible predecessors, and in some/many/most *nix implementations,
it likes to install in
On Sat, 14 Apr 2012 15:47:54 -0700, Bryan wrote:
Miki Tebeka wrote:
If you have an interesting/common Gotcha (warts/dark corners ...)
please share.
Python 3(K) likes to use the same '.py' file extension as its
incompatible predecessors,
And so it should.
Python 2 and Python 3 are two
On 2012-04-08, John Nagle na...@animats.com wrote:
6. Multiple inheritance is a mess. Especially super.
Python allows you to get dirty. Super solves a messy problem.
10. Python 3 isn't upward compatible with Python 2.
Even minor versions of Python are usually not forward compatible.
In the
Hi Miki,
On 2012-04-05 00:34, Miki Tebeka wrote:
I'm going to give a Python Gotcha's talk at work.
If you have an interesting/common Gotcha (warts/dark corners ...) please
share.
(Note that I want over http://wiki.python.org/moin/PythonWarts already).
I gave a somewhat similar talk
In article jlr2iu$ish$1...@dont-email.me, John Nagle na...@animats.com
wrote:
1. Nobody is really in charge of third party packages. In the
Perl world, there's a central repository, CPAN, and quality
control. Python's pypi is just a collection of links. Many
major packages are maintained
8. Opening a URL can result in an unexpected prompt on
standard input if the URL has authentication. This can
stall servers.
Can you give an example? I don't think anything in the standard library does
that.
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, Apr 9, 2012 at 3:55 AM, Miki Tebeka miki.teb...@gmail.com wrote:
8. Opening a URL can result in an unexpected prompt on
standard input if the URL has authentication. This can
stall servers.
Can you give an example? I don't think anything in the standard library does
that.
I just
On 4/8/2012 10:55 AM, Miki Tebeka wrote:
8. Opening a URL can result in an unexpected prompt on
standard input if the URL has authentication. This can
stall servers.
Can you give an example? I don't think anything in the standard library does
that.
It's in urllib. See
* Grzegorz Staniak wrote:
On 06.04.2012, rusi rustompm...@gmail.com wroted:
There should be one-- and preferably only one --obvious way to do it.
Then again, practicality beats purity.
Yes.
If you ever grepped for, say, the usage of dictionary keys in a bigger
application, you might
Roy Smith r...@panix.com wrote:
There's absolutely no reason why JSON should follow Python syntax rules.
No, but there certainly is a justification for expecting JAVASCRIPT Object
Notation (which is, after all, what JSON stands for) to follow Javascript's
syntax rules. And Javascript happens
On Sun, Apr 8, 2012 at 1:47 PM, Tim Roberts t...@probo.com wrote:
No, but there certainly is a justification for expecting JAVASCRIPT Object
Notation (which is, after all, what JSON stands for) to follow Javascript's
syntax rules. And Javascript happens to follow the same quoting rules as
On 4/4/2012 3:34 PM, Miki Tebeka wrote:
Greetings,
I'm going to give a Python Gotcha's talk at work.
If you have an interesting/common Gotcha (warts/dark corners ...) please
share.
(Note that I want over http://wiki.python.org/moin/PythonWarts already).
Thanks,
--
Miki
A few Python gotchas
On Sun, Apr 8, 2012 at 2:01 PM, John Nagle na...@animats.com wrote:
4. The syntax for expression-IF is just weird.
Agreed. Putting an expression first feels weird; in every high level
language I know of, the word if is followed by the condition, and
then by what to do if true, and then what to
On Sun, Apr 8, 2012 at 2:19 PM, Chris Angelico ros...@gmail.com wrote:
Agreed. Putting an expression first feels weird; in every high level
language I know of, the word if is followed by the condition, and
then by what to do if true, and then what to do if false - not true,
then condition,
On Apr 5, 10:36 pm, rusi rustompm...@gmail.com wrote:
On Apr 6, 9:54 am, Steve Howell showel...@yahoo.com wrote:
JS, YAML, and HTML are pretty similar to Python with respect to single
vs. double, as far as I know/remember/care.
[Complete ignoramus here -- writing after a few minutes of
rusi wrote:
Are there languages (other than python) in which single and double
quotes are equivalent?
Kernighan and Plauger's RATFOR (a pre-processor that added some C-like
syntax to FORTRAN) did that. Published in their book _Software Tools_.
Mel.
--
In article jlmaid$hum$1...@dont-email.me, mwil...@the-wire.com wrote:
rusi wrote:
Are there languages (other than python) in which single and double
quotes are equivalent?
Kernighan and Plauger's RATFOR (a pre-processor that added some C-like
syntax to FORTRAN) did that. Published
Roy Smith wrote:
In article jlmaid$hum$1...@dont-email.me, mwil...@the-wire.com wrote:
rusi wrote:
Are there languages (other than python) in which single and double
quotes are equivalent?
Kernighan and Plauger's RATFOR (a pre-processor that added some C-like
syntax to FORTRAN) did
On Thu, 05 Apr 2012 21:28:01 -0700, rusi wrote:
Are there languages (other than python) in which single and double
quotes are equivalent?
Classic REXX, CSS, JavaScript, Lua, Prolog, XPath, YAML, Modula-2, HTML,
and (of course) English. There may be others.
Other languages like Perl, PHP and
On 06.04.2012, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wroted:
Are there languages (other than python) in which single and double
quotes are equivalent?
Classic REXX, CSS, JavaScript, Lua, Prolog, XPath, YAML, Modula-2, HTML,
and (of course) English. There may be others.
On Apr 6, 6:55 pm, Steven D'Aprano steve
+comp.lang.pyt...@pearwood.info wrote:
On Thu, 05 Apr 2012 21:28:01 -0700, rusi wrote:
Are there languages (other than python) in which single and double
quotes are equivalent?
Classic REXX, CSS, JavaScript, Lua, Prolog, XPath, YAML, Modula-2, HTML,
* Steven D'Aprano wrote:
On Thu, 05 Apr 2012 23:08:11 +0200, André Malo wrote:
* Steven D'Aprano wrote:
For a 21st century programming language or data format to accept only
one type of quotation mark as string delimiter is rather like having a
21st century automobile with a hand crank
On Apr 6, 7:18 pm, Grzegorz Staniak gstan...@gmail.com wrote:
On 06.04.2012, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wroted:
Are there languages (other than python) in which single and double
quotes are equivalent?
Classic REXX, CSS, JavaScript, Lua, Prolog, XPath, YAML,
On Apr 6, 8:40 pm, André Malo ndpar...@gmail.com wrote:
* Steven D'Aprano wrote:
On Thu, 05 Apr 2012 23:08:11 +0200, André Malo wrote:
* Steven D'Aprano wrote:
For a 21st century programming language or data format to accept only
one type of quotation mark as string delimiter is rather
On 06.04.2012, rusi rustompm...@gmail.com wroted:
This is the 21st century, not 1960, and if the language designer is
worried about the trivially small extra effort of parsing ' as well as
then he's almost certainly putting his efforts in the wrong place.
Yes, that's what you said
On Thursday, April 5, 2012 11:28:01 PM UTC-5, rusi wrote:
On Apr 5, 4:06 pm, Duncan Booth duncan.bo...@invalid.invalid wrote:
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
JSON expects double-quote marks, not single:
v = json.loads({'test':'test'}) fails
v =
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
JSON expects double-quote marks, not single:
v = json.loads({'test':'test'}) fails
v = json.loads('{test:test}') succeeds
You mean JSON expects a string with valid JSON?
Quelle surprise.
--
Duncan Booth
On Thu, Apr 5, 2012 at 9:06 PM, Duncan Booth
duncan.booth@invalid.invalid wrote:
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
JSON expects double-quote marks, not single:
v = json.loads({'test':'test'}) fails
v = json.loads('{test:test}') succeeds
You mean JSON
On Thu, 05 Apr 2012 11:06:11 +, Duncan Booth wrote:
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
JSON expects double-quote marks, not single:
v = json.loads({'test':'test'}) fails v =
json.loads('{test:test}') succeeds
You mean JSON expects a string with
In article 4f7d896f$0$29983$c3e8da3$54964...@news.astraweb.com,
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
You mean JSON expects a string with valid JSON? Quelle surprise.
No. The surprise is that there exists a tool invented in the 21st century
that makes a distinction
On Thu, 2012-04-05 at 12:00 +, Steven D'Aprano wrote:
The reason this is a Gotcha rather than a bug is because the JSON
standard specifies the behaviour (probably in order to be compatible with
Javascript).
It's not to be compatible with javascript (you can use either in
javascript)
I
On 4/4/2012 7:32 PM, Chris Angelico wrote:
Don't know if it's what's meant on that page by the += operator,
Yes, it is.
a=([1],)
a[0].append(2) # This is fine
[In the following, I use the term name rather loosely.]
The append() method attempts to modify the object whose name is a[0].
That
On Apr 5, 5:32 am, Roy Smith r...@panix.com wrote:
[...] Nobody expects
that a JSON parser will be parsing human-written input, [...]
Humans write JSON all the time. People use JSON as a configuration
language, and some people actually write JSON files by hand. A common
example would be
On Apr 5, 5:00 am, Steven D'Aprano steve
+comp.lang.pyt...@pearwood.info wrote:
On Thu, 05 Apr 2012 11:06:11 +, Duncan Booth wrote:
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
JSON expects double-quote marks, not single:
v = json.loads({'test':'test'}) fails v =
On 4/5/12 3:15 PM, John Posner wrote:
On 4/4/2012 7:32 PM, Chris Angelico wrote:
Don't know if it's what's meant on that page by the += operator,
Yes, it is.
a=([1],)
a[0].append(2) # This is fine
[In the following, I use the term name rather loosely.]
The append() method attempts to
to give a Python Gotcha's talk at work.
If you have an interesting/common Gotcha (warts/dark corners ...) please
share.
(Note that I want over http://wiki.python.org/moin/PythonWarts already).
Thanks,
--
Miki
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 5, 8:23 am, Iain King iaink...@gmail.com wrote:
A common one used to be expecting .sort() to return, rather than mutate (as
it does). Same with .reverse() - sorted and reversed have this covered, not
sure how common a gotcha it is any more.
The sort()/sorted() variations are good to
In 7367295.815.1333578860181.JavaMail.geo-discussion-forums@ynpp8 Miki Tebeka
miki.teb...@gmail.com writes:
Greetings,
I'm going to give a Python Gotcha's talk at work.
If you have an interesting/common Gotcha (warts/dark corners ...)
please share.
This is fairly pedestrian as gotchas go
On 05.04.2012, Roy Smith r...@panix.com wroted:
There's absolutely no reason why JSON should follow Python syntax
rules. Making it support either kind of quotes would have
complicated every JSON library in the world, for no added value.
I think these days it's not just Python syntax, it's
On Thu, Apr 05, 2012 at 08:32:10AM -0400, Roy Smith wrote:
One of the hardest things about writing parsers is generating helpful
error messages when things don't parse. But, it's only of value to do
that when you're parsing something you expect to be written by a human,
and thus a human
On Fri, Apr 6, 2012 at 2:25 AM, Grzegorz Staniak gstan...@gmail.com wrote:
On 05.04.2012, Roy Smith r...@panix.com wroted:
There's absolutely no reason why JSON should follow Python syntax
rules. Making it support either kind of quotes would have
complicated every JSON library in the world,
Miki Tebeka miki.teb...@gmail.com writes:
[...]
(Note that I want over http://wiki.python.org/moin/PythonWarts already).
The local variable and scoping is, imho, something to be really
careful about. Here is an example:
class A(object):
def __init__(self):
self.x = 0
def
In article jlkh1c$msc$1...@mx1.internetia.pl,
Grzegorz Staniak gstan...@gmail.com wrote:
On 05.04.2012, Roy Smith r...@panix.com wroted:
There's absolutely no reason why JSON should follow Python syntax
rules. Making it support either kind of quotes would have
complicated every JSON
In article jlkg90$ghk$1...@reader1.panix.com,
John Gordon gor...@panix.com wrote:
In 7367295.815.1333578860181.JavaMail.geo-discussion-forums@ynpp8 Miki
Tebeka miki.teb...@gmail.com writes:
Greetings,
I'm going to give a Python Gotcha's talk at work.
If you have an interesting
On Thu, 05 Apr 2012 08:32:10 -0400, Roy Smith wrote:
In article 4f7d896f$0$29983$c3e8da3$54964...@news.astraweb.com,
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
You mean JSON expects a string with valid JSON? Quelle surprise.
No. The surprise is that there exists a tool
On Fri, Apr 6, 2012 at 4:08 AM, Roy Smith r...@panix.com wrote:
If you are working with data that is representable as either an integer
or a string, choose one and stick to it. Treating it as both/either will
eventually lead to grief.
Or, in other words: 1 != '1'
Tell that to the PHP crowd
On Thu, 05 Apr 2012 11:06:11 +, Duncan Booth wrote:
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
JSON expects double-quote marks, not single:
v = json.loads({'test':'test'}) fails v =
json.loads('{test:test}') succeeds
You mean JSON expects a string with
This is not a gotcha, and it's not surprising. As John described,
you're assigning a new value to an index of a tuple, which tuples
don't support.
a[0] += [3]
is the same as
a[0] = a[0] + [3]
which after evaluation is the same as
a[0] = [1, 3]
You can always modify an item that happens to
On Fri, Apr 6, 2012 at 4:44 AM, Michael Hrivnak mhriv...@hrivnak.org wrote:
This is not a gotcha, and it's not surprising. As John described,
you're assigning a new value to an index of a tuple, which tuples
don't support.
a[0] += [3]
is the same as
a[0] = a[0] + [3]
which after
I'm surprised nobody beat me to posting this:
def foo(stuff=[]):
... stuff.append('bar')
... print stuff
...
foo()
['bar']
foo()
['bar', 'bar']
foo()
['bar', 'bar', 'bar']
On Wed, Apr 4, 2012 at 6:34 PM, Miki Tebeka miki.teb...@gmail.com wrote:
Greetings,
I'm going to give a Python
On 4/5/2012 13:24, Chris Angelico wrote:
I think this example highlights a major point about gotchas: the
difference between an obvious language feature and a gotcha depends on
where you come from. To a PHP programmer, 1 and 1 are in many ways
indistinguishable. To a C programmer, they're
On Wednesday, 4 April 2012 23:34:20 UTC+1, Miki Tebeka wrote:
Greetings,
I'm going to give a Python Gotcha's talk at work.
If you have an interesting/common Gotcha (warts/dark corners ...) please
share.
(Note that I want over http://wiki.python.org/moin/PythonWarts already).
Thanks
On Thu, Apr 5, 2012 at 12:52 PM, Michael Hrivnak mhriv...@hrivnak.org wrote:
I'm surprised nobody beat me to posting this:
The OP beat you to it -- it's in the list at the wiki link.
--
http://mail.python.org/mailman/listinfo/python-list
On 4/5/2012 11:10 AM Jon Clements said...
On Wednesday, 4 April 2012 23:34:20 UTC+1, Miki Tebeka wrote:
Greetings,
I'm going to give a Python Gotcha's talk at work.
If you have an interesting/common Gotcha (warts/dark corners ...) please
share.
(Note that I want over http://wiki.python.org
On 5 April 2012 21:06, Emile van Sebille em...@fenx.com wrote:
Kind of begs for a contains method that returns the appropriate boolean:
if text.contains('bob')
It's already there:
text.__contains__('bob')
It's usually spelt otherwise though:
'bob' in text
--
Arnaud
--
On Thu, Apr 5, 2012 at 2:06 PM, Emile van Sebille em...@fenx.com wrote:
On 4/5/2012 11:10 AM Jon Clements said...
On Wednesday, 4 April 2012 23:34:20 UTC+1, Miki Tebeka wrote:
Greetings,
I'm going to give a Python Gotcha's talk at work.
If you have an interesting/common Gotcha (warts/dark
On 05.04.2012, Roy Smith r...@panix.com wroted:
There's absolutely no reason why JSON should follow Python syntax
rules. Making it support either kind of quotes would have
complicated every JSON library in the world, for no added value.
I think these days it's not just Python syntax,
* Steven D'Aprano wrote:
For a 21st century programming language or data format to accept only one
type of quotation mark as string delimiter is rather like having a 21st
century automobile with a hand crank to start the engine instead of an
ignition. Even if there's a good reason for it
In article 4f7de152$0$29983$c3e8da3$54964...@news.astraweb.com,
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
I'm not the only one who has had trouble with JSON's poor design choice:
This is getting a bit off-topic. If you wish to argue that JSON is
designed poorly, you should
On 4/5/2012 13:44, Michael Hrivnak wrote:
This is not a gotcha, and it's not surprising. As John described,
you're assigning a new value to an index of a tuple, which tuples
don't support.
Um, at least for me personally, yes, it is surprising, and yes, it is a
gotcha.
This goes back to what
On 4/5/2012 17:11, Evan Driscoll wrote:
In particular, the translation of 'a+=b' to 'temp = a + b; a = temp' is
*not* a very natural one to me.
To expand on this point slightly, because of common C++ idioms guided by
efficiency, I would be much more likely to think of 'a + b' as 'temp =
a, temp
On Fri, Apr 6, 2012 at 4:10 AM, Jon Clements jon...@googlemail.com wrote:
One I've had to debug...
text = 'abcdef'
if text.find('abc'):
print 'found it!'
# Nothing prints as bool(0) is False
if text.find('bob'):
print 'found it!'
found it!
Someone new who hasn't read the
Now, if you wish to boggle your mind about something pythonic, how about
mutexes not being thread safe (http://bugs.python.org/issue1746071)?
This is and old and deprecated module, you should not use it.
Use http://docs.python.org/library/threading.html#threading.Lock and friends
instead.
On 05Apr2012 19:13, Alain Ketterlin al...@dpt-info.u-strasbg.fr wrote:
| Miki Tebeka miki.teb...@gmail.com writes:
| (Note that I want over http://wiki.python.org/moin/PythonWarts already).
|
| The local variable and scoping is, imho, something to be really
| careful about. Here is an example:
|
On 05Apr2012 23:08, André Malo ndpar...@gmail.com wrote:
| * Steven D'Aprano wrote:
|
| For a 21st century programming language or data format to accept only one
| type of quotation mark as string delimiter is rather like having a 21st
| century automobile with a hand crank to start the engine
On Thu, 05 Apr 2012 23:08:11 +0200, André Malo wrote:
* Steven D'Aprano wrote:
For a 21st century programming language or data format to accept only
one type of quotation mark as string delimiter is rather like having a
21st century automobile with a hand crank to start the engine instead
On Fri, Apr 6, 2012 at 11:03 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
KISS is a reason *for* allowing multiple string delimiters, not against
it. The simplicity which matters here are:
* the user doesn't need to memorise which delimiter is allowed, and
which is
On Apr 5, 6:03 pm, Steven D'Aprano steve
+comp.lang.pyt...@pearwood.info wrote:
On Thu, 05 Apr 2012 23:08:11 +0200, André Malo wrote:
* Steven D'Aprano wrote:
For a 21st century programming language or data format to accept only
one type of quotation mark as string delimiter is rather like
On 04/05/2012 08:02 PM, Cameron Simpson wrote:
On 05Apr2012 19:13, Alain Ketterlin al...@dpt-info.u-strasbg.fr wrote:
| Miki Tebeka miki.teb...@gmail.com writes:
| (Note that I want over http://wiki.python.org/moin/PythonWarts already).
|
| The local variable and scoping is, imho, something
On 4/5/2012 7:36 PM, Miki Tebeka wrote:
Now, if you wish to boggle your mind about something pythonic, how about
mutexes not being thread safe (http://bugs.python.org/issue1746071)?
This is and old and deprecated module, you should not use it.
Use
On 06 Apr 2012 01:03:45 GMT
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
This is the 21st century, not 1960 ...
Now there's a slippery slope, indeed. ;-)
... and if the language designer is worried about the trivially small
extra effort of parsing ' as well as then he's
On Thu, 05 Apr 2012 10:15:03 -0400
John Posner jjpos...@optimum.net wrote:
On 4/4/2012 7:32 PM, Chris Angelico wrote:
Don't know if it's what's meant on that page by the += operator,
Yes, it is.
a=([1],)
a[0].append(2) # This is fine
[In the following, I use the term name rather
On Apr 5, 4:06 pm, Duncan Booth duncan.bo...@invalid.invalid wrote:
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
JSON expects double-quote marks, not single:
v = json.loads({'test':'test'}) fails
v = json.loads('{test:test}') succeeds
You mean JSON expects a
On Fri, Apr 6, 2012 at 2:28 PM, rusi rustompm...@gmail.com wrote:
Are there languages (other than python) in which single and double
quotes are equivalent?
[No I dont claim to know all the languages out there, just that I dont
know any other language which allows single and double quotes to
On Apr 5, 9:28 pm, rusi rustompm...@gmail.com wrote:
On Apr 5, 4:06 pm, Duncan Booth duncan.bo...@invalid.invalid wrote:
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote:
JSON expects double-quote marks, not single:
v = json.loads({'test':'test'}) fails
v =
On Apr 6, 9:54 am, Steve Howell showel...@yahoo.com wrote:
JS, YAML, and HTML are pretty similar to Python with respect to single
vs. double, as far as I know/remember/care.
[Complete ignoramus here -- writing after a few minutes of googling]
YAML:
Greetings,
I'm going to give a Python Gotcha's talk at work.
If you have an interesting/common Gotcha (warts/dark corners ...) please
share.
(Note that I want over http://wiki.python.org/moin/PythonWarts already).
Thanks,
--
Miki
--
http://mail.python.org/mailman/listinfo/python-list
1 - 100 of 106 matches
Mail list logo