srinivasan srinivas wrote:
Can someone tell me is there any module available to create directories??
I tried os, tempfile.
I was facing some issues with os.mkdir(). The mode setting was not proper with
this method.
I created the directory 'stdin' with '0700' mode using os.mkdir() method.
$>
Hi all,
can anyone explain the behaviour of the following code sniplet:
---> schnipp <---
class Base(object):
def __init__( self, lst=[] ):
self.varlist = lst
def addVar( self, var ):
self.varlist.append(var)
class Derived(Base):
def __init__( self, var ):
I'm working on a remote object system, something kinda like Pyro.
For the purposes of caching I need to be able to tell if a given
dict / list / set has been modified.
Ideally what I'd like is for them to have a modification count
variable that increments every time the particular collection is
mod
Jan Schäfer wrote:
can anyone explain the behaviour of the following code sniplet:
well, it *is* explained in the tutorial, the language reference, and the
FAQ, so yes, it can be explained ;-)
for more information, see this page:
http://effbot.org/zone/default-values.htm
--
http://m
On 7 sep, 12:40, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Jan Schäfer wrote:
> > can anyone explain the behaviour of the following code sniplet:
>
> well, it *is* explained in the tutorial, the language reference, and the
> FAQ, so yes, it can be explained ;-)
>
> for more information, see this p
En Sat, 06 Sep 2008 17:18:55 -0300, clurker <[EMAIL PROTECTED]> escribió:
> Michele Simionato wrote:
>
>> On Aug 28, 6:21 am, ssecorp <[EMAIL PROTECTED]> wrote:
>>> Is there a way to view all the modules I have available for import
>>> from within Python?
>>> Like writing in the interpreter:
>>
>>
En Sat, 06 Sep 2008 20:26:24 -0300, Python <[EMAIL PROTECTED]> escribió:
> now one question came up, how do I make those path permanent?
> i mean, sys.path.append( adds it for the current session,
> yet when i logout of IDLE and start it again it's gone...
> how do i keep it in there?
You can add
I built and installed mx-experimental 3.0.0 from source and it seemed to go
fine. But when I try to import it, I get this:
localhost% python -c "import mx.Tidy"
Traceback (most recent call last):
File "", line 1, in ?
File "mx/Tidy/__init__.py", line 7, in ?
from Tidy import *
F
Hi all!
I am trying to install M2Crypto to work on OSX10.5 apache
(mod_python). Error I receive:
Error was: dlopen(/Library/WebServer/eggs/M2Crypto-0.18.2-py2.5-
macosx-10.5-i386.egg-tmp/M2Crypto/__m2crypto.so, 2): no suitable image
found. Did find:
/Library/WebServer/eggs/M2Crypto-0.18.
I have a function in my module:
def selftest(verbose=False):
import doctest
doctest.testmod(verbose=verbose)
When I run it, it fails to find any of my doc tests, including the tests
in __main__, and in fact it looks like it can't even find my functions
and classes:
>>> mymodule.selft
Steven D'Aprano wrote:
I have a function in my module:
def selftest(verbose=False):
import doctest
doctest.testmod(verbose=verbose)
what happens if you change the above to
def selftest(verbose=False):
import doctest, yourmodule
doctest.testmod(yourmodule, verbose=verbos
Hi everyone
Our original release of TPP Volume 3 Issue 2 is in the form of one PDF
per article. A number of readers had kindly requested for a parallel
release for the entire issue in a single PDF for easy transport.
Despite prevalent "industrial standards" for one PDF per article such
as IEEE an
Steven D'Aprano, first of all you can try to run a minimal module, to
see if your doctesting works, like:
"""
>>> 1 + 1
3
"""
def foo():
"""
>>> foo()
1
"""
return 0
import doctest
doctest.testmod()
If that works correctly, then you can show us some more of the code
and tests.
In article <[EMAIL PROTECTED]>,
Fredrik Lundh <[EMAIL PROTECTED]> wrote:
>Martin DeMello wrote:
>>
>> In the interests of not hammering the db unnecessarily, I'm
>> considering the following
>> 1. A series of independent "monitor" threads that collect information
>> over TCP from the cluster of ma
Aahz wrote:
why are you using a queue for this case, btw? why not just use a plain list
L = []
lock = threading.Lock()
and add stuff using append in the monitor threads
with lock:
L.append(item)
Because using a queue requires less thinking.
given that the whole reason
Hendrik van Rooyen schrieb:
Fredrik Lundh wrote:
sounds like he wants/needs non-cooperative, mandatory locking.
Could one get there using ctypes to disable interrupts?
Not as such, ctypes can't execute arbitrary machine code. But of course
you can create a C-lib that does what you want (I
hi all,
--
http://mail.python.org/mailman/listinfo/python-list
On 7 sep 2008, at 13:50, Gabriel Genellina wrote:
En Sat, 06 Sep 2008 20:26:24 -0300, Python <[EMAIL PROTECTED]> escribió:
now one question came up, how do I make those path permanent?
i mean, sys.path.append( adds it for the current session,
yet when i logout of IDLE and start it again it's
Hi,
- - Connection.enable_load_extension(enabled) to allow/disallow extension
loading. Allows you to use fulltext search extension, for example ;-)
The following code (from the docs) produces an error:
from pysqlite2 import dbapi2 as sqlite3
con = sqlite3.connect(":memory:")
# Load the ful
anyone recommend a way of formatting floats with comma separators?
e.g. 50.00 -> 500,000.00
--
http://mail.python.org/mailman/listinfo/python-list
__builtins__ in 2.5.2 doesn't seem to behave like I remember it did
the last time I did some custom stuff with it, a very long time ago.
This isn't surprising, because of ongoing optimization, but it's hard
to google for '__builtins__' so I didn't really find any documentation
on the current CPyth
On Sep 6, 11:05�pm, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
> On Sat, 06 Sep 2008 11:22:07 -0700, Mensanator wrote:
>
> [...]
>
> >> They could have decided that sum must take at least two arguments,
> >> because addition requires two arguments and it's meaningless to talk
> >
On Sep 7, 12:30 pm, Mensanator <[EMAIL PROTECTED]> wrote:
> On Sep 6, 11:05 pm, Steven D'Aprano <[EMAIL PROTECTED]
> > Sheesh. That's not a problem, because Python is not trying to be a
> > dialect of SQL.
>
> And yet, they added a Sqlite3 module.
Does that mean that, because there is an 'os' modu
On 9/7/2008 12:22 PM SimonPalmer apparently wrote:
anyone recommend a way of formatting floats with comma separators?
http://code.activestate.com/recipes/498181/
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
En Sun, 07 Sep 2008 14:00:48 -0300, Patrick Maupin <[EMAIL PROTECTED]> escribió:
> __builtins__ in 2.5.2 doesn't seem to behave like I remember it did
> the last time I did some custom stuff with it, a very long time ago.
>
> This isn't surprising, because of ongoing optimization, but it's hard
>
En Sun, 07 Sep 2008 14:30:09 -0300, Mensanator <[EMAIL PROTECTED]> escribió:
> Actualy, I already get the behaviour I want. sum([1,None])
> throws an exception. I don't see why sum([]) doesn't throw
> an exception also (I understand that behaviour is by design,
> I'm merely pointing out that the d
On Sep 7, 2:50 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote:
> Inside PyFrame_New, there is a shortcut: if the new frame and
> the previous one share the same globals, then the previous
> builtins are copied into the new frame. Only if the globals
> differ the builtins are searched in globals.
I am trying to translate this elegant Erlang-code for finding all the
permutations of a list.
I think it is the same function as is but it doesn't work in Python.
-- is upd in Python. It works as it should.
perms([]) -> [[]];
perms(L) -> [[H|T] || H <- L, T <- perms(L--[H])].
def perms(lista):
Gabriel Genellina wrote:
> En Sat, 06 Sep 2008 17:18:55 -0300, clurker <[EMAIL PROTECTED]>
> escribió:
>
>> Michele Simionato wrote:
>>
>>> On Aug 28, 6:21 am, ssecorp <[EMAIL PROTECTED]> wrote:
Is there a way to view all the modules I have available for import
from within Python?
I am concerned by the lack of follow-through on some responses to
recent ideas I have described. Do I merely have a wrong understanding
of group policy? Is it a good policy (defined with respect to the
future of Python and the welfare of humans at large) if so? Is there
a serious lack of diligen
Hi,
This is the strangest post I've seen
since I've joined this list (only
recently). What the ?
cheers
James
On Mon, Sep 8, 2008 at 7:00 AM, castironpi <[EMAIL PROTECTED]> wrote:
> I am concerned by the lack of follow-through on some responses to
> recent ideas I have described. Do I merely ha
Can we stop this thread now? :)
I think we've all seen what the intended
behavior of sum(), max() and other
similar functions.
cheers
James
On Mon, Sep 8, 2008 at 3:30 AM, Mensanator <[EMAIL PROTECTED]> wrote:
> On Sep 6, 11:05�pm, Steven D'Aprano <[EMAIL PROTECTED]
> cybersource.com.au> wrote:
Hi,
Here's a (better?) function:
def permutate(seq):
if not seq:
return [seq]
else:
temp = []
for k in range(len(seq)):
part = seq[:k] + seq[k+1:]
for m in permutate(part):
temp.append(seq[k:k+1] + m)
return temp
che
Hi,
There is a much easier more consistent way:
>>> import locale
>>> locale.setlocale(locale.LC_ALL, "en_AU.UTF-8")
'en_AU.UTF-8'
>>> locale.format("%0.2f", 500, True)
'5,000,000.00'
>>>
cheers
James
On Mon, Sep 8, 2008 at 5:24 AM, Alan G Isaac <[EMAIL PROTECTED]> wrote:
> On 9/7/2008 12:2
Hello...
I have a dict of key/values and I want to change the keys in it, based
on another mapping dictionary. An example follows:
MAPPING_DICT = {
'a': 'A',
'b': 'B',
}
my_dict = {
'a': '1',
'b': '2'
}
I want the finished my_dict to look like:
my_dict = {
'A': '1',
'B'
James Mills wrote:
There is a much easier more consistent way:
import locale
locale.setlocale(locale.LC_ALL, "en_AU.UTF-8")
'en_AU.UTF-8'
doesn't work on all Python platforms, though:
>>> locale.setlocale(locale.LC_ALL, "en_AU.UTF-8")
Traceback (most recent call last):
File "", line 1, i
En Sun, 07 Sep 2008 18:00:30 -0300, castironpi <[EMAIL PROTECTED]> escribió:
> I am concerned by the lack of follow-through on some responses to
> recent ideas I have described. Do I merely have a wrong understanding
> of group policy? Is it a good policy (defined with respect to the
> future of
On Sun, 07 Sep 2008 14:51:32 -0700, [EMAIL PROTECTED] wrote:
> MAPPING_DICT = {
> 'a': 'A',
> 'b': 'B',
> }
>
> my_dict = {
> 'a': '1',
> 'b': '2'
> }
>
> I want the finished my_dict to look like:
>
> my_dict = {
> 'A': '1',
> 'B': '2'
> }
>
> Whereby the keys in the or
On Mon, 08 Sep 2008 07:34:55 +1000, James Mills wrote:
> This is the strangest post I've seen
> since I've joined this list (only
> recently). What the ?
Yeah, castironpi sometimes doesn't make much sense. Maybe because it's a
bot!? :-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.py
On Sep 7, 2:51 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hello...
>
> I have a dict of key/values and I want to change the keys in it, based
> on another mapping dictionary. An example follows:
>
> MAPPING_DICT = {
> 'a': 'A',
> 'b': 'B',
>
> }
>
> my_dict = {
> 'a': '1',
>
[EMAIL PROTECTED] wrote:
Is there a clever way to do this, or should I loop through both,
essentially creating a brand new dict?
since none of your dictionaries contain the keys you want in the final
dictionary, creating a brand new dict sounds pretty clever to me.
--
http://mail.python.o
Hi,
There is "never" a "clever" way
of doing anything, but:
$ cat test.py
MAPPING_DICT = {'a': 'A','b': 'B',}
my_dict = {'a': '1','b': '2'}
my_dict = dict((MAPPING_DICT[k], my_dict[k]) for k in my_dict)
print my_dict
$ python test.py
{'A': '1', 'B': '2'}
$
That should do the trick.
cheers
James
cnb <[EMAIL PROTECTED]> writes:
> perms([]) -> [[]];
> perms(L) -> [[H|T] || H <- L, T <- perms(L--[H])].
I think the most direct transcription might be:
def perms(xs):
if len(xs)==0: return [[]]
return [([h]+t) for h in xs
for t in perms([y for y in xs if y
En Sun, 07 Sep 2008 18:51:32 -0300, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
escribió:
> I have a dict of key/values and I want to change the keys in it, based
> on another mapping dictionary. An example follows:
>
> MAPPING_DICT = {
> 'a': 'A',
> 'b': 'B',
> }
>
> my_dict = {
> 'a': '1'
On Sep 7, 5:03 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
> On Mon, 08 Sep 2008 07:34:55 +1000, James Mills wrote:
> > This is the strangest post I've seen
> > since I've joined this list (only
> > recently). What the ?
>
> Yeah, castironpi sometimes doesn't make much sense. Maybe bec
+1 Bot
--
http://mail.python.org/mailman/listinfo/python-list
Gabriel, could I please ask you to configure your news-reader software or
editor to limit the length of each line of your posts to 70 characters
wide, as per the common standard for email and Usenet? Your lines are
significantly longer than that, including one single line which is 325
character
Marc 'BlackJack' Rintsch wrote:
Yeah, castironpi sometimes doesn't make much sense. Maybe because it's a
bot!? :-)
if so, they sure don't make c.l.py bots like they used to, do they?
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 8, 7:51 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hello...
>
> I have a dict of key/values and I want to change the keys in it, based
> on another mapping dictionary. An example follows:
>
> MAPPING_DICT = {
> 'a': 'A',
> 'b': 'B',
>
> }
>
> my_dict = {
> 'a': '1',
>
On Mon, Sep 8, 2008 at 8:37 AM, John Machin <[EMAIL PROTECTED]> wrote:
> Is this homework?
I hope it's not - or I'll be quite annoyed :)
> There seems to be an implicit assumption in the answers so far that
> your mapping is a 1:1 mapping of all possible input keys.
>
> If it doesn't include all
Hi guys,
I am new to Python, and thinking about migrating to it from matlab
as it is a really cool language. Right now, I am trying to figure out
how to control read and write binary data, like
'formatted','stream','big-endian','little-edian' etc.. as in fortran.
I googled, but can not find a cle
On Sep 8, 8:36 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Marc 'BlackJack' Rintsch wrote:
> > Yeah, castironpi sometimes doesn't make much sense. Maybe because it's a
> > bot!? :-)
>
> if so, they sure don't make c.l.py bots like they used to, do they?
>
>
That's correct. This one seems to
On Mon, 08 Sep 2008 07:34:55 +1000, James Mills wrote:
> Hi,
>
> This is the strangest post I've seen
> since I've joined this list (only
> recently). What the ?
Oh don't mind castironpi, many people think he's an IRC bot with some
experimental AI features that escaped onto Usenet *grins*. If y
On Sun, 07 Sep 2008 15:51:01 +0200, Fredrik Lundh wrote:
> Steven D'Aprano wrote:
>
>> I have a function in my module:
>>
>> def selftest(verbose=False):
>> import doctest
>> doctest.testmod(verbose=verbose)
>
> what happens if you change the above to
>
>def selftest(verbose=False)
On Sep 8, 8:42 am, "James Mills" <[EMAIL PROTECTED]> wrote:
> On Mon, Sep 8, 2008 at 8:37 AM, John Machin <[EMAIL PROTECTED]> wrote:
> > There seems to be an implicit assumption in the answers so far that
> > your mapping is a 1:1 mapping of all possible input keys.
>
> > If it doesn't include all
On Sep 7, 11:07 pm, Bojan Mihelac <[EMAIL PROTECTED]> wrote:
> Hi all!
>
> I am trying to install M2Crypto to work on OSX10.5 apache
> (mod_python). Error I receive:
>
> Error was: dlopen(/Library/WebServer/eggs/M2Crypto-0.18.2-py2.5-
> macosx-10.5-i386.egg-tmp/M2Crypto/__m2crypto.so, 2): no suitab
On Sun, 07 Sep 2008 15:59:52 -0700, John Machin wrote:
> On Sep 8, 8:42 am, "James Mills" <[EMAIL PROTECTED]> wrote:
>> On Mon, Sep 8, 2008 at 8:37 AM, John Machin <[EMAIL PROTECTED]>
>> wrote:
>
>> > There seems to be an implicit assumption in the answers so far that
>> > your mapping is a 1:1 m
On Mon, Sep 8, 2008 at 8:59 AM, John Machin <[EMAIL PROTECTED]> wrote:
> What do you mean by "this right"? Perhaps the Divine Right of OPs,
> managers, examiners, business analysts, etc never to give a complete
> spec up front and never to contemplate the consequences of Murphy's
> Law?
Now you're
On Sep 7, 5:45 pm, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
> On Mon, 08 Sep 2008 07:34:55 +1000, James Mills wrote:
> > Hi,
>
> > This is the strangest post I've seen
> > since I've joined this list (only
> > recently). What the ?
>
> Oh don't mind castironpi, many people thin
On 7 Sep, 23:00, castironpi <[EMAIL PROTECTED]> wrote:
> I am concerned by the lack of follow-through on some responses to
> recent ideas I have described. Do I merely have a wrong understanding
> of group policy?
I think some people have taken exception to your contributions
previously, which I
On Sep 7, 3:13�pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote:
> En Sun, 07 Sep 2008 14:30:09 -0300, Mensanator <[EMAIL PROTECTED]> escribi�:
>
>
>
> > Actualy, I already get the behaviour I want. sum([1,None])
> > throws an exception. I don't see why sum([]) doesn't throw
> > an exception also
On Sep 7, 11:28 pm, "Eric Wertman" <[EMAIL PROTECTED]> wrote:
> +1 Bot
I think it's like duck typing: it doesn't matter whether he's actually
a bot, only whether he behaves like one.
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 7, 1:17�pm, Patrick Maupin <[EMAIL PROTECTED]> wrote:
> On Sep 7, 12:30�pm, Mensanator <[EMAIL PROTECTED]> wrote:
>
> > On Sep 6, 11:05 pm, Steven D'Aprano <[EMAIL PROTECTED]
> > > Sheesh. That's not a problem, because Python is not trying to be a
> > > dialect of SQL.
>
> > And yet, they ad
On Sep 7, 3:37 pm, John Machin <[EMAIL PROTECTED]> wrote:
> On Sep 8, 7:51 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hello...
>
> > I have a dict of key/values and I want to change the keys in it, based
> > on another mapping dictionary. An example follows:
>
> > MAPPING_DICT = {
On Sep 7, 2:17�pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
> On Sun, 7 Sep 2008 10:30:09 -0700 (PDT), Mensanator <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
>
> > On Sep 6, 11:05?pm, Steven D'Aprano <[EMAIL PROTECTED]
> > cybersource.com.au> wrote:
>
> > > Sheesh. That's
On Sep 7, 5:41 pm, Mars creature <[EMAIL PROTECTED]> wrote:
> Hi guys,
> I am new to Python, and thinking about migrating to it from matlab
> as it is a really cool language. Right now, I am trying to figure out
> how to control read and write binary data, like
> 'formatted','stream','big-endian'
Paul Boddie <[EMAIL PROTECTED]> writes:
> On 7 Sep, 23:00, castironpi <[EMAIL PROTECTED]> wrote:
> > I am concerned by the lack of follow-through on some responses to
> > recent ideas I have described. Do I merely have a wrong
> > understanding of group policy?
>
> I think some people have taken
Jackie Wang wrote:
Dear all,
I have the following html code:
Center Bank
Los Angeles, CA
Salisbury
Bank and Trust Company
Lakeville, CT
How should I delete the 'font' tags while keeping the content inside?
See the BeautifulSoup documentation. Find the
On Sep 7, 7:34 pm, MRAB <[EMAIL PROTECTED]> wrote:
> On Sep 7, 11:28 pm, "Eric Wertman" <[EMAIL PROTECTED]> wrote:
>
> > +1 Bot
>
> I think it's like duck typing: it doesn't matter whether he's actually
> a bot, only whether he behaves like one.
Do you support the bot interface and methods?
--
htt
Hi All,
I'm using subprocess.Popen to run a C++ compiler and have set stdout =
PIPE. The exact line of code that I am using is:
process = Popen(command, stdout=PIPE)
status = process.wait()
This works fine until a large amount of data is written to stdout.
When this occurs, my python program see
Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> (btw, I've always thought that Python was all about making it easy to
> express the solution to a given problem in code, not to let you write
> programs without using your brain. when did that change?)
The day Google App Engine was opened up to developer
James McGill wrote:
Is anyone aware of why this might be occurring, or of any ways around
this? Does the PIPE implementation in Win32 have a maximum buffer
size?
pipes always have a limited buffer size, on all platforms. you're
supposed to read data from them as it arrives (e.g. by explicitl
On Sep 8, 7:00 am, castironpi <[EMAIL PROTECTED]> wrote:
> I am concerned by the lack of follow-through on some responses to
> recent ideas I have described. Do I merely have a wrong understanding
> of group policy?
[snip]
Perhaps the wrong idea of what the group is. I would have thought
that
i
Hi all, I'm having some issues getting a spotlight search to work
similar to the program demonstrated here:
http://pyobjc.sourceforge.net/examples/pyobjc-framework-Cocoa/AppKit/PredicateEditorSample/
Here is my class, complete with the code I am trying to use it with at
the end.
import objc, sy
Hi all,
I don't know if this question will fit on this section,
any way my query is , i have used one script demork.py to extract details
from Firefox history.dat file
and now the problem is how to convert the TIMESTAMP given by that to normal
date and time.
example timestams are like this,
120291
75 matches
Mail list logo