made the switch yet. Of course, that will be a big
issue for some time to come for many people.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
providing you an https channel over which to talk to me
securely.
I fault the designers of https for this oversight.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
lookup. Three in the first example, two in the second,
and one in the third.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
/PythonScopesandNameSpaces.html
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
.)
Augmented assignments which don't support in-place operations behave
like normal assignments (binding). For example:
my_int = 0
my_int += 1
behaves like:
my_int = 0
my_int = my_int + 1
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman
writer
in my day job ... oh wait, I forgot ... I got laid off from my day job in
December.) I'll look into what the standard Python doc set says on this
matter.
Doc patches are always welcome, and from what I hear easier to get
accepted than code patches ;)
--
R. David Murray http
, that is avoided by the 'format' method in 3.x.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
occasionally wanted to use instances of object as holders of
arbitrary attributes and wondered why I couldn't (from a language design
perspective). But that was only for testing. In real code I think I'd
always want a fully defined class.
--
R. David Murray http://www.bitdance.com
--
http
write str to binary stream
In 3.x the 'str' type is unicode. If you want to work with binary byte
streams, you want to use the 'bytes' type. Bytes contstants are
written with a leading 'b', so the code snipped above would become
self.out.write(b'BM')
--
R. David Murray http
write_int(out, n):
bytesout=bytes(([n255), (n8)255, (n16)255, (n24)255])
out.write(bytesout)
write_int(out, 125)
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
to the file object.
The thing to keep in mind is that print converts its argument to string
before writing it anywhere (that's the point of using it), and that
bytes (or buffer) and string are very different types in python3.
--
R. David Murray http://www.bitdance.com
--
http
it into a unicode string object.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
in urllib in Python 3.0.
What makes you say that's a bug? Did I miss something? (Which is entirely
possible!)
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
mattia ger...@gmail.com wrote:
Il Tue, 17 Mar 2009 10:55:21 +, R. David Murray ha scritto:
mattia ger...@gmail.com wrote:
Hi all, can you tell me why the module urllib.request (py3) add extra
characters (b'fef\r\n and \r\n0\r\n\r\n') in a simple example like the
following
misunderstanding you, the second one is trivially
expressed as:
immutable = immutable*(immutable+1)
I'm afraid I'm -1 on this proposal even without the issue of the keyword.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
to make a really, _really_ compelling case to get
a new keyword added. Something you can't do any other way, or at
least not without an awful lot of hassle.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
Arg, my apologies, I posted my replies to the wrong group :(
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
Jean-Paul Calderone exar...@divmod.com wrote:
On Tue, 17 Mar 2009 15:17:56 + (UTC), R. David Murray
rdmur...@bitdance.com wrote:
Jean-Paul Calderone exar...@divmod.com wrote:
On Tue, 17 Mar 2009 12:15:23 +0530, Saurabh phoneth...@gmail.com wrote:
This isn't exactly how things work
() doesn't have a sentinel argument. It's iter() which does, and that's in
2.x also.
But it does have a 'default' argument, and you can pass that
a sentinel, so it amounts to the same thing ;)
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
GET_foo(self): pass
def POST_foo(self): pass
It's even one less character of typing (the cr :)
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
better if you include a suggested patch.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
, but probably not a huge number
of them. Certainly not as many as using the parameter as a default.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
. Extending it to handle multiple classes is
left as an exercise for the reader :) As is extending it to handle
stacking the decorators.
--
R. David Murray http://www.bitdance.com
registry = {}
def
an implementation detail.
What use case do you have for wanting to disable it?
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
remember clearly and did not record the reference. Perhaps the person
who posted that info will answer you, or you will be able to figure out
from these clues. Unfortunately I'm not 100% sure it was Webkit.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman
also next methods, can't think of anything else off the top of my head)
What we really need is a 3to2 script. This has been suggested
before and even worked on, but as far as I can see there currently
is no such tool.
--
R. David Murray http://www.bitdance.com
--
http
the parenthesis as well:
test_func(val=('val1',))
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
better be a good reason for it :)
In summary, 'in' is the thing to use if you want to know if your
sample object is _equal to_ any of the objects in the container.
As long as equality is meaningful for the objects involved, there's
no reason to switch to a loop.
--
R. David Murray http
parserFactory
myparser = parserFactory('one')
From your class heavy patterns I am guessing you are coming from
Java or some similar languageyou don't have to work as hard
to get things done in Python.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org
might want to read the docs for the 'read' method, paying particular
attention to the optional argument and its meaning.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
come across.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
. (The difference is re adds a type
token to the front of the key.)
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 20 Mar 2009 at 07:09, Sreejith K wrote:
On Mar 20, 4:43?pm, R. David Murray rdmur...@bitdance.com wrote:
Sreejith K sreejith...@gmail.com wrote:
Hi,
snapdir = './mango.txt_snaps'
snap_cnt = 1
block = 0
import os
os.chdir('/mnt/gfs_local')
snap = open(snapdir + '/snap%s/%s' % (repr
rev_snap_list contains only 0? You didn't log it.
Same for the read. How do you know the read didn't read the whole
file? You didn't log it.
Both your statements might be true, but until you show the logging
output proving it, you don't _know_ that your assumptions are true.
--
R. David Murray
of code, they are individual replacements
for individual lines in two different previous examples, one
of which updates the dict in place and the other of which
creates a new dict.
I think bearophile left out too much context :)
--
R. David Murray http://www.bitdance.com
--
http
print_function'.
So it is probably best to teach print-as-function regardless.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
of the many possible ways to make this work will serve you
best.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
performance issue.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
item will be treated again the next time through the
loop.
As you can see, your case is covered explicitly there.
If you want next(g) to yield 3, you'd have to do something like:
g = (x for x in s[:])
where s[:] makes a copy of s that is then iterated over.
--
R. David Murray
of servers that are still running 2.5 :(
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
in Python by using mutable objects...which is exactly parallel to the
difference between passing mutable or immutable objects in a function
call.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
Gabriel Genellina gagsl-...@yahoo.com.ar wrote:
En Sun, 22 Mar 2009 15:11:37 -0300, R. David Murray
rdmur...@bitdance.com escribió:
Gabriel Genellina gagsl-...@yahoo.com.ar wrote:
En Sat, 21 Mar 2009 23:58:07 -0300, lamber...@corning.com escribió:
class file(io.TextIOWrapper
into
python's interactive namespace. i'd like them too -- how can i do
this?
(note my file does not contain a __name__ == '__main__' clause.)
I'm not familiar with IPython, but perhaps 'from myfile import *'
would do what you want?
--
R. David Murray http://www.bitdance.com
--
http
mattia ger...@gmail.com wrote:
Il Sun, 22 Mar 2009 16:52:02 +, R. David Murray ha scritto:
mattia ger...@gmail.com wrote:
Can you explain me this behaviour:
s = [1,2,3,4,5]
g = (x for x in s)
next(g)
1
s
[1, 2, 3, 4, 5]
del s[0]
s
[2, 3, 4, 5]
next(g)
3
engine instead.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
that the python read must
be failing, yet you still (as far as you have told us) not _proven_
that by logging the value returned from the read. Until you do that,
you can't even be sure where your problem is.
If you have done it, show us the logging output, please.
--
R. David Murray http
(10)
pr()
11
sub(5)
pr()
6
So, as the wikipedia article says, we could, if we wanted to, use python 3
closures to reimplement objects, in a very confusing fashion :)
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
presumes that in the real code that prompted the OP's
question he wasn't just returning 'x'.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
chooses to display them
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
in to.)
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
, but
you haven't put that directory onto the PYTHONPATH.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
. Repeat until success :)
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
_can't_ be shared across multiple projects,
because all that project code would have to be in one monster package,
and not be separate projects at all.
So now you'll know better where it makes Pythonic (as opposed to C++)
sense to use it and where not.
--
R. David Murray http
. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
as appropriate to your actual needs.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
be greatful. (This has to be stdlib only, by the way, I
can't introduce any new modules into the application so pyparsing is
not an option.)
The challenge is to turn a string like this:
a=1,b=0234,)#($)@, k=7
into this:
[(a, 1), (b, 0234,)#($)#), (k, 7)]
--
R. David Murray http
=123456') would
require a slightly smarter parser.
Thank you thank you. I owe you a dinner if we are ever in the
same town (are you at Pycon?).
I'm not going to worry about the internal quotes unless it shows up in
the real data. I'm pretty sure it's now allowed by the spec.
--
R. David
John Machin sjmac...@lexicon.net wrote:
On Mar 27, 6:51 am, R. David Murray rdmur...@bitdance.com wrote:
OK, I've got a little problem that I'd like to ask the assembled minds
for help with. I can write code to parse this, but I'm thinking it may
be possible to do it with regexes. My
Paul McGuire pt...@austin.rr.com wrote:
On Mar 26, 2:51 pm, R. David Murray rdmur...@bitdance.com wrote:
OK, I've got a little problem that I'd like to ask the assembled minds
for help with. I can write code to parse this, but I'm thinking it may
be possible to do it with regexes. My
you could look at generic methods, which provide a way
to do multiple dispatch.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
.
That doesn't look anything like a python traceback. I'm guessing
you are using some sort of web framework? Perhaps you should
try asking in the forum for the framework.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
a '\n' to the end of that string you are writing.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
. Run 'make test' instead of running them one by one. make test
will run them under regrtest, which has mechanisms for detecting tests
that are expected to or may reasonably fail on a given platform. Then if
you still have errors, report back :)
--
R. David Murray
--
http://mail.python.org/mailman
the
make test run? I can run through them quickly for you then, and
then we can focus on the ones that are the real errors.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
, right?
maybe my connection to the server is timing out during the upload?
web server is IIS 6.0.
python is 2.5.2.
IIS webmapping does not use -u b/c nothing works when that option is
used.
What are you using to do the upload? What error message do you get?
--
R. David Murray http
:
dimensions.append(float(s))
except:
dimensions.append(float(quantization[s]))
No, no, no; never use a bare except! :)
Do it MRAB's way and catch ValueError.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 7 Apr 2009 at 09:01, andrew cooke wrote:
R. David Murray wrote:
[...]
try:
dimensions.append(float(s))
except:
dimensions.append(float(quantization[s]))
No, no, no; never use a bare except! :)
can you explain why? i can't think of any reason why the code would
in the 2.5 code since 2.5 is now
in bugfix-release mode only, I think).
2.5 is in security-fix-only mode.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
to find the libtk8.5.so. Everything
else you can ignore, unless you want to try to track them down.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
.
I also remember seeing at least one package announced on
python-announce that referred to genetic algorithms,
so you might check the archives of that mailing list
as well.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
sticking
prints into the tests and things like that.
--
R. David Murray http://www.bitdance.com
PS: 'issue 3111' means issue number 3111 on the Python bug
tracker at http://bugs.python.org.
--
http://mail.python.org/mailman/listinfo/python-list
failures (different failures) when I tried running that test as
root. You might try running it as a regular user, both before
and after the install.
I'll move on with make install.
Thanks for your help; I'm progressing :-)
You are welcome. Glad to be able to help out.
--
R. David Murray
on IRC. (Or probably even earlier on the original
bitnet relay chat.)
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
Murali kumar murali...@gmail.com wrote:
hi all..
please see my attached document..
I think you'll get more help if you post in plain text.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
the escape char sequence I should be using or a work around
for this? Thanks in advanced for your replies.
As far as I can tell what you are getting is invalid XML.
So I think the answer is you can't do that.
(cf: http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-NameChar)
--
R. David Murray
lookup at Python Doc). Can I somehow link the actual Python
source code to iPython so that it can be accessed in that way?
Notice that the filetype is '.so'. That means it is a compiled
C module, so there is no python source to view.
--
R. David Murray http://www.bitdance.com
--
http
the subprocess
module instead, in which case you'd do something like this:
call(['sixa', 'action', 'profile', profile])
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
involved in actually printing the headers if you
need to deal with non-ASCII characters (encoded words) in the headers.
(That's in the docs for the email module, though it took me a bit to
figure out how to do it right.)
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org
as well?
So, no, not in any useful way.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
--
R. David Murray www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list
elegant) which returns the plugin.
In 2.7 and 3.1 there will be:
from importlib import import_module
myname = import_module('somename')
which has much more sensible semantics than __import__ does.
--
R. David Murray http://www.bitdance.com
--
http://mail.python.org/mailman
Gary Herron gher...@islandtraining.com wrote:
MRAB wrote:
Grant Edwards wrote:
On 2009-05-21, Christian Heimes li...@cheimes.de wrote:
seanm...@gmail.com schrieb:
The explaination in my introductory Python book is not very
satisfying, and I am hoping someone can explain the following to
intending to do.
--
R. David Murray http://www.bitdance.com
IT ConsultingSystem AdministrationPython Programming
--
http://mail.python.org/mailman/listinfo/python-list
thing as ssh to my localhost.?
I would suggest using the 'setlog' method of child to get
more debugging information from pexpect. I've found that the
best way to diagnose the source of a timeout.
--
R. David Murray http://www.bitdance.com
IT ConsultingSystem Administration
don't
recall the right guidelines since no one else here seems to have had
the same observation.
Well, I for one looked at that long pylint output when I first tried it,
and switched to another tool :)
(pyflakes...but I don't think it does PEP 8)
--
R. David Murray http
. 1000 small CSV files should fit in a modern computer's
memory with no problem...and if it does become an issue, worry about it
then.
One thought, though: you might want to create a list subclass to hold
your data, so that you can put useful-to-you methods on the subclass...
--
R. David Murray
Chris Rebert c...@rebertia.com wrote:
On Thu, Jun 11, 2009 at 1:41 PM, Stef Mientkistef.mien...@gmail.com wrote:
Peter Otten wrote:
Stef Mientki wrote:
Peter Otten wrote:
Stef Mientki wrote:
I packed all sources with zipfile,
but the compression doesn't seem to be very good.
If
Ben Finney ben+python at benfinney.id.au writes:
(1) assertRaises REALLY needs a better error message. If not a custom
message, at least it should show the result it got instead of an
exception.
+1
Is this one of the many improvements in Python 3.2's ‘unittest’ that
Michael Foord
R. David Murray rdmur...@bitdance.com added the comment:
Thanks for diagnosis and the test patch, and welcome to the bug weekend.
Some comments:
test.support has a symbol, TESTFN, which is guaranteed to be unique for the
test run and located in an appropriate writeable location. Many tests
R. David Murray rdmur...@bitdance.com added the comment:
There are currently no tests in argparse that test the content of error
messages, which is fairly standard for stdlib tests since the error messages
aren't considered part of the API (only the nature of the exception is). So
there's
R. David Murray rdmur...@bitdance.com added the comment:
Just as an FYI, a similar situation exists on Solaris. I had to fix one of the
Python test suite tests once because it was naively trying to rmtree the CWD.
--
nosy: +r.david.murray
R. David Murray rdmur...@bitdance.com added the comment:
unsupported locale setting is a message that comes from the C runtime, IIUC.
Does it work on windows with 2.6?
--
nosy: +lemburg, r.david.murray
___
Python tracker rep...@bugs.python.org
http
Changes by R. David Murray rdmur...@bitdance.com:
--
nosy: +pitrou
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10467
___
___
Python-bugs-list
Changes by R. David Murray rdmur...@bitdance.com:
--
keywords: -easy
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5871
___
___
Python-bugs-list
R. David Murray rdmur...@bitdance.com added the comment:
I've committed this (with the whitespace fix) in r86577. I've made myself a
note to backport it when the maint branches unfreeze.
--
assignee: nnorwitz -
nosy: +r.david.murray
resolution: - fixed
stage: patch review
Changes by R. David Murray rdmur...@bitdance.com:
--
versions: -Python 2.6
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1574217
___
___
Python
Changes by R. David Murray rdmur...@bitdance.com:
--
keywords: -patch
stage: unit test needed - patch review
versions: -Python 2.7
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5800
R. David Murray rdmur...@bitdance.com added the comment:
On the other hand, the test case in test_compileall says test some aspects of
compileall's CLI. Since the patch completely changes the logic of CLI
parsing, having tests that cover as much as practical of the CLI would greatly
increase
1 - 100 of 10507 matches
Mail list logo