nd when it guessed
wrong, you were stuck.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
But it really matters in languages where you can.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Debian's Python policy.
http://www.debian.org/doc/packaging-manuals/python-policy/ch-python.html
at "Interpreter Name". They've addressed this. Consistency would be
appreciated. Thank you.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
ten by
Javascript programmers. (In Javascript, an object and a dictionary
are the same thing. In Python, they're not.) In new code, it's
better to inherit from "dict". It eliminates the special cases.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
ncier "distutils" or "eggs", I'd suggest developing
tools that take in "setup.py" files and make Windows installers,
RPMs, or whatever the platform likes.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
ming work files, marked them as in use, dialed up
the credit card processing system, did the transaction, and
wrote a response file. All the process coordination was
through files.
That was 1995 technology, before the banking system had
direct Internet connections.
the CSV
module? Are you sure?
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
dy have a range of methods which perform basic
operations on the string and return a new string, so
that's consistent.
"xyz".dup(3)
is clear enough.
And allowing
"xyz"*-3
was just lame. What reasonable use case does that have?
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
s through the wallpaper.
There have been better strongly typed languages. Modula III
was quite good, but it was from DEC's R&D operation, which was
closed down when Compaq bought DEC.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
s not clear.
Are you trying to upload a Python program to a server, where
a web server will run it in response to web requests? Or what?
Does this involve an Apache server?
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
eaves something to be desired.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
alk
encrypted to your attacker".
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On 9/29/2010 3:51 PM, Antoine Pitrou wrote:
On Wed, 29 Sep 2010 13:41:15 -0700
John Nagle wrote:
The really stupid thing about the current SSL module is that it
accepts a file of root certificates as a parameter, but ignores it.
That's not true. You have to pass CERT_OPTION
On 9/29/2010 4:59 AM, harryos wrote:
hi
I am trying to write a program to read data from a site url.
The program must read the data from site every 5 minutes.
def get_data_from_site(pageurlstr):
h=urllib.urlopen(pageurlstr)
data=h.read()
process_data(data)
A key point here is
age subject that describes the content of the message.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
nsisted that the
language should be very close to what a compiler of that form
can do. This eventually killed Pascal.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
n "bool" values are NOT integers. They can be coerced to
integers for historical reasons. But "str(True)" is "True".
The above could be better written as
button = gtk.Button(str(fill))
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
look for "val", and if the result
starts with "t" or "T", accept it as True. Otherwise, False.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
r concurrent transaction handling, or replication.
In other words, use SQLite in your desktop app to manage its data
or configuration parameters. Use MySQL or Postgres for your
web site.
(Personally, I like MySQL, but I fear Oracle will mess it up.)
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On 10/3/2010 5:40 PM, Lawrence D'Oliveiro wrote:
In message<4ca8c9b6$0$1598$742ec...@news.sonic.net>, John Nagle wrote:
(Personally, I like MySQL, but I fear Oracle will mess it up.)
Doesn’t matter whether Oracle messes up the brand called “MySQL” or not.
With Free Softwar
; in Python. This was
because the original design of Python didn't have "bool"
(a rather strange mistake for a language designed this late)
and the retrofit had to have some backwards compatibility.
That's why lame results such as "True + True" being 2.
;>> a = numpy.array([1,2,3])
>>> a*2
array([2, 4, 6])
>>> a*-1
array([-1, -2, -3])
"numpy" gives "+" and "*" their arithmetic meaning.
As an exercise to the reader, what's the result of:
numpy.array([1,2,3]) + [4,5,6]
Concate
n used to control the "for"
statement. If N is >= 99, there will be a buffer
overflow on "a". Also, starting to fill "a" from 1
looks like an error.
Third, the program doesn't actually do anything.
There's no output.
It looks like this approach t
On 10/7/2010 2:39 PM, kj wrote:
Following a suggestion from MRAB, I attempted to implement a
frozendict class.
That really should be built into the language. "dict" is the
last built-in type that doesn't have an immutable form.
Joh
d from an inner scope
without a "global" statement. But that protection isn't
applied to class-level variables referenced through 'self'.
Perhaps it should be.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On 10/10/2010 12:53 AM, Lawrence D'Oliveiro wrote:
In message<4cb14f8c$0$1627$742ec...@news.sonic.net>, John Nagle wrote:
Within "fn1", the first reference to "self.classvar" references the class-
level version of "classvar". The assignment overrides
re not inherently inefficient.)
A significant advantage of having a well defined set of
restrictions is that it encourages writing Python libraries which will
run under both RPython and CPython. This makes migration to a faster
system much easier.
On 10/11/2010 1:01 PM, John Nagle wrote:
(Correct Shed Skin tutorial link)
> Shed Skin:
> http://shedskin.googlecode.com/files/shedskin-tutorial-0.3.html
--
http://mail.python.org/mailman/listinfo/python-list
On 10/11/2010 1:47 PM, Ryan Kelly wrote:
On Mon, 2010-10-11 at 13:01 -0700, John Nagle wrote:
It may be time to standardize "RPython".
There are at least three implementations of "RPython" variants - PyPy,
Shed Skin, and RPython for LLVM. The first two are up and runni
n general, if you find yourself making millions of
SQL database requests in a loop, you're doing it wrong.
Big database loads are usually done by creating a text file
with the desired data, then using a LOAD DATA INFILE command.
This (in MySQL) is tens to hundreds of times faster than
doing indiv
On 10/12/2010 6:01 PM, Lawrence D'Oliveiro wrote:
In message<4cb4ba4e$0$1641$742ec...@news.sonic.net>, John Nagle wrote:
In general, if you find yourself making millions of
SQL database requests in a loop, you're doing it wrong.
I’ve done this. Not millions, but certainly
#x27;t match them, installs fail with obscure
error messages.
"egg" files are really just "zip" files. It's sometimes
necessary to unpack them, and run "python setup.py".
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
tialization
order fiasco". Python is vulnerable to this problem in
import loops, although the consequences aren't as severe as
in C++.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
clue.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
EOF. Reading ahead leads to deadlocks.
The same logic applies to generators. A generator may be getting
data from some source that can block. So an EOF test would lead
to trouble.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
cp 65001". If you try that with Python 2.6 and
Windows 7, you get "LookupError: unknown encoding: cp65001",
because "cp65001" isn't in Python's encoding tables.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
ords", a data attribute of the Zone object.
You get back a filled-in Zone object, which you can then use.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
nwanted items at all.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
lists (or anything
mutable) as default argument values
That really should be an error.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
er to
define a class, and initialize a singleton instance of the class
from the main program, where you can handle errors.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On 10/22/2010 6:10 AM, Ethan Furman wrote:
John Nagle wrote:
class nonnulldict(dict) :
def __setitem__(self, k, v) :
if not (v is None) :
dict.__setitem__(self, k, v)
That creates a subclass of "dict" which ignores stores of None values.
So you never store the unwanted items at a
dicative of external problems, not a
code error or cause for program termination with a traceback.
Are exception semantics changing in a way which would affect that?
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
with a JIT has to trap stores into some
internal variables and invalidate the generated code.
This adds considerable complexity to the virtual machine.
Java JVMs, for example, don't have to support that.)
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
to silent loss
of data."
"ftplib", in "storlines" and "storbinary", calls "close"
without calling "shutdown" first. So if the other end disconnects
after all data has been queued but not received, the sender will
never know. FAIL.
So there's your bug.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
e. So far, that's mostly been resisted. Attempts to allow
multiline lambdas have been averted. The weird "functional if"
syntax additions were a cave-in to the functional crowd, and may
have been a mistake.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On 10/19/2010 12:02 PM, Tobiah wrote:
I've been reading about the Unicode today.
I'm only vaguely understanding what it is
and how it works.
Please correct my understanding where it is lacking.
http://justfuckinggoogleit.com/
--
http://mail.python.org/mailman/listinfo/python-list
tifulSoup, but it's being abandoned for the Python 3
transition.
"http://www.crummy.com/software/BeautifulSoup/3.1-problems.html";
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
a.util.regex
import java.sql
import java.util.logging
As in
Python 2: import urllib
Python 3: import urllib.request, urllib.parse, urllib.error
http://diveintopython3.org/porting-code-to-python-3-with-2to3.html
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On 10/26/2010 1:46 PM, Krister Svanlund wrote:
You should check out OpenCV.
Yes. See
http://code.google.com/p/pyopencv/
Note the "people detector" example.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
7783
Does this mean it trashes installations of previous versions? Or can
multiple versions coexist?
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
_off = set('saturday','sunday')
if not d1.isdisjoint(days_off) :
...
This is cheaper than intersection, since it doesn't have to allocate
and construct a set. It just tests whether any element in the smaller of
the two sets is in the larger one.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
aying
information that should be sent in with a bug report.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On 11/2/2010 1:58 AM, Johann Spies wrote:
SOAP-ISIWoK is a Perl library for assessing Thomson Reuters Web of
Knowledge Web Services. I don't know Perl well enough to use that
library without spending too much time on it.
Is there a Python equivalent available?
The "Suds" library can call S
itesearch=www.python.org&q=open
http://www.google.com/search?q=Python+open
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
quot; or "reindent" have smart semantics
like CPython. The documentation doesn't say. If they don't, they
should, or it should be documented that they're broken.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
on.
Today's editors are too dumb to do that right. They're text
editors with the illusion of knowing something about the language,
not language editors which also format text.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
nually and follow all the
individual links to find the problem. You may have to put in a bug
request with the New York Times. Good luck with that.
It's the New York Times' paywall. They're trying to set a cookie,
and will redirect the URL until you store and return the cookie.
. Moral is many big
companies do both for products and internally.
Cheers, - Braden Faulkner
YouTube was rewritten a few years ago, as it was scaled up.
Not sure what it's written in now.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
0,42,'c4'],12],'as':
[[1,3,'79b',45,65,'er4'],54],'ae': [[56,57,58,59],34]}
intersect = filter(dict1.has_key, dict2.keys())
intersect
result:
['ax', 'ac', 'ab']
When you've spent a year maintaining and fixing code written
by others, come back and we'll talk.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
ee
http://lybniz2.sourceforge.net/safeeval.html
for something readable on how to use "eval" safely.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
Is there any reason to prefer "tempfile.TemporaryFile()"
over "os.tmpfile()"? Both create a nameless temporary file
that will be deleted on close.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
error detection and recovery starts to dominate
the problem.
John Nagle
--
http://mail.python.org/mailman/listinfo/python-list
On 11/12/2010 12:18 PM, John Nagle wrote:
On 11/10/2010 9:25 AM, Emanuele D'Arrigo wrote:
Greetings everybody,
I've tried to come up with this message for a couple of weeks now and
it doesn't look like I'm getting any clearer in my thoughts so I
decided that it's
something I
have to sysadmin, just a small shared
hosting account.
John Nagle
--
https://mail.python.org/mailman/listinfo/python-list
3, it's
3.2.3, which rejects "u" Unicode string constants and
has other problems in the MySQL area.)
John Nagle
--
https://mail.python.org/mailman/listinfo/python-list
g1.decode("latin-1")
'\\"Perfect Gift Idea\\"\x9d Each time'
That just converts 0x9d in the input to 0x9d in Unicode.
That's "Operating System Command" (the "Windows" key?)
That's clearly wrong; some kind of quote was intended.
Any ideas?
John Nagle
--
https://mail.python.org/mailman/listinfo/python-list
On 08/17/2017 05:14 PM, John Nagle wrote:
> I'm cleaning up some data which has text description fields from
> multiple sources.
A few more cases:
bytearray(b'miguel \xe3\x81ngel santos')
bytearray(b'lidija kmeti\xe4\x8d')
bytearray(b'\xe5\x81ukasz zmywac
On 08/17/2017 05:53 PM, Chris Angelico wrote:> On Fri, Aug 18, 2017 at
10:30 AM, John Nagle wrote:
>> On 08/17/2017 05:14 PM, John Nagle wrote:
>>> I'm cleaning up some data which has text description fields from
>>> multiple sources.
>> A few more
8 which had been
run through an ASCII-type lower casing algorithm, that's a reasonable
assumption. Thanks for looking at this, everyone. If a string won't
parse as either UTF-8 or Windows-1252, I'm just going to convert the
bogus stuff to the Unicode replacement character. I
On 08/17/2017 05:53 PM, Chris Angelico wrote:
On Fri, Aug 18, 2017 at 10:30 AM, John Nagle wrote:
On 08/17/2017 05:14 PM, John Nagle wrote:
I'm cleaning up some data which has text description fields from
multiple sources.
A few more cases:
bytearray(b'\xe5\x81ukasz zmywaczy
1201 - 1270 of 1270 matches
Mail list logo