to a date. For example:
>>> import datetime
>>> dt = datetime.datetime.now()
>>> print dt
2006-04-17 18:19:38.698925
>>> print dt.date()
2006-04-17
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Kun> how do you parse out a pre-specified time that is extracted via
Kun> sql? i don't think something like dt.date() works because it
Kun> doesn't work with a string? correct me if i'm wrong.
I think MySQLdb automatically returns datetime objects when the c
le of creating properties, you could
probably dream up some other syntax, but I suspect this notion will pop up
again. Even if you comment the heck out of a lying class definition, tools
like pylint and pychecker will think you're creating a class anyway and
incorrectly apply th
why the desired output of examples 1 and 6 is the
same, since the URLs are clearly different.) You don't mention having tried
the urlparse module, so I thought I should ask: have you tried using
urlparse?
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Thx,
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Wildemar> Are there any concepts that python has not borrowed, concepts
Wildemar> that were not even inspired by other languages?
I'd say Guido's willingness to borrow heavily from the best ideas present in
other languages ranks right up there as one of its key concepts
>> Does Perl have something like Python's repr() function?
John> perldoc Data::Dumper
Thanks. Just what the doctor ordered (after setting Useqq).
Skip
--
http://mail.python.org/mailman/listinfo/python-list
ither String::Escape nor Inline::Python installed.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
placid> Does anyone have binary for MySQLdb (python 2.4.3, MySQL 5.0a) ?
Platform? Last I checked a few weeks ago, MySQLdb didn't yet work with
MySQL 5.0.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Michael> So why not make "x % y" for floats behave exactly like it does
Michael> for integers and provide a separate operation with your
Michael> described behavior?
%% anyone?
(Skip ducks and runs...)
Skip
--
http://mail.python.org/mailman/listinfo/python-list
ue a
whois command directly, but I'm hoping there's some module out there that
will do the domain-to-whoisserver mapping and all the output parsing for me.
Any candidates other than the two I've found so far?
Thx,
Skip
--
http://mail.python.org/mailman/listinfo/python-list
x27;x'
1,16-1,18: NUMBER '10'
1,18-1,19: OP '('
1,19-1,20: OP '-'
1,20-1,21: NUMBER '4'
1,21-1,22: OP ')'
1,22-1,23: NEWLINE '\n'
2,0-2,0:ENDMARKER ''
Skip
--
http://mail.python.org/mailman/listinfo/python-list
hat's not what __all__ is used for. Try this:
from mm import *
The only name added to your namespace will be getsize1.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
ot;list"? Note that they are unordered.
These two sets are equal:
set(['b', 'a', 'c'])
set(['a', 'b', 'c'])
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Someone in hiding wrote:
> Hi, I'm interested in using python to start writing a CAD program for
> electrical design.
Google for PythonCAD.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
m would object. (Dad's gone, Chris does a
little Python programming from time-to-time.) I say go for it...
Skip (Montanaro)
--
http://mail.python.org/mailman/listinfo/python-list
#x27;t a
huge problem. For large dictionaries (millions of keys) might you have some
long chains? Or in an effort to reduce the chain length, wind up using so
much virtual memory that you wind up wrecking performance by swapping?
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Lance> May have a complicating issue with the array? Have the numbers
Lance> have been interpreted as strings? I have been pulling them from
Lance> a Word doc using regex's
[int(float(x)+0.5) for x in Test]
S
--
http://mail.python.org/mailman/listinfo/python-list
d out PythonCAD? <http://www.pythoncad.org/>. I
don't use it, but the guy's been trickling out new releases periodically for
the past four years or so (30 so far). Might be worth a peek.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
= {}
>>> for n in xrange(10**7):
... d[n] = hex(n % 1000)
...
I still wind up with 647MB VM. The dictionary and its keys are what consume
all the memory, and those keys are as simple as you can get.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
it achieves that nice short chain length by consuming gobs of
memory. A dictionary with 10**7 keys is going to chew up lots of memory.
There's nothing particularly magical about dictionaries in this respect.
They are good examples of a classic time-space tradeoff.
Skip
--
http://mail.p
ommand-line however? Should'nt the CFLAGS be propagated to the
Toon> Makefile that is generated by configure? Or is there any other way
Toon> to do this?
I agree, the Python configure/Makefile combination doesn't conform very well
to current GNU style in this regard. Try setting EXTRA_CFLAGS instead of
CFLAGS.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
ay in 32bit instead of 64bit (while python itself is in
Toon> 64bit)
That seems like a bug in distutils. Can you submit a help ticket?
Skip
--
http://mail.python.org/mailman/listinfo/python-list
t bother unless it provides some major structural
advantage to your code. If you think you need more than a couple CPUs, you
probably want a multi-process model anyway so you can leverage multiple
computers on a LAN (think Beowulf-style multiprocessing).
Skip
--
http://mail.python.org/mailman/listinfo/python-list
nt to one of the functions in your C
extension module? If so, yup, you get the list argument and march through
it element-by-element, then march through those tuples. For more detail on
argument handling in C, read here:
http://www.python.org/doc/api/arg-parsing.html
Skip
--
http://mai
12:48:31)
[GCC 3.4.1] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.stdout.encoding
'646'
>>> import codecs
>>> codecs.lookup("646")
(, , , )
Skip
--
http://mail.python.org/mailman/listinfo/python-list
lialie> The list has a random length.
lialie> Do you mean to do it in this way?
lialie> use PyTuple_Size(args), in a loop
lialie> use PyTuple_GetItem(args, i)
lialie> or
lialie> use PyArg_VaParse?
Sketch (that means off-the-top-of-my-head, untested, 99.9% guaranteed
inco
on you have your
Mac's Terminal window set to cp1252. (Does it go there? I'm at work right
now so I can't check).
Skip
--
http://mail.python.org/mailman/listinfo/python-list
on't
think a system can be relied upon to detect its own demise, as the recent
PC/Mac commercial about restarting illustrates:
<http://www.apple.com/getamac/ads/>.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
om/news.ars/post/20060524-6903.html>
Skip
--
http://mail.python.org/mailman/listinfo/python-list
the authors
apparently didn't use sgmlop (at least it's not mentioned) to boost the
decode performance of XML-RPC.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
x
it in list comprehensions. I believe at some point in the future they may
just go away or become syntactic sugar for a gen comp wrapped in a list()
call.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
ime. The files they create are not simple text files.
They are organized to permit quick access to records by key and to permit
average time fast insertion.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
i< TABLE.nsymbols; i++) ...). This is
data returned from a C library, not something I'm building in Python to pass
into C.
Thx,
Skip
--
http://mail.python.org/mailman/listinfo/python-list
ast):
File "", line 1, in
TypeError: unsupported operand type(s) for |=: 'set' and 'list'
>>> s |= set([4,5,6])
>>> s
set([1, 2, 3, 4, 5, 6])
Why is that? Doesn't the |= operator essentially map to an update() call?
Skip
--
http://mail.python.org/mailman/listinfo/python-list
l?
I'm going to craft a little table for the SpamBayes FAQ page and it will
save me a bunch of time if I don't have to go wandering in the twisty little
mazes that are Internet mail sites.
Thanks,
--
Skip Montanaro - [EMAIL PROTECTED] - http://www.webfast.com/~skip/
--
http://mail.python.org/mailman/listinfo/python-list
probably represent data from single-column
files, not double-column files with '8' or 'f' as the delimiter.
I would be happy to get rid of it in 3.0, but I'm also aware that some
people use it. I'd like feedback from the Python community about this. If
I removed it is t
subprocess module is also problematic.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
explain the rationale for using threads
in Python to someone who is experienced with multithreading in other
languages (like C/C++). Maybe a compare-and-contrast sort of document?
Thanks,
Skip
--
http://mail.python.org/mailman/listinfo/python-list
een ported to it
yet, it might be helpful if you explained why Python 2.6 + MySQLdb isn't
sufficient for your needs.
--
Skip Montanaro - [email protected] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
like to do it without calling any C API functions. If at all
possible the user-defined commands should work even if there is no process
available. (e.g., when working with core files).
Any suggestions?
--
Skip Montanaro - [email protected] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
e. I'm not sure I can do much with that without
having a process to use. Ideally:
print "".join([ chr(x) for x in *$__f->s...@$__f->length])
The question is, how do you do that in gdb-speak???
Skip
--
http://mail.python.org/mailman/listinfo/python-list
on Python 3.0 that is the place to ask. Of
course, like all open source software if you provide a patch in the project
tracker things will happen faster.
--
Skip Montanaro - [email protected] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
[mimetype weirdness reported]
Sion> Is this a bug?
Might be. Can you file a bug report in the Python issue tracker with a
small script that demonstrates the behavior?
--
Skip Montanaro - [email protected] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/pyt
c.
Thanks,
--
Skip Montanaro - [email protected] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
Paul> That's interesting, got a reference? (no pun intended)
http://letmegooglethatforyou.com/?q=lock+free+reference+counting
--
Skip Montanaro - [email protected] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
st and am not a C++ person, so may have
read what you saw but not recognized it in the C++ punctuation soup. I
couldn't find what you referred to. Can you provide a URL?
Thanks,
--
Skip Montanaro - [email protected] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
Rhodri> Just do the locking properly and worry about optimisations
Rhodri> later.
The locking is already done properly (assuming we are discussing CPython's
reference counting). Now is later. People are thinking about lots of
optimizations, this is just one of them.
--
Ski
erence count will often be in the
processor's local cache. (Presumably, if the current thread is going to
Py_DECREF the object it's been working with the object's state recently.)
The stuff I read suggested that simply locking the local cache would be
significantly faster than having t
ror message in the bounce? Feel free to send your message to me and
I'll forward it. (I'm one of the webmasters.)
--
Skip Montanaro - [email protected] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
so
Carl's notion of three types of objects breaks down then.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
relevant updates?
Steven> Should I ask about it on the python-dev mailing list, or just
Steven> wait until somebody happens to notice it?
But you've already noticed it. ;-)
Skip
--
http://mail.python.org/mailman/listinfo/python-list
to
Steven> look at it, or is that rude?
You might want to peruse some of the links on this page:
http://www.python.org/dev/
That might give you some insight into the Python development process and how
you fit into it.
--
Skip Montanaro - [email protected] - http://smontanaro.dyndns.org
ypes modules.
--
Skip Montanaro - [email protected] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
;t even look at the message itself until I saw
it come through in my email.
--
Skip Montanaro - [email protected] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
r> Seems like the level of spam is increasing in the last week, and
r> today has been bad. How are the spambytes coming along?
Spambayes is doing fine, but it only filters spam for the mailing list. It
has no effect on the Usenet side of things (comp.lang.python).
--
Skip Mon
The subprocess module was added in Python 2.4. I'm running 2.4.5 at work.
I know it's seen many bugfixes since first released. Is the version in 2.4
robust enough to use in preference to os.popen and friends?
Thx,
--
Skip Montanaro - [email protected] - http://www.smontanaro.ne
Roy> I need to run a command using subprocess.Popen() and have stdin
Roy> connected to the null device.
os.path.devnull should do what you want:
>>> os.path.devnull
'/dev/null'
>>> import ntpath
>>> ntpath.devnull
'
>> Any suggestions for a beginer on what to use for version control?
Chris> I like Mercurial (hg) personally...
Me too. It's perfect for little one-person things. (It's probably good for
other stuff as well, but I certainly like how easy it is to use for
standalon
different in RISCOS. Perhaps it was only ever added to Python to support
that platform.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Outlook
messages.
http://spambayes.svn.sourceforge.net/viewvc/spambayes/trunk/spambayes/Outlook2000/
--
Skip Montanaro - [EMAIL PROTECTED] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
Roy> I'm debating whether I should do the Python version with SWIG or
Roy> ctypes.
Unless your C++ library exports a C api I don't think you can use ctypes to
make it available within Python.
--
Skip Montanaro - [EMAIL PROTECTED] - http://smontanaro.dyn
gt; then < " > makes the whole process quite a hassle.
:rollseyes:
I hope there was a missing smiley in that post. If a couple extra parens
destroys your debugging productivity I suspect you need a fresh approach to
the task.
--
Skip Montanaro - [EMAIL PROTECTED] - http://smontana
rce string in
any given character set are because of errors in the source, not errors in
Python.
OTOH, the characters in position 49-55 look like plain old ASCII to me.
Does Shift-JIS have ASCII as a proper subset?
--
Skip Montanaro - [EMAIL PROTECTED] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
lkcl> Very simple question: how do you apply a decorator to an entire
lkcl> module?
Function-by-function or class-by-class. There is no decorator support for
modules.
--
Skip Montanaro - [EMAIL PROTECTED] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/li
functions (def) and classes
(class). import is not the same as a definition.
It's not obvious to me that module decorators would use precisely the same
sort of syntax as function and class decorators.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
ernal numpy module. In theory you
could also try to find a different malloc library which has better policies
about returning memory to the system.
--
Skip Montanaro - [EMAIL PROTECTED] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
just ask Subversion for a diff between it and the previous
version. For example:
% pwd
/Users/skip/src/python/trunk
% svn info Lib/os.py
Path: Lib/os.py
Name: os.py
URL: svn+ssh://[EMAIL PROTECTED]/python/trunk/Lib/os.py
Repository Root: svn+ssh://[EMAIL
mber off the top of my
head), so it's not compiled over and over again.
--
Skip Montanaro - [EMAIL PROTECTED] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
azrael> is it possible to save a python object into a sqlite database as
azrael> an atribute of type BLOB
Sure. Just pickle the object and save the resulting string.
--
Skip Montanaro - [EMAIL PROTECTED] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/
Bruno> Or if you want something more portable, serialize the object to
Bruno> json. At least you'll have a chance to deserialize it with some
Bruno> other language.
Assuming json can serialize more-or-less arbitrary Python objects. Can
it serialize class instances?
Bruno> Most of the time, you want to serialize the instance's __dict__.
Does it recreate an instance at the other end or just a dict?
Skip
--
http://mail.python.org/mailman/listinfo/python-list
> If you want a Python object store, you'll be better looking at
Bruno> ZODB, Durus or friends. --
Or SQLAlchemy or SQLObject.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
r performance if you open the file without the
third arg:
huge = io.open("C:\HUGE_FILE.pcl",'r+b')
--
Skip Montanaro - [EMAIL PROTECTED] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
ource of errors in a mixed development
environment (people using text editors with different tab stops). Better to
not allow them to be mixed.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
File "", line 1, in ?
AssertionError: (2, 4, 5, 'final', 0)
vs:
>>> import sys
>>> print(sys.version_info)
(3, 0, 0, 'final', 0)
Skip
--
http://mail.python.org/mailman/listinfo/python-list
entation to the
human observer but which looks like it has different indentation (and thus
different semantics) to the byte code compiler. There is often no warning.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
heir
Python installation. Your simple version test would miss that.
--
Skip Montanaro - [EMAIL PROTECTED] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
atches.
--
Skip Montanaro - [EMAIL PROTECTED] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
Sam> What are my options for a syslog server to receive the messages?
Sam> Rsyslog looks like it would be good. Anyone know anything else?
If you're running on a Unix system of any type you should have syslog by
default. You shouldn't need to install anything.
--
Ski
Python :: 3.0" tag, but not the more inlusive tag
above. I just updated the information to include it so it now appears in
the search results.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
ot;from __future__ ..." isn't really an import statement in the usual sense of
the term. It affects the byte code compiler immediately and I believe only
when using that syntax. That it actually adds a name to the module's
namespace is not really used (at least, not often).
--
Skip
for sys.argv[1:].
Pointers to other documentation or tutorials on the topic cheerfully
appreciated.
Thanks,
--
Skip Montanaro - [EMAIL PROTECTED] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
Kermit> I can't understand the second sentence because of the "for
Kermit> ... in".
Google for "python list comprehensions".
--
Skip Montanaro - [EMAIL PROTECTED] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
ate packages. You might have the latter but not the former.
--
Skip Montanaro - [email protected] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
ning the X Window
System. In many cases multithreading is the best way around this problem.
--
Skip Montanaro - [email protected] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
Leo> Any special reasons?
Nobody thought to add it? Got a patch?
--
Skip Montanaro - [email protected] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
u've enabled will be statically linked into the Python
interpreter executable and not built as shared objects.
At least that's how I recall it from the days before Python supported shared
libraries. It's been awhile.
--
Skip Montanaro - [email protected] - http://smontanaro.dyndns.org
at would give me a directory for my
feba> use only, instead of something where you can only upload one at a
feba> time. I'd especially like to avoid stuff that uses CAPTCHAs
feba> and/or forced waiting periods.
http://pastebin.com/?
--
Skip Montanaro - s...@pob
Reimar> Hi what has happened to PIL? No updates since two years.
It's well-written, stable code. As far as I know it does what people want
(at least it's done everything I've needed when I've used it). Why should
it matter that there hasn't been an official rel
redrik Lundh? http://effbot.org/
Skip
--
http://mail.python.org/mailman/listinfo/python-list
by people with a C/C++ background. I
don't think you can necessarily chalk that up to %-string avoidance. They
learn that + will concatenate two strings and don't look further.
--
Skip Montanaro - [email protected] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
p
r> the language, and it's not too late, dawn is not upon us yet.
Bruce Eckel proposes removing self from argument lists:
http://www.artima.com/weblogs/viewpost.jsp?thread=239003
Guido responds:
http://neopythonic.blogspot.com/2008/10/why-explicit-self-has-to-stay.html
--
on, Python is probably much more popular than
Perl and Tcl. Maybe not ahead of Ruby due to RoR. etc etc.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
posts?
--
Skip Montanaro - [email protected] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
Carl> ...shouldn't poeple who spend all their time following up to
Carl> trolls, or starting new threads about trolls, being doing
Carl> something else?
Sure. It was just a momentary break from work, as is this. I thought an
implied smiley was enough, but I guess not.
examples (maybe one example
each of reading and writing?)
Thanks,
--
Skip Montanaro - [email protected] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
Steve> Look at the pexpect module - you can run interactive tasks
Steve> through that.
Thanks. Worked like a charm.
--
Skip Montanaro - [email protected] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
Grant> -u" doesn't work post again, and I'll try to find it.
Would be helpful even if I don't need it for this task, as I've not been
able to find any simple examples on the net. (Maybe there's a recipe at
ActiveState, but Google didn't pick up anything
Grant> Are you sure it's not Python buffering its input? Have you tried
Grant> "python -u mympstat.py"?
Nope. -u unbuffers stdout and stderr, not stdin. It really must be mpstat
being uncooperative.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
601 - 700 of 2049 matches
Mail list logo