ovides a couple alternate traceback formatting functions. The
compact_traceback function is an adaptation of the one generated by
asyncore. The verbose_traceback function includes local variable values in
the trace.
If you have any interest in helping with any of these, let me know.
--
Ski
have SpamBayes packages? (I know about
rpmfind.net, but there must be other similar sites by now.)
Thx,
--
Skip Montanaro - s...@pobox.com - http://www.smontanaro.net/
--
http://mail.python.org/mailman/listinfo/python-list
David> I realize CSV module has a sniffer but it is something that is
David> limited more or less to delimited files.
Sure. How about:
def sniff(fname):
if open(fname).read(4) == "http://www.musi-cal.com/katrina
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo
e meaning of "host is alive". If that means "up and available
to do something for me", try connecting to the port of interest using the
socket module.
--
Skip Montanaro
Katrina Benefit Concerts: http://www.musi-cal.com/katrina
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
Damjan> Is there some python module that provides a multi process Queue?
Not as cleanly encapsulated as Queue, but writing a class that does that
shouldn't be all that difficult using a socket and the pickle module.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Damjan> Is there some python module that provides a multi process Queue?
Skip> Not as cleanly encapsulated as Queue, but writing a class that
Skip> does that shouldn't be all that difficult using a socket and the
Skip> pickle module.
Jeremy> What about
Damjan> Is there some python module that provides a multi process Queue?
Skip> Not as cleanly encapsulated as Queue, but writing a class that
Skip> does that shouldn't be all that difficult using a socket and the
Skip> pickle module.
Here's a trivial imple
7;s still
10,000 users per processor. Maybe that's small enough, but if not, he'll
need multiple processes across machines that don't share memory.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
c file records the absolute path to the .py file from which it was
generated. If it is moved to a different filesystem -- even if the .py file
goes along for the ride -- tracebacks display an incorrect path and fail to
display the corresponding source line.
Skip
--
http://mail.python.org/mailman/l
ely to do to the indentation of your script before
embedding it in a message. The net being the somewhat less safe place than
it used to be, many people may be hesitant to open attachments either. It
might well be safer to simply toss it on a personal website and provide a
link.
Skip
raction and
information hiding.
Python does encapsulation just fine. Your beef is with its information
hiding.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Greg> Does anyone know of academic papers that make the case against
Greg> "private" in languages?
Nope. I'd be interested in seeing academic papers that make the case (with
data to back up the claims) that "private" is beneficial.
Skip
--
http://m
on the matplotlib mailing list to
see if it can do what you want?
Skip
--
http://mail.python.org/mailman/listinfo/python-list
if lst is None:
lst = []
self.lst = lst
The same scheme would work for other mutable types (dicts, sets, etc).
This same question gets asked once a month or so. I'm sure this is in the
Python FAQ (check the website), but it was faster to reply than to look
Madhusudan> How do I flush the buffer and force python to write the
Madhusudan> buffers to the files ? I intend to put this inside the loop.
f = open("somefile", "w")
f.write("foo")
f.flush()
Skip
--
http://mail.python.org/mailman/listinfo/python-list
d
shared betwee all instances of MyClass. See the thread last week on the
same thing for more detail.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
554.html
I wouldn't be surprised if there were even earlier suggestions...
Skip
--
http://mail.python.org/mailman/listinfo/python-list
.disassemble_string(f.func_code.co_code)
0 LOAD_CONST 1 (1)
3 PRINT_ITEM
4 PRINT_NEWLINE
5 LOAD_CONST 0 (0)
8 RETURN_VALUE
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Try:
>>> los = ["123.0", "2", "1e-6"]
>>> map(float, los)
[123.0, 2.0, 9.9995e-07]
>>> [float(s) for s in los]
[123.0, 2.0, 9.9995e-07]
Skip
--
http://mail.python.org/mailman/listinfo/python-list
dt> Are there any links or sites on how to read outlook mail boxes or
dt> address book?
Check the Outlook plugin code in SpamBayes <http://www.spambayes.org/>.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Alex> I've seen enough occurrences of "lambda x: x" in Python code with
Alex> a generally functional style that I'd love to have
Alex> operator.identity (and a few more trivial functions like that) for
Alex> readability;-)
But, but, but [Skip g
expressions." Now they have two problems. --Jamie Zawinski
Skip
--
http://mail.python.org/mailman/listinfo/python-list
likely to find either mode combersome. For someone who regularly uses one
or the other, they are quite natural. I speak as someone who has used Emacs
of one variety or another for over 20 years. For me, readline's key
bindings "just work".
Skip
--
http://mail.python.org/mailman/listinfo/python-list
x27;_DBWithCursor', '__builtins__', '__doc__', '__file__',
'__name__', '__path__', '__version__', '_bsddb', '_checkflag', '_db',
'_iter_mixin', '_openDBEnv', 'btopen', 'db', 'error', 'hashopen', 'os',
'ref', 'rnopen', 'sys']
If the old libdb.a stuff is available, the bsddb185 module should have been
built automagically.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
pretty hard to be compatible with Perl's, at least for the basics.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Daniel> How can I replace all None values with the string 'Null' in a
Daniel> dictionary?
a = {'item1': 45, 'item2': None}
for key in a:
if a[key] is None:
a[key] = "Null"
Skip
--
http://mail.python.org/mailman/listinfo/python-list
on (try "import this" at an interpreter
prompt):
In the face of ambiguity, refuse the temptation to guess.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Steven> But as a general rule, you're right. If you, the developer,
Steven> don't have to think of your users as the enemy, you'd be amazed
Steven> the amount of make-work you don't have to do.
+1 QOTW.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
time(time.time()))
self.log.flush()
You might want to write a newline after the time as well. If the logfile is
line-buffered that will also provoke a flush.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
if v == 2:
Ben> del a[k]
Or iterate over just a copy of the keys:
for k in a_orig.keys():
if a_orig[k] == 2:
del a_orig[k]
Skip
--
http://mail.python.org/mailman/listinfo/python-list
ht also
want to check out the progress module available from my Python Bits page:
http://orca.mojam.com/~skip/python/
Skip
--
http://mail.python.org/mailman/listinfo/python-list
as I can
tell) perfectly valid utf-8 string.
I whittled the plist file down to what I've attached. With it I get
>>> e = elementtree.ElementTree.parse("Cookies.plist")
Traceback (most recent call last):
File "", line 1, in ?
File
"/
skip> I had no trouble decoding that string as unicode.
*sigh* I need some new proofreading glasses. Should be "... string as
utf-8".
S
--
http://mail.python.org/mailman/listinfo/python-list
tp://aspn.activestate.com/ASPN/Mail/Message/xml-sig/2792071
Thanks much. Your SgmlopXMLTreeBuilder module came to the rescue.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Thomas> What's wrong with this? The python-anounce tells me that my
Thomas> message has a suspicious header?
Nothing wrong. Just flagged by the spam filters as undecidable. A
human moderator will review it.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
I would like to try a sampling approach to profiling. My thought is to have
a profiling thread that samples the execution frame of all the other
started threads. I don't see any path from the threads returned by
threading.enumerate() to their current frames. Am I missing something?
Thx,
test_locale with no LC_* environment variables set. Should my
LC_* settings be different? Can anyone else confirm these problems?
Thx,
Skip
--
http://mail.python.org/mailman/listinfo/python-list
For the same reason I don't like web forums as a means of communication. I
would much rather operate in an interrupt-driven mode than have to remember
to poll some external service to get my daily helping of information.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
with spam), so on those few occasions where I need
something I just use Google to search for help and post via Google or Gmane.
I never have to worry about NNTP. I have no idea if my ISP (Comcast) even
provides NNTP access.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
r line in filterfile:
process(line)
I'm not sure what you mean by all the dots in your start of block line. If
"start of block" can be followed by other text, just use
if line.startswith(self.start):
instead of an exact comparison.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
ns will not read or write v1.85
files. Since the bsddb185 module is only there for compatibility and
emergencies, no new functionality is planned for it.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
module is only available because the
underlying library API is more complete.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Mike> elements - except when they can't.
For those of us not following this thread closely, can you identify cases
where tuples are mutable, not hashable or can't be used as dictionary keys?
I've never encountered any such cases.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
...
>>>> t = ([1,2], [3,4])
>>>> t[0] += [5]
aahz> Traceback (most recent call last):
aahz> File "", line 1, in ?
aahz> TypeError: object doesn't support item assignment
>>>> t
aahz> ([1, 2, 5], [3, 4]
Sorry, incomplete explanation. I never create tuples which contain mutable
containers, so I never have the "can't use 'em as dict keys" and related
problems. My approach to use of tuples pretty much matches Guido's intent I
think: small, immutable, record-like
u supplied, 'tgreenwoodgeer.yahoo.com'. This is different
richard> from the session details you have supplied. I can't reconcile
richard> these. I suggest you try again, and be careful when typing your
richard> email address.
Just a wild-ass guess, but shoul
ttp://pyro.sourceforge.net/
It's not based on shared memory, but will also work across networks.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Martin> I read or heard (can't remember the origin) that MS IE has a
Martin> quite good implementation of guessing the language en character
Martin> encoding of web pages when there not or falsely specified.
Gee, that's nice. Too bad the source isn't avail
Tony> Note that the updated version of this is at:
Tony> http://wiki.python.org/moin/HowTo/Sorting
And has been updated quite a bit in the last week by Andrew.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
isn't all that hard either.
If you prefer the latest documentation, bookmark this page:
http://www.python.org/dev/doc/devel/index.html
That's updated every few months, more frequently as new releases approach.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
It's tough to put yourself in the shoes of a
novice, so it's tough to write documentation that would be helpful for new
users. It's extremely helpful if new users submit documentation patches as
they figure things out. It's generally unnecessary to write large tomes.
Often all that's needed is a few sentences or an example or two.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
velopers decide whose inputs to listen to.
Everybody applies such filters whether they think about it or not. Here are
a couple of mine:
Xah Lee? Hit the 'd' key.
Tim Peters? Read it no matter what the subject says.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
to learn LaTex or DocBook, which,
bs> I'm sorry, I am not going to do.
Let me repeat this for the umpteenth time: You do not have to learn LaTeX to
contribute to docs. Submit plain text. One of us with some LaTeX knowledge
will do the markup. Content is the hard part. Markup is
n the Python community, send a note to [EMAIL PROTECTED]
Skip
--
http://mail.python.org/mailman/listinfo/python-list
ike LWP (Perl) or whatever
Paul> the equivalent is in Java.
Sounds like a subject matter expert is needed here, not a garden variety
tech writer or Python programmer. Documentation of esoteric stuff requires,
well, esoteric knowledge.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
, Ruby, Tcl, Java, C++, C#,
etc. Does that mean their documentation stinks? Maybe. Maybe not. It
just means a lot of people have somewhat different ways of tackling the same
problem.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
e behind virtual masks and throw away email addresses every few
months. At the dawn of time, basically everyone used their real
names.
It's probably just my misunderstanding about how people use avatars on the
net nowadays, but I still expect professional people to communicate
d by Guido.
We've generally accepted the PEP as informal documentation, but PEP's aren't
really part of the formal documentation set. Perhaps all we need to do is
be more stringent in requiring Language Reference updates before PEP
acceptance.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
pport in inline annotation feature. It would need
to be added.
What was the comment here the other day? Python has more web application
frameworks than keywords. PHP only has one. ;-)
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Ian> A test suite seems far more useful to implementors than any guide,
Of course, test cases can be modified or ignored. I'd agree with you if we
had a test suite that was more strongly cast in stone.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
uding the intermediate folks, I'll bet) are
rd> grateful for the chance to see a real live example.
ISTR that comment was made in reference to the Language Reference, which as
written is intended for "language lawyers". Examples there seem
counterproductive.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
tests quite some things
Carl> that are obviously implementation details.
No disagreement there. The current CPython test suite would not cut the
mustard as a test for Python specification compliance.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
strftime(t2_s, fmt)[:6])
dt = t2 - t1
should do the trick.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
ople to the process
without a formal registration process as would doing the whole thing via
Python's svn repository.) Creating a UsersGuide section of the Python wiki
with reST as the markup might be a good place to work on such a beast with
the goal that it would be a stepping stone to
r may not work in 2.1. If you decide you can live without datetime,
Fredrik's strptime/mktime solution is how you do it without datetime.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
igned for explanation
(mostly it's more complex, but it also has extra productions) and is
somewhat (maybe a lot) different than the BNF in the ref manual.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
eforge.net/> for python.org. I doubt if anyone
here can do anything about the first barrier, but if you know something
about Roundup (or would like to learn about it) and would like to
contribute something non-documentational that would really have a
direct, positive impact on the Python community, send a note to
[EMAIL PROTECTED]
Skip
--
http://mail.python.org/mailman/listinfo/python-list
dev is at the head of the next), and provide links to each
Iain> initial letter at the top of the page.
I know it's not what you asked for, but give
http://staging.musi-cal.com/modindex/
a try. See if by dynamically migrating the most frequently requested
modules to the fr
pression syntax, that sort of thing.
Having to page down past dozens and dozens of modules I don't care about to
click on "sys" or "datetime" motivated me to write my little hack.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
four actively maintained/developed implementations of
Python. A common language reference manual is important for them, and
indirectly for the people who use the four implementations.
I'm not trying to discount the value of a good Users Guide.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
't provide a cache with a 100% hit rate, but the
cost of a cache miss isn't all that high. Also, you might discover some
useful modules you hadn't used before simply because they are frequently
referenced.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
on the wiki. We got tired of having to revert
changes to it every day or two. I'll take a look at incorporating your
suggestions.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
erpreter preventing
them from speaking or writing.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
>> http://staging.musi-cal.com/modindex/
rurpy> Is this only for the online docs?
Yes. I don't see that it would be helpful for static docs. Presumably they
will get reorganized. I want something for the many times I return to the
global module index looking for help with a particul
on"? Once you start migrating stuff from the "add on" manual (Library
Reference) to the "core" manual (Language Reference), where do you stop?
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Magnus> install it, but each different package that needs to be
Magnus> installed from another source, built and tested on multiple
Magnus> platforms etc, means more work.
More work than reimplementing the functionality or living with a miserable
API (I'm thinking norma
ble to install it as a third-party package, I think there's a clear
best-of-breed aspect here that suggests it belongs in the standard
distribution simply to discourage continued use of DOM-based APIs.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
dules for an
amk> "Application Support" chapter.
There are currently 46 module index entries for the various parts of
distutils. I think it would be helpful to reduce that number a bit...
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Mike> The question is how do you keep the system that the Python code is
Mike> actually running on safe? Ruby may have a real bastion mode, but
Mike> Python doesn't.
User Mode Linux? chroot?
Skip
--
http://mail.python.org/mailman/listinfo/python-list
e "x = [1,2,3]" followed by "x * 5" when it was asking me to
type "2 + 6". It evaluated both properly as far as I could tell. OTOH, it
hung when I entered "def fib(n)". Never got to the next prompt. Looking at
the Javascript, it appears to be some sort of
Cameron> In article <[EMAIL PROTECTED]>,
Cameron> I reported:
>> "Python has more web application frameworks than keywords." - Skip
>> Montanaro (but probably others going back years)
Cameron> Incorrect. Thanks to Fredrik Lundh ...
Yea
A simple script like the one below lets me jump through a directory
structure. However, if I run it from /this/directory and within it to go to
/a/totally/different/directory... I'm still actually going to be in
/this/directory when I exit the script. Is it possible to have a script
that can
possible. At the very least I'd like to know how others have
approached the problem. I think there's an opportunity to add some
value that everyone can take advantage of.
Thanks for your time,
Skip Montanaro
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ork. It's just not
called a contest. To make it more challenging, we sometimes leave out the
"bit of thought" part. ;-)
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Brian> This contest is for people who like thinking about algorithms.
Surely you must have missed the smiley...
S
--
http://mail.python.org/mailman/listinfo/python-list
dd a
Steven> goto to it.
Maybe easier would be to write a Python assembler (there's probably already
one out there) and just write to Python's virtual machine...
Skip
--
http://mail.python.org/mailman/listinfo/python-list
n c source) that would help.
fraca7> I don't think so, but when having a memory problem I usually
fraca7> find valgrind very useful.
Actually, take a look in the distribution at Misc/gdbinit. In particular,
check out the pystack command.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
tring object encoded with some
to-be-determined encoding?
Why not just add __str__ and __unicode__ methods to the class and let the
user use str(somepath) or unicode(somepath) as needed?
Or am I missing something fundamental about what the base() method is
supposed to do?
Skip
--
http://mail.python.org/mailman/listinfo/python-list
into a DSN string. Check the docs for the module
you use to talk to Oracle.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Michael> Does anyone have any Emacs skeletons they find useful for
Michael> Python?
What's an "Emacs skeleton"?
Skip
--
http://mail.python.org/mailman/listinfo/python-list
bert> total crap.
If your ISP provides you with a C compiler, you can download and install
Python yourself. Just create ~/local, add ~/local/bin to your PATH, then in
the expanded Python source tree execute:
./configure --prefix=$HOME/local
make
make test
make install
Skip
--
http://mail.python.org/mailman/listinfo/python-list
d there
is nothing so satisfying as responding politely to such messages and then to
have their authors come virtually crawling back later with an apology for
having been so out-of-line.
Just a thought...
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Chris> I have a problem matching nested levels of {} ...
Regular expressions can't count, so you'd be better off sticking with
regexes to tokenize the source, then use a real parser to parse the tokens
it produces.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
strictly to Python. I'm sure you can create file/class
relationships in Java or C++ that make it challenging to find the definition
of a mixin. I don't view multiple inheritance as a gotta-have feature of
OOP and avoid it when I can. Smalltalk has lived happily without multiple
inher
consider your
requirements to decide which to use.
--
Skip Montanaro
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
ction?
I believe "consider" != "adopt". Different people's needs are different, so
the notion of how "production-ready" it has to be will vary.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
h=moin
Skip
--
http://mail.python.org/mailman/listinfo/python-list
cost of disk space today I don't understand
why a distribution for a mainstream platform should be hobbled.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Paul> Steve Holden <[EMAIL PROTECTED]> writes:
>> A corrected find() that returns None on failure is a five-liner.
Paul> If I wanted to write five lines instead of one everywhere in a
Paul> Python program, I'd use Java.
+1 for QOTW.
Skip
--
http
t through at all. slightly annoying.
I think it's just that the SpamBayes training database used to check the
list's messages is perhaps getting a little tired.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
1 - 100 of 2051 matches
Mail list logo