On 6/15/2010 9:33 PM, Stephen Hansen wrote:
On 6/15/10 9:16 PM, John Nagle wrote:
Cute, but it doesn't work in general. Faking a module as a
class fails when you simply call
x()
within the module.
Huh? Explain how it doesn't work? I've done it at least twice
(shamef
On 6/15/2010 8:34 PM, Michele Simionato wrote:
On Jun 16, 4:43 am, John Nagle wrote:
Is it possible to override "__setattr__" of a module? I
want to capture changes to global variables for debug purposes.
None of the following seem to have any effect.
modu._
On 6/16/2010 1:10 PM, Ian Kelly wrote:
On Wed, Jun 16, 2010 at 12:55 PM, John Nagle wrote:
Note that there are now two copies of "a", one bound to the module and
referenced in "f", and a second bound to the class, and referenced by
"x.a". Uh oh.
The problem he
on this once I have something people can download and try.
I'm doing a test implementation in Python so people can try the
concept and see if it works in practice. It won't go fast;
it's just to give a feel for what it would be like.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
e as
the client. After all, the server and client don't even have to
be on the same machine.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
eload every time.)
A FCGI/WSGI module for Python is here:
http://svn.saddi.com/py-lib/trunk/fcgi.py
John Nagle
#!/usr/local/bin/python2.6
import fcgi
#
# "Hello World" for FCGI/WSGI
#
def simpleApp(environ, start_response):
status
constructor, we get an "instance". With a constructor,
we get an "object", one which is not an InstanceType.
One might think that testing for types.ObjectType would help. But
no, everything is an ObjectType:
>>> isinstance(1, types.ObjectType)
True
>>> isinstance(None, types.ObjectType)
True
So that's useless.
I have to be missing something obvious here.
(CPython 2.6)
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On 6/22/2010 8:13 PM, Ben Finney wrote:
John Nagle writes:
I want to test whether an object is an instance of any user-defined
class. "isinstance" is less helpful than one would expect.
Right. The type hierarchy is now unified; there's essentially no
difference in later
conditions in existing code,
which is why all these obscure introspection-related questions.)
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
name"
but that doesn't seem to do anything with the stock core.distutils.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
#x27;LongType', 'MemberDescriptorType', 'MethodType',
'ModuleType', 'NoneType','NotImplementedType', 'ObjectType',
'SliceType', 'StringType', 'StringTypes', 'TracebackType', 'TupleType',
.
Yes. Please post your CREATE statements, so we can see your
database schema. If you really have one table per client, you're
doing it wrong.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On 6/23/2010 10:08 PM, Stephen Hansen wrote:
On Jun 23, 2010, at 9:24 PM, John Nagle wrote:
Here's dir(types), in Python 2.6.5:
['BooleanType', 'BufferType', 'BuiltinFunctionType', 'BuiltinMethodType',
'ClassType', 'CodeType
If you send back a content type of "text/plain", your output
will not be rendered as HTML by a browser; it will just be
displayed as plain text.
Try "text/html".
John Nagle
On 6/24/2010 12:19 PM, Thomas Jollans wrote:
On 06/24/20
he code, I
now realize that it would have been better to
add sections to the SQL string with standard escapes, and at the same
time, append the key items to a list. Then the list can be
converted to a tuple for submission to "cursor.execute".
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Having posting problems - ignore
--
http://mail.python.org/mailman/listinfo/python-list
keeps climbing.
This may in time become a Python Enhancement Proposal. We'd like
to get some experience with it first. Try it out and report back.
The SourceForge forum for the project is the best place to report problems.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
keeps climbing.
This may in time become a Python Enhancement Proposal. We'd like
to get some experience with it first. Try it out and report back.
The SourceForge forum for the project is the best place to report problems.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
'm focusing on usability of the approach. It can be made
to go fast; the question is whether it can be made popular.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
thon 2.5. Unladen Swallow targets Python
2.6.1. IronPython targets Python 2.6. C module support for
CPython 3.x is still very spotty. We have a long way to go
before Python 3.x is ready for prime time.
Yes, it's a better language, but it's just not there yet.
In the 1970s, all you could return was
an "int" or a "float". But that got fixed.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
you want, in in the situation you describe, is an optional
callback, to be called in case of a fixable problem. Then the
caller gets control, but without stack unwinding.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
announcement of PERL 6 is coming
up on July 19th, and it still hasn't displaced PERL 5 as the
"primary" version.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
still suffering from that mistake.
But this isn't a Python issue.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Is there a reference manual for "pyparsing"? Not a tutorial. Not a
wiki. Not a set of examples. Not a "getting started guide".
Something that actually documents what each primitive does?
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On 7/1/2010 10:02 PM, Chris Rebert wrote:
On Thu, Jul 1, 2010 at 9:50 PM, John Nagle wrote:
Is there a reference manual for "pyparsing"? Not a tutorial. Not a wiki.
Not a set of examples. Not a "getting started guide".
Something that actually documents what each pr
to
support Python 3.
7. Publicize some success stories.
Unless the Python 3 enthusiasts get their act together and work much
harder on providing an easy transition experience, it's not going to
happen.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On 7/2/2010 3:00 PM, Aahz wrote:
In article<4c2e38f5.10...@animats.com>, John Nagle wrote:
5. Get at least two major hosting services to put up Python 3.
webfaction.com has python3.1
WebFaction's big thing is that they have a really good system for
installing anythi
g to Vex's published package list:
http://www.vex.net/info/tech/pkglist/
They list packages only for Python 2.6.
"vex.net" isn't exactly a major hosting service.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On 7/3/2010 5:46 AM, D'Arcy J.M. Cain wrote:
On Fri, 02 Jul 2010 22:40:34 -0700
John Nagle wrote:
Not according to Vex's published package list:
http://www.vex.net/info/tech/pkglist/
Hold on. That *is* the generated list and Python 3.1 is on it. We
have both 2
le to reach
that level of performance. (Both groups are employed at Google.
So their effectiveness will be compared.)
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On 7/4/2010 1:20 PM, sturlamolden wrote:
On 2 Jul, 21:07, John Nagle wrote:
http://jens.mooseyard.com/2008/12/python-30-whats-the-point/
He is right on. The only thing Python 3k will do for me, is break all
my code and be incompatible with all extension modules I need. "What's
On 7/4/2010 5:34 PM, sturlamolden wrote:
On 5 Jul, 01:58, John Nagle wrote:
Exactly.
The "incompatible with all extension modules I need" part is the
problem right now. A good first step would be to identify the top
5 or 10 modules that are blocking a move to Python 3 by major
pro
i686/egg/_mysql.py",
line 6, in __bootstrap__
ImportError: libmysqlclient_r.so.15:
cannot open shared object file: No such file or directory
Did you install the development libraries for MySQL first?
Those are needed to build MySQLdb yourself.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On 7/4/2010 10:44 PM, Terry Reedy wrote:
On 7/4/2010 7:58 PM, John Nagle wrote:
The "incompatible with all extension modules I need" part
is the problem right now. A good first step would be to
identify the top 5 or 10 modules that are blocking a move to
Python 3 by major projects
en it hit the end of the expression
without satisfying the OneOrMore clause.
Pyparsing does some backup, but I'm not clear on how much,
or how to force it to happen. There's some discussion at
"http://www.mail-archive.com/python-list@python.org/msg169559.html";.
Apparently the "Or" operator will force some backup, but it's not
clear how much lookahead and backtracking is supported.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On 7/5/2010 12:35 PM, Kevin Walzer wrote:
On 7/5/10 2:56 AM, John Nagle wrote:
* PyCrypto
* PyOpenSSL
These, and Mark Pilgrim's feedparser, need to be 3.x compatible before I
can think about Python 3.x.
There's been an attempt to port "feedparser" to 3.0, but
t
On 7/5/2010 3:19 PM, John Nagle wrote:
I'm working on street address parsing again, and I'm trying to deal
with some of the harder cases.
The approach below works for the cases given. The "Or" operator ("^")
supports backtracking, but "Optional()
x27;
sql = "INSERT INTO personaldatakeys VALUES (" + valuesql + ")"
cursor.execute(sql, values) # execute INSERT
"valuefields" is always some number of repeats of comma-separated "%s"
Anything in "values" will be escaped properly. No SQL injection
vulnerability.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
t
plan.
("http://code.google.com/p/unladen-swallow/wiki/ProjectPlan";)
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On 7/8/2010 12:19 PM, Luis M. González wrote:
On Jul 8, 1:42 pm, John Nagle wrote:
How is Unladen Swallow coming along? Looking at the site, code is
being checked in and issues are being reported, but the last quarterly
release was 2009 Q3. They missed their January 2010 release date
n problems because external
data overrode a member name or some crucial data attribute.
If you find yourself having to write code to avoid any of those
problems, like prefixing dynamic attribute names with some symbol to
avoid name clashes (or realize, after reading this, that your cod
hich comes with a tool for
building customized boot images. Basically, you take out
everything except what your application needs.
Do you get Embedded Systems Journal? You should.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
king how many
hits there are can cost almost as much as actually retrieving them.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
ou're listening to is read-only, and you're just
listening, make a cable to feed the serial data into two machines,
and have them both log it. Put them on separate UPSs and in
a place where nobody can knock them over or mess with them.
John Nagle
--
http://
, lambda m: entitydefs[m.group(1)], webpage)
Thanks, very useful, didn't know about the entitydefs dictionary.
You also need to decode the HTML numerical escapes. Expect that
in real-world HTML, out of range values will occasionally appear.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
rolled
by Windows XP. This is a machine that moves around a plasma torch that
cuts thick steel plate. A "New Java update is available" window
popped up while I was working. Not good.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
everything is considered to return some value, even
control structures. LISP is like that. But Python isn't
one of those languages.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
text"? Selected how? "Selected" implies some form
of user interface, like a browser. If you're doing something in
a browser, look into Firefox and Greasemonkey.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
floatref(1.0)
y = x
print(x.val)
x.val = 10.0
print(x.val)
print(y.val)
Are you happy now?
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
OS X. From the
errors, though, I suspect that not all the components involved
are consistent with 32/64 bit width.
John Nagle
On 7/14/2010 10:05 PM, Adam Mercer wrote:
Anyone have any ideas about this?
Cheers
Adam
On Tue, Jul 13, 2010 at 16:18, Adam Mercer
ntranet-Databases-Dummies-Paul-Litwin/dp/0764502212
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On 7/13/2010 4:22 AM, Gregory Ewing wrote:
John Nagle wrote:
Arguably, if a function just does a "return",
it should be an error to try to use its return value.
It's been suggested at least once before that the
default return value for a function should be some
special value
ill memory unnecessarily.
See
"http://groups.google.com/group/comp.lang.python/browse_thread/thread/3f8b999c25af263a";
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
and the performance
isn't any better. Nor is any concurrency provided by "map" or "reduce".
So there's no win in trying to develop cute one-liners.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Did class inheritance from "dict" work in early Python? Or did
that only start working when "new objects" came in?
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
)) % DAYSECS
This is for UT; the adjustment for timezone should be obvious.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
oesn't work on pipes under
Windows.
Since your code isn't doing anything else while waiting for a
write to complete on the pipe, why use non-blocking I/O at all?
(I know, the Python I/O timeout logic is broken in some versions.
You're probably working around that.)
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
ait for input from multiple sources by using "select". (But
be aware that "select" doesn't work for Windows pipes.)
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
et(d1.items()) - set(d2.items()))
print (diff)
{'c': 3, 'b': 2}
That's the true "difference", with all entries in d1 not
identically in d2 listed. Is that what you wanted?
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
es" module, but that's
UNIX-only, or at least it's not in the ActiveState Python distro.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
s, but setting your own object up for "with"
requires adding special methods to the object. "with" is less
convenient and more limited than RAII, but that's the direction
Python is going. This may be in preparation for a move to a real
garbage collector.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On 7/26/2010 4:19 PM, Justin Smith wrote:
Seeking industry expert candidates
I’m Justin Smith, Director of Tech Recruiting at Express Seattle. I
am currently seeking candidates to fill Tech Positions for multiple A-
List Clients:
Spammer detected.
Injection-Info: r27g2000yqb.googlegroup
locking actually takes place via
messages over pipes. There's no dynamic allocation in the shared area.
Realistically, if you're using Python, you're not that concerned
about compute speed. So don't bother with shared memory, which is
a performance optimization.
tps://adds.aviationweather.gov/data/satellite/latest_BWI_vis.jpg
The aviationweather.gov site will accept a HTTPS request.
Maybe that will bypass whatever lame web proxy is in the way.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
file.
for rawline in input :
unicodeline = unicode(line,'latin1')# Latin-1 to Unicode
output.write(unicodeline.encode('utf-8')) # Unicode to as UTF-8
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
t, this means "you get to
talk securely with your attacker." As long as the site or proxy
has some valid SSL cert, any valid SSL cert copied from anywhere,
the new Python SSL module will tell you everything is just fine.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
thon implementations. The implications for multiple
inheritance are difficult. It's really a hack for CPython.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On 7/28/2010 10:23 PM, geremy condra wrote:
On Wed, Jul 28, 2010 at 10:08 PM, John Nagle wrote:
On 7/28/2010 6:26 PM, geremy condra wrote:
On Wed, Jul 28, 2010 at 4:41 PM, Jeffrey
Gaynorwrote:
The new Python SSL module in 2.6 and later has a huge built-in
security hole - it doesn
opriately-sized tasks to send out
to another process are things like "parse large web page" or
"compress video file", not "access element of array".
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
ack of where each
Unicode character begins. So it's not a suitable format for
data being actively worked on in memory; it can't be easily indexed.
That's why it's necessary to convert to UTF-8 before writing
to a file or socket.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
ght expect. There are some C libraries for handling large
arrays if you really need to crunch numbers.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
ruction. It's rarely used on "live"
objects.
For the above cases, a mechanism for constructing general objects
would do the job. Something like
attrdict = { 'a' : 1, 'b' : 2 }
obj = make_object('classname', attrdict)
There are clearly use c
the function. That has to be supported.
Shed Skin might do it, but it restricts the language and
doesn't allow the full dynamism of Python.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
;>> " HELLO THERE ".split()
['HELLO', 'THERE']
If I try to get the functionality of string split with re:
>>> s2 = " HELLO THERE "
>>> kresplit4 = re.compile(r'\W+', re.UNICODE)
>>> kresplit4.split(s2)
[
On 8/2/2010 11:02 AM, MRAB wrote:
John Nagle wrote:
The regular expression "split" behaves slightly differently than
string split:
occurrences of pattern", which is not too helpful.
It's the plain str.split() which is unusual in that:
1. it splits on sequences of white
On 8/2/2010 12:52 PM, Thomas Jollans wrote:
On 08/02/2010 09:41 PM, John Nagle wrote:
On 8/2/2010 11:02 AM, MRAB wrote:
John Nagle wrote:
The regular expression "split" behaves slightly differently than
string split:
occurrences of pattern", which is not too helpful.
On 8/2/2010 5:53 PM, samwyse wrote:
On Aug 2, 12:34 pm, John Nagle wrote:
The regular expression "split" behaves slightly differently than string
split:
I'm going to argue that it's the string split that's behaving oddly.
I tend to agree.
It doesn't
her C compiler on the same box, the
odds are pretty good they'll interoperate without any problems.
Not for Python. Extensions have to be built with essentially the
same version of the same C compiler used for building Python. This
is a major headache.
one into Python.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
ist. Hence the "reduce" and lambda to get rid of them.
Any better ideas?
(Yes, I know there's a built-in feature for this scheduled for
Python 2.7.)
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
value like
100 ; DELETE FROM visitors; SELECT * FROM visitors
you just lost your data.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
rather
than arrays of arrays, tend to use 1-based subscripts. That
reflects standard practice in mathematics.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
ce the message; probably a URL in Unicode.
This looks like code that will do the wrong thing in
Python 2.6 for characters in the range 128-255. Those are
illegal in type "str", but this code is constructing such
values with "chr".
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
some level of quality
control, PyPi is just a link farm.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
? I'm converting some
old Perl code.
Even the Python FTP module doesn't have a directory parser.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Somewhat to my surprise, in Python 2.6,
with urllib2.urlopen(url) as fh :
doesn't work. It fails with
"AttributeError: addinfourl instance has no attribute '__exit__'".
I thought that all the file-like objects supported "with" in 2.6.
No?
om access, and tries to do "seek" and "tell".
Nor is the output descriptor from gzip general; it fails
on "readline", but accepts "read". (No good reason
for that.) So I had to make a second copy.
e, reasonably enough,
needs random access, and tries to do "seek" and "tell".
Nor is the output descriptor from gzip general; it fails
on "readline", but accepts "read". (No good reason
for that.) So I had to make a second copy.
't know how big it is.
The syntax should have been something like
int read(int fd, &char[n] buf, size_t n);
This says the type of the argument is an array of char of
length n, and it's being passed by reference. "read"
then knows how big "buf" is.
This desig
Fix "func". That's terrible Python. No standard Python library
module calls system exit to handle an error. So that must be in
your code. Standard procedure for errors is to raise an
exception.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
demonstrate. There's a big win in the simple optimization
of identifying "non-keep" parameters, especially in mathematical work
where they're very common. It's not clear that getting fancier than
that is a win.
Does Shed Skin have this optimization? It should.
On 8/18/2010 11:24 AM, ernest wrote:
Hi,
In this code:
if set(a).union(b) == set(a): pass
Does Python compute set(a) twice?
CPython does. Shed Skin might optimize. Don't know
about Iron Python.
John Nagle
--
http://mail.python.org/ma
ster, and it bulks up the program
by 2x or so.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
quotedstr = sqlstring % map(MySQLdb.escape_string, values)
cursor.execute(quotedstr)
It just applies "MySQLdb.escape_string to each arg.
If PHP did that, we'd have far fewer "SQL injection attacks".
Most programs shouldn't use "MySQLdb.escape", and should let
the built-in call do it. It's useful, though, if you're constructing
a data file for LOAD DATA to do a bulk database load. The
same escaping works for LOAD DATA INFILE with the default
input format.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
dall(esckey, target)) # find all key and count
print('%s is %d times in the target string' %(key,cnt))
>>> countSubStringMatch("atgacatgcacaagtatgcat","ca")
ca is 4 times in the target string
Enjoy.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On 8/18/2010 3:12 PM, Thomas Jollans wrote:
On Wednesday 18 August 2010, it occurred to John Nagle to exclaim:
On 8/18/2010 11:24 AM, ernest wrote:
Hi,
In this code:
if set(a).union(b) == set(a): pass
Does Python compute set(a) twice?
CPython does. Shed Skin might optimize. Don
. That's a real-life use case
for such a construct, and led to much shorter code than
a non-recursive implementation.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On 8/20/2010 8:41 AM, Aahz wrote:
In article<4c5eef7f$0$1609$742ec...@news.sonic.net>,
John Nagle wrote:
This looks like code that will do the wrong thing in
Python 2.6 for characters in the range 128-255. Those are
illegal in type "str", but this code is constructing
saving your script in? Very few of the text
editors I've used save to UTF-16 by default.
Most editors that will do Unicode save files as "utf-8".
Try that.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
1001 - 1100 of 1270 matches
Mail list logo