On Mon, 22 Aug 2011 20:38:30 +0200
Peter Otten <__pete...@web.de> wrote:
> John O'Hagan wrote:
>
> > On Mon, 22 Aug 2011 11:32:18 +0200
> > Peter Otten <__pete...@web.de> wrote:
> >
> >> John O'Hagan wrote:
> >>
> >>
On Tue, 23 Aug 2011 17:25:22 +1000
Steven D'Aprano wrote:
> On Mon, 22 Aug 2011 11:08 pm John O'Hagan wrote:
>
> > On Mon, 22 Aug 2011 15:27:36 +1000
> > Steven D'Aprano wrote:
> [...]
> >> # Untested
> >> class MySeq(object):
&
you explain how it works?
> Thanks for you help.
> Vince
When a function calls itself, as fib() does, it's called recursion.
http://en.wikipedia.org/wiki/Recursion_(computer_science)
Basically the fib() method keeps calling itself with smaller and smaller
arguments until it gets 1 or 0.
; Could some one explain it for me? I can't understand how it works.
Reposting the exact same question doesn't help us answer it. Perhaps you
could explain why the previous responses weren't helpful.
--
John Gordon A is for Amy, who fell down the stairs
go
> "We must constantly strive to remove multiplicity from our systems;
> lest it consumes us!"
>
> s/multiplicity/rantingrick/ and I'm in full agreement.
QFT
--
http://mail.python.org/mailman/listinfo/python-list
Hi pythons.
following is my code
# -*- coding: utf8 -*-
import urllib2
import urllib
url = "http://a.shanting.mobi/百家讲坛/大国医/list";
print url
p1=u"百家讲坛".encode('utf8')
p2=u"大国医".encode('utf8')
encodeurl = "http://a.shanting.mobi/"+p1+"/"+p2+"/"+"list";
print encodeurl
mp3file = urllib2.urlopen(en
I'm writing a module that needs to fetch user details from an LDAP
server, it might be worthwhile to put all of the LDAP-specific code in
its own method, even if it's only used once. That way the main module
can just contain a line like this:
user_info = get_ldap_results("cn=john gord
, value):
> print("setting %s to %s" % (key, repr(value)))
> if key in ([]):
> self.legs.append(key)
> super(Centipede, self).__setattr__(self, key,value)
How will this if statement ever be true? You're checking if 'key
return n
funcs.append(f)
which seems obscure, and a side-effect.
My question is, is this an inescapable consequence of using closures, or is it
by design, and if so, what are some examples of where this would be the
preferred behaviour?
Regards,
John
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 28 Aug 2011 00:19:07 -0400
Terry Reedy wrote:
> On 8/27/2011 11:45 PM, John O'Hagan wrote:
> > Somewhat apropos of the recent "function principle" thread, I was recently
> > surprised by this:
> >
> > funcs=[]
> > for n in r
wouldn't be able to access
instance variable x and it wouldn't be able to call say_hello().
If you have a method that doesn't need to access other variables or
methods within the class, you can declare it with the @staticmethod
decorator.
--
John Gordon A is for
class P():
pass
class C(P):
pass
Can I get P from C?
IOW, can I get a reference to the object P from the object C? This should be
obvious one way or the other, but I haven't been able to find the answer.
Regards,
John
--
http://mail.python.org/mailman/listinfo/python-list
Would Django be a good framework to use if i wanted to take directories of
LDAP and make a list of users on a website? I have seen it done in php, but
what about trying to manage this with django?
--
http://mail.python.org/mailman/listinfo/python-list
ge.
How would a method access instance variables without 'self'?
They probably could have made 'self' a magical attribute that just
appears out of thin air instead of being passed as an argument, like
'this' in C++. But would that really provide any benefit?
--
27;s also possible
to get UnicodeError from URL operations.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
compiler could determine whether a function was
an instance or class method. If it then marked the code object
appropriately you could get rid of all of the wrappers and the
attendant run-time overhead.
I've never published the analysis because that train has already left
the shed. The earliest
On Sep 1, 8:26 am, Ian Kelly wrote:
> On Thu, Sep 1, 2011 at 6:45 AM, John Roth wrote:
> > I personally consider this to be a wart. Some time ago I did an
> > implementation analysis. The gist is that, if self and cls were made
> > special variables that returned the curre
On Sep 2, 2:30 pm, Ian Kelly wrote:
> On Fri, Sep 2, 2011 at 11:51 AM, John Roth wrote:
> >> I don't see how you could get rid of the wrappers. Methods would
> >> still need to be bound, somehow, so that code like this will work:
>
> >> methods
With the latest flaps about phony cert issuers, it's worth
having issuer info available. It was available in the old M2Crypto
module, but not in the current Python SSL module.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
>>>>> Jon Redgrave writes:
> It seems unreasonably hard to write simple one-line unix command line
> filters in python:
> eg: ls | python -c " print x.upper()"
[...]
> Is there a better solution - if not is this worth a PEP?
Have you looked at PyP
In <2a4f542c-a8c1-46c7-9899-a3fad0940...@x11g2000yqc.googlegroups.com> bclark76
writes:
> mypackage
> __init__.py
> myfunc.py
> MyClass.py
> from mypackage import MyClass
Try this instead:
from mypackage.MyClass import MyClass
--
John Gordon
On Feb 23, 7:47 pm, "Frank Millman" wrote:
> Hi all
>
> I don't know if this counts as a bug in 2to3.py, but when I ran it on my
> program directory it crashed, with a traceback but without any indication of
> which file caused the problem.
>
[traceback snipped]
> UnicodeDecodeError: 'utf8' codec
On Feb 23, 9:11 pm, monkeys paw wrote:
> if I have a string such as '01/12/2011' and i want
> to reformat it as '20110112', how do i pull out the components
> of the string and reformat them into a DDMM format?
>
> I have:
>
> import re
>
> test = re.compile('\d\d\/')
> f = open('test.html')
On Feb 25, 12:00 am, Peter Otten <__pete...@web.de> wrote:
> John Machin wrote:
> > Your Python 2.x code should be TESTED before you poke 2to3 at it. In
> > this case just trying to run or import the offending code file would
> > have given an informative syntax error
On Feb 25, 4:39 am, Terry Reedy wrote:
> Note: an as yet undocumented feature of bytes (at least in Py3) is that
> bytes(count) == bytes()*count == b'\x00'*count.
Python 3.1.3 docs for bytes() say same constructor args as for
bytearray(); this says about the source parameter: """If it is an
integ
t's not being used
heavily yet, and users are reporting bugs like "broken pipe"
errors.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On Mar 5, 6:53 am, JT wrote:
> Yo,
>
> So I have almost convinced a small program to do what I want it to
> do. One thing remains (at least, one thing I know of at the moment):
> I am converting xml to some other format, and there are strings in the
> xml like this.
>
> The python:
>
> elif v ==
ou meant by "real-time".
--
John Gordon A is for Amy, who fell down the stairs
gor...@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
--
http://mail.python.org/mailman/listinfo/python-list
ent environments do I need to use?
You might try learning Tkinter; it is python's standard GUI interface
package.
--
John Gordon A is for Amy, who fell down the stairs
gor...@panix.com B is for Basil, assaulted by bears
--
On Mar 5, 8:57 am, JT wrote:
> On Mar 4, 9:30 pm, John Machin wrote:
>
> > Your data has been FUABARred (the first A being for Almost) -- the
> > "\u3c00" and "\u3e00" were once "<" and ">" respectively. You will
>
> Hi John
or CR, both of which
are the same in ASCII and UTF-8. Copy the bytes
forward from that point into an array of bytes, then
apply the appropriate codec.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
yway? You can use a tuple as a subscript:
d[1,'abc',40] = 'dummy'
Also, at some point, it's time to use a database.
If you find yourself writing those "dictionaries" to
files, or trying to look up everything with "abc"
in the second subscript,
ng, hoisting
out of loops, compile time arithmetic, unboxing, etc. Ordinarily,
Python compilers have to assume that any variable can be changed
at any time from another thread, requiring worst-case code for
everything.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
ither inefficient, with a lookup for every
use (CPython) or really, really complicated, involving just-in-time
compilers, invalidation, recompilation, and a backup interpreter
for when things get ugly (PyPy).
John Nagle
--
http://mail.python.org/mailman/listinfo/p
o edit
the code it
produces - if you need to extend ui designs, you do this by sub-
classing.
> On a side note, you should check out pygui[0]- very, very nice GUI toolkit.
Yay, looks good. Thanks, Greg.
John
--
--
http://mail.python.org/mailman/listinfo/python-list
either its title
Title: TinEye, author: http://ideeinc.com/
Search: http://www.tineye.com/
Example:
http://www.tineye.com/search/2b3305135fa4c59311ed58b41da5d07f213e4d47/
Notice how it finds modified images.
--
John Bokma j3b
Blo
n00m writes:
> On Mar 6, 10:17 pm, n00m wrote:
>> On Mar 6, 8:55 pm, John Bokma wrote:
>>
>>
>>
>> > n00m writes:
>> > >http://www.nga.gov/search/index.shtm
>> > >http://deyoung.famsf.org/search-collections
>> > &g
#x27;s Usenet, something I've been using for, oh, just over 20
years now, and even then it was not new. You know, before the web thing
you're talking about...
--
John Bokma j3b
Blog: http://johnbokma.com/Facebook: http
t;Streaming" out to a network connection while still reading from
the database is undesirable.
If you're doing really big SELECTs, consider using LIMIT and
OFFSET in SQL to break them up into smaller bites. Especially
if the user is paging through the results.
the way that
Python works. Literals are handled during compilation; the built-in
types are run-time objects.
Python is not a language where a script can change compile-time
behavior. Doing that would make it a very different language, and
would put it into a very different niche in the language ecology
variables. You
need
class Node:
def __init__(self) :
self.distFromSource = infinity
self.previous = invalid_node
self.visited = False
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
CPython barely evaluates anything at compile time.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
e owner of those files. You need to say what
goes into a build of a game, or a revision of a manufactured
product.
You also need really good tools to show the differences
between revisions.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
ays to do that,
both on the same machine and across a network.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
and record their answer
--
John Gordon A is for Amy, who fell down the stairs
gor...@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
--
http://mail.python.org/mailman/listinfo/python-list
r
>
> Obviously Tkinter is not imported since I'm using pyqt, so can anyone
> point me out what I'm doing wrong?
> Thanks in advance!
PyQt doesn't use Tkinter, but matplotlib does!
-John
--
http://mail.python.org/mailman/listinfo/python-list
4 1250 1125
1-1 1 5 1000 1000
grand total chars 23024400
The two loops do not produce the same numbers of characters, so I'm not
surprised they do not consume the same amount of
different, but surely that won't
always be the case with real data.
--
John Gordon A is for Amy, who fell down the stairs
gor...@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
rt is for making the
> program understandable and printing understandable error messages.
I see. You're storing integer equivalents for the labels themselves,
not the actual data associated with the labels.
Then Mel's solution is a good one -- construct a second dict which
has the k
In <8uh0rcfe1...@mid.individual.net> Neil Cerutti writes:
> RIIght. What's a cubit?
How long can you tread water?
--
John Gordon A is for Amy, who fell down the stairs
gor...@panix.com B is for Basil, assa
software emulator for an x86 machine running DOS.
So you can go into the emulator and connect to the "keyboard" or
"screen" from another program.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
"re.compile", not when .pyc files are generated.
You can call "re.compile" on strings read from an external
source without loading a new module.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
, how can I write a regex that matches what I wish to match, as
described above?
Many thanks,
John
--
http://mail.python.org/mailman/listinfo/python-list
John Harrington writes:
> I'm trying to use the following substitution,
>
> lineList[i]=re.sub(r'(\\begin{document})([^$])',r'\1\n\n
> \2',lineList[i])
>
> I intend this to match any string "\begin{document}" that doesn't end
>
On Mar 22, 11:16 am, John Bokma wrote:
> John Harrington writes:
> > I'm trying to use the following substitution,
>
> > lineList[i]=re.sub(r'(\\begin{document})([^$])',r'\1\n\n
> > \2',lineList[i])
>
> > I intend this to match an
On Mar 22, 12:07 pm, Benjamin Kaplan wrote:
> On Tue, Mar 22, 2011 at 2:40 PM, John Harrington
>
>
>
> wrote:
> > On Mar 22, 11:16 am, John Bokma wrote:
> >> John Harrington writes:
> >> > I'm trying to use the following substitution,
>
On Mar 5, 9:44 pm, John Nagle wrote:
> All functions in Python can be replaced dynamically. While they're
> running. From another thread. Really.
Indeed, and I find this feature VERY useful when coding. Two places
I've used it are:
1) in GUI coding (say, when I have a
an
use Python2 for scripts that require 2.7, and Python3 for scripts that
require 3.2, and they'll eventually be portable to other systems.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
On 3/23/2011 5:14 AM, David Feyo wrote:
I'm trying to automate reverse-ip lookups on domaintools.com.
Sign up for their API. They charge the same as for
web lookups.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
> To me all this does not look professional for somebody who want to
> attract students / instructors
I'm a big fan of the Menu containing a (useless) link to First Menu
Item
--
http://mail.python.org/mailman/listinfo/python-list
roval process, and can be downloaded and installed
in a standard way.
"easy_install" generally isn't easy. It has some built-in
assumptions about where things are stored, assumptions which
often don't hold true.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
much better. (However, I'm not sure it will do what
you were expecting with the tilde in the file path.)
--
John Gordon A is for Amy, who fell down the stairs
gor...@panix.com B is for Basil, assaulted by bears
-- Edward Gor
e a file named
"typescript" containing all of the input and output which occurred.
--
John Gordon A is for Amy, who fell down the stairs
gor...@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
--
http://mail.python.org/mailman/listinfo/python-list
Simple question. I use these functions much more frequently than many
others which are included in __builtins__. I don't know if my
programming needs are atypical, but my experience has led me to wonder
why I have to import these functions.
--
http://mail.python.org/mailman/listinfo/python-list
On Mar 28, 2:25 am, Andrea Crotti wrote:
> John Ladasky writes:
> I almost never use them either, maybe also in many cases you could avoid
> using them...
> When for example you use them?
To take one example: neural network programming. I construct a
network object (which is q
Hi All,
I'm trying to figure out a problem in which I have a file named scores.txt
that contains the following information.
Jane Doe,87,92,97,33
John Doe,78,91,84,25
Bill Gates,91,88,89,56
Bruce Perens,88,92,84,99
I'm wanting to read the file and create two lists: names and score
Ethan,
Thanks for pointing that out. I commented that code out and then ran it.
It created the list of names. Now, I just need to figure out how to get the
scores into the list called scores.
It would appear that this is done with a nested for loop.
Thanks,
John
On 3/28/11 12:02 PM
Dear all,
This is the solution that I came up with to deal with handling the file of
scores.
Thank you all for your feedback!
John
# define calc average function
def calcAve(mylist):
total = 0
count = 0
for i in range (0, len(mylist)):
# count scores for even number items in
u're using. If you're stil
stuck, give us the list of non-Python modules you're importing,
directly or indirectly.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
#x27;s out there.
Is there a way to get that info portably?
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
stems. PEP 397 is a first cut at doing the same thing for Windows.
Regards,
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
tall,
use the post method with the right data and the right URL.
--
John Bokma j3b
Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl & Python Development: http://castleamber.com/
--
http://mail.python.org/mailman/listinfo/python-list
Chris Angelico writes:
> On Fri, Apr 1, 2011 at 8:57 AM, geremy condra wrote:
>> I know it's tongue-in-cheek, but please, please, please don't do this.
>
> It would be more secure to base64 it and then rot13 the output.
Rot-13 twice, to make it even more se
t) = errorentry # try to unpack
except ValueError as message : # unpack failed
raise(ValueError("%s: bogus entry in 'errors': %s" %
(message, repr(errorentry
...
John Nagl
xternal devices
in Python is useful.)
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
gt; 3.
But if you had any idea what you were talking about, you already knew
that.
--
John Bokma j3b
Blog: http://johnbokma.com/Facebook: http://www.facebook.com/j.j.j.bokma
Freelance Perl & Python Development: http:/
(See "http://www.dokidoki6.com/00_index1.html";. Caution,
excessively cute.) Each ideograph is a "word", of course.
Parse this into words:
★12/25/2009★
6%DOKIDOKI VISUAL FILE vol.4を公開しました。
アルバムの上部で再生操作、下部でサムネイルがご覧いただけます。
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
onfiguration.
Now freeze the code." At that moment, all the global
analysis and compiling takes place. This allows getting rid
of the GIL and getting real performance out of multithread
CPUs.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
th the hardware tagging helping with dispatch. But it probably
wouldn't help all that much. It didn't in the LISP machines.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
PU with a separate return
point stack with a depth of 20. Big mistake.
(All of this is irrelevant to Python, though. Most of Python's
speed problems come from spending too much time looking up attributes
and functions in dictionaries.)
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On 4/4/2011 12:47 AM, Gregory Ewing wrote:
John Nagle wrote:
A tagged machine might make Python faster. You could have
unboxed ints and floats, yet still allow values of other types,
with the hardware tagging helping with dispatch. But it probably
wouldn't help all that much. It didn
Hi folks,
I'm developing some custom neural network code. I'm using Python 2.6,
Numpy 1.5, and Ubuntu Linux 10.10. I have an AMD 1090T six-core CPU,
and I want to take full advantage of it. I love to hear my CPU fan
running, and watch my results come back faster.
When I'm training a neural net
Hi Philip,
Thanks for the reply.
On Apr 4, 4:34 pm, Philip Semanchuk wrote:
> So if you're going to use multiprocessing, you're going to use pickle, and you
> need pickleable objects.
OK, that's good to know.
> > Pickling is still a pretty
> > vague progress to me, but I can see that you have
e out of
the hundred-odd Unicode character sets is going to be foreign,) and
generally internationalized data processing.
Well, actually Unicode support went in back around Python 2.4.
In 3.x, ASCII strings went away, but that was more of a removal.
John
Hello again, Philip,
I really appreciate you sticking with me. Hopefully this will help
someone else, too. I've done some more reading, and will offer some
minimal code below.
I've known about this page for a while, and it describes some of the
unconventional things one needs to consider when s
Hi EveryBody This Program To Hack Sky Pe Account
Just Paste A Email For Sky Pe And Click (Get Pass) Yeah Its True Try
It Its Free From Here
http://www.4shared.com/file/wFtoiI7z/Promar_Hack_Skype_21.html
Download Now
--
http://mail.python.org/mailman/listinfo/python-list
Following up to my own post...
On Apr 6, 11:40 pm, John Ladasky wrote:
> What's up with that?
Apparently, "what's up" is that I will need to implement a third
method in my ndarray subclass -- namely, __reduce__.
http://www.mail-archive.com/numpy-discussion@scipy.org/ms
IOError("of network or news source failure")
is raised.
Looking in feedeparser.py, "parse" calls "_open_resource",
which, after much fooling around, builds a urllib2 request,
builds an "opener" via urllib2, and calls its "open" method.
So I'm not see
On Apr 7, 10:44 am, Robert Kern wrote:
> On 4/7/11 1:40 AM, John Ladasky wrote:
>
> > On Apr 5, 10:43 am, Philip Semanchuk wrote:
> >> And as Robert Kern pointed out, numpy arrays are also pickle-able.
>
> > OK, but SUBCLASSES of numpy.ndarray are not, in my hands,
Hi all,
Long time reader, first time poster.
I am wondering if anything can be done about the COW (copy-on-write)
problem when forking a python process. I have found several
discussions of this problem, but I have seen no proposed solutions or
workarounds. My understanding of the problem is that
On Apr 7, 6:10 pm, sturlamolden wrote:
> On 8 apr, 02:38, sturlamolden wrote:
>
> > I should probably fix it for 64-bit now. Just recompiliong with 64-bit
> > integers will not work, because I intentionally hardcoded the higher
> > 32 bits to 0.
>
> That was easy, 64-bit support for Windows is do
On Apr 9, 10:15 am, sturlamolden wrote:
> On 9 apr, 09:36, John Ladasky wrote:
>
> > Thanks for finding my discussion! Yes, it's about passing numpy
> > arrays to multiple processors. I'll accomplish that any way that I
> > can.
>
> My preferred ways
Actually this is all it takes:
import keywords
print keywords.kwlist
--jac
On Sat, Apr 9, 2011 at 8:57 PM, Chris Angelico wrote:
> On Sun, Apr 10, 2011 at 11:28 AM, candide wrote:
>> Python is very good at introspection, so I was wondering if Python (2.7)
>> provides any feature to retrieve the
ork" (if you're on a *nix machine).
See http://pythonwise.blogspot.com/2009/04/pmap.html for example ;)
Unless you have a performance problem, don't bother with shared
memory.
If you have a performance problem, Python is probably the wrong
tool for the job anyway.
On 4/10/2011 3:29 PM, sturlamolden wrote:
On 10 apr, 18:27, John Nagle wrote:
Unless you have a performance problem, don't bother with shared
memory.
If you have a performance problem, Python is probably the wrong
tool for the job anyway.
Then why does Python h
either end restarting, and the other end failing
to respond. All those things happen frequently with serial
ports.
What do you want to do?
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
ne argument which is the name of the file to be written."
--
John Gordon A is for Amy, who fell down the stairs
gor...@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
--
http://mail.python.org/mailman/listinfo/python-list
uldn't want a returnif in a loop. Following on with this
idea, loop control would be more of a breakif or continueif statement.
John Roth
--
http://mail.python.org/mailman/listinfo/python-list
There's a postmortem on the failure of Unladen Swallow by one of the
developers at:
http://qinsb.blogspot.com/2011/03/unladen-swallow-retrospective.html
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
I may regret wading into a flame-war, but...
I got started with Python in 2002. I took one look at TKinter, said
"yuck!", and went searching for something else. Now, wxPython is a
bit clunky for a Python programmer because of its strong ties to C++
-- but that's what I chose, and it has served m
601 - 700 of 9356 matches
Mail list logo