[EMAIL PROTECTED] wrote:
> Have a look at this:
>
-123**0
> -1
>
>
> The result is not correct, because every number (positive or negative)
> raised to the power of 0 is ALWAYS 1 (a positive number 1 that is).
No python is correct. you're expression parses this way, when converted
to a li
Ahem... That should have been:
(negate (pow 123 0))
Using parenthesis to indicate precedence order of ops:
-(123 ^ 0)
The "-" you are using is not part of the number. It's a unary operator
that negates something. In normal order of operations, it has a much
lower priority than power.
Your p
George Sakkis wrote:
> I think you're trying to imply that it is consistent with setting a
> value (same with getting). I guess what bugs me about "del" is that
> it's a keyword and not some universally well-known punctuation. Do you
> you feel that Python misses a "pop" keyword and respective
> ex
Larry Hale wrote:
> Now I *presume* my problem (at this point) is that I need to have
> libmagic named as "magic1.dll" -wherever- this module is looking for
> it. I'm just not sure, let alone if this is true, WHERE Python/
> modules expect to find such things.
>
> Also, which version(s)/file(s) s
at he needs.
Also the 1 day deadline would not be an obstacle. Would it for you?
Ciao, Michael.
--
http://mail.python.org/mailman/listinfo/python-list
I wrote some code to test the precedence of getitem vs getattr; it
shows that getitem binds tighter.
I have been handed some code that relies on the observed behavior.
However, the Nutshell precedence list claims the opposite. Is the
Nutshell wrong or am I missing something or is this a bug?
clas
On Aug 14, 6:01 pm, "Calvin Spealman" <[EMAIL PROTECTED]> wrote:
>
> attribute access (foo.bar) binds more tightly than subscripting (foo[bar]).
That certainly looks right, and in retrospect I wonder that I even
doubted it. But even the official docs seem to me to specify
otherwise:
http://docs.
Dennis Lee Bieber wrote:
> Nasty code even for C... I've never used goto in C... Options:
> convert the statements of next into a function, and put in an else
> clause...
I think the parent post's pseudocode example was too simple to show the
real benefits and use cases of goto in C. Obviou
Kurien Mathew wrote:
> Hello,
>
> Any suggestions on a good python equivalent for the following C code:
>
> while (loopCondition)
> {
> if (condition1)
> goto next;
> if (condition2)
> goto next;
> if (condition3)
> goto next;
> st
Michael Torrie wrote:
> I think the most direct translation would be this:
Nevermind I forgot about the while loop and continuing on after it.
Guess the function doesn't quite fit this use case after all.
--
http://mail.python.org/mailman/listinfo/python-list
HI!
Is there a function in the standard lib which can be used to split a
string containg 'host:port' into a tuple (host,port) and also does this
reliably for IPv6 addresses?
Ciao, Michael.
--
http://mail.python.org/mailman/listinfo/python-list
is deprecated and might vanish
in future versions of python-ldap.
See also Demo/initialize.py in python-ldap's source distribution.
Ciao, Michael.
--
http://mail.python.org/mailman/listinfo/python-list
Manuel Ebert wrote:
On Aug 26, 2008, at 1:31 PM, Michael Ströder wrote:
Is there a function in the standard lib which can be used to split a
string containg 'host:port' into a tuple (host,port) and also does
this reliably for IPv6 addresses?
>
AFAIK port names cannot contain a
from datetime import datetime
# batteries included
today = datetime.now()
xmas = datetime(today.year,12,25)
if (xmas - today).days > 1:
print "%d days until Christmas" % (xmas - today).days
else:
print "Merry Christmas!"
--
http://mail.python.org/mailman/listinfo/python-list
well.
I may be underestimating the difficulties of my proposed approach - I
don't have much practical experience with GUI programming myself.
Best, Michael
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 3, 12:57 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> Michael Palmer schrieb:
>
> > The other, PyGUI, has an even nicer API and more docs but has
> > relatively few widgets implemented at this time. It also strives for
> > compatibility with se
On Sep 3, 1:30 pm, LB <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I would like to freeze a numpy based script in order to have an
> application which could run without having to install numpy and cie.
>
> Indeed, I'm not root on the targeted computer and I can't easily
> make a complete install of numpy
nd the
OpenSSL crypto libs.
Ciao, Michael.
--
http://mail.python.org/mailman/listinfo/python-list
a='/usr/local/lib/'
if a[-1] == '/':
a = list(a)
a.pop()
''.join(a)
Thanks,
Mathieu
How about this:
if a[-1] == '/':
a = a[:-1]
Mike
Hi, how about
a.rstrip('/')
? Michael
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 5, 11:18 am, [EMAIL PROTECTED] wrote:
> Helmut Jarausch:
>
> > I need to hash arrays of integers (from the hash module).
>
> One of the possible solutions is to hash the equivalent tuple, but it
> requires some memory (your sequence must not be tuples already):
why can't it be tuple already
On Sep 5, 9:56 pm, Sean Davis <[EMAIL PROTECTED]> wrote:
> > What I want
> > to do is to provide the python NLP program as a service to any other
> > PHP/Java/Ruby process request. So the mapping is
>
> > http -> apache -> PHP/Java/Ruby/... -> Python NLP
>
> Why not use a simple CGI script or wsgi
I am writing a library that creates temporary files and calls a series
of external programs to process these files. Sometimes these external
programs create files in the same directory as the input files, so to
make sure they are all deleted, one must create them in a temporary
directory, then
Please accept my apologies if this message was posted several times. My
newsreader claimed that a timeout error kept the message from being
posted, but I think it got through.
--
http://mail.python.org/mailman/listinfo/python-list
Michael Hoffman wrote:
unlink = os.unlink
Actually, I need to use shutil.rmtree instead, but you get the idea.
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 7, 6: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'
On Sep 12, 11:08 am, Bojan Mihelac <[EMAIL PROTECTED]> wrote:
> Hi all - when trying to set some dynamic attributes in class, for
> example:
>
> class A:
> for lang in ['1', '2']:
> exec('title_%s = lang' % lang) #this work but is ugly
> # setattr(A, "title_%s" % lang, lang) # t
On Sep 14, 10:53 am, "inhahe" <[EMAIL PROTECTED]> wrote:
> If I gather correctly pickling an object will pickle its entire hierarchy,
> but what if there are certain types of objects anywhere within the hierarchy
> that I don't want included in the serialization? What do I do to exclude
> them?
On Sep 16, 12:30 pm, binaryjesus <[EMAIL PROTECTED]> wrote:
> hi everyone,
> first of all
> I had written an app using pygtk module and created the GUI with
> glade.All the development was done on a linux machine and the app was
> working fine all this tme in linux.
>
> now, the thing is i have to
On Sep 16, 4:07 pm, [EMAIL PROTECTED] wrote:
> I'd like to know if I can somehow find the path for a module somewhere
> in a the package hierarchy
> for instance if I import my module like so
> from spam.eggs import sausage
> my hypothetical method would return something like
> '/home/developer/pro
On Sep 17, 6:17 am, smalltalk <[EMAIL PROTECTED]> wrote:
> >>> import shelve
> >>> sf = shelve.open('e:/abc.db')
> >>> for i in range(1):
>
> ... sf[str(i)]=i
> ...>>> sf.close()
> >>> sf = shelve.open('e:/abc.db')
> >>> sf.clear()
> >>> sf
>
> {}
> the abc.db is always 312k though i have u
On Sep 17, 1:33 pm, Seb <[EMAIL PROTECTED]> wrote:
> I'm making a ssl server, but I'm not sure how I can verify the
> clients. What do I actually need to place in _verify to actually
> verify that the client cert is signed by me?
>
> 50 class SSLTCPServer(TCPServer):
> 51 keyFile = "sslce
On Sep 19, 9:40 am, Alexandru Mosoi <[EMAIL PROTECTED]> wrote:
> i have a generator that raises an exception when calling next(),
> however if I try to catch the exception and print the traceback i get
> only the line where next() was called
>
> while True:
> try:
> iterator.next()
> excep
On Sep 18, 4:24 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> James Matthews wrote:
> > I am wondering what are the major points of twisted over regular python
> > sockets. I am looking to write a TCP server and want to know the pros
> > can cons of using one over the other.
>
> Twisted is a commu
On Sep 18, 5:33 pm, erikcw <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a cgi script where users are uploading large files for
> processing. I want to launch a subprocess to process the file so the
> user doesn't have to wait for the page to load.
>
> What is the correct way to launch subprocess wi
On Sep 22, 4:02 am, Al Kabaila <[EMAIL PROTECTED]> wrote:
> This is a very active newsgroup that incudes such giants as Frederik Lundh
He looks rather small to me in this picture:
http://www.python.org/~guido/confpix/flundh-2.jpg
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 22, 9:13 pm, process <[EMAIL PROTECTED]> wrote:
> Why doesn't Python optimize tailcalls? Are there plans for it?
>
> I know GvR dislikes some of the functional additions like reduce and
> Python is supposedly about "one preferrable way of doing things" but
> not being able to use recursion p
On Sep 23, 7:44 am, Ivan Reborin <[EMAIL PROTECTED]>
wrote:
> On Tue, 23 Sep 2008 04:26:14 -0300, "Gabriel Genellina"
>
> <[EMAIL PROTECTED]> wrote:
>
> >I think scipy does not bundle plotting packages anymore - you may use
> >whatever suits you, from other sources.
> >Try matplotlib, see the wiki:
> > This seems to break the rule that if A is equal to B and B is equal to C
> > then A is equal to C.
>
> I don't see why transitivity should apply to Python objects in general.
Well, for numbers it surely would be a nice touch, wouldn't it.
May be the reason for Decimal to accept float argument
On Sep 23, 10:08 am, Michael Palmer <[EMAIL PROTECTED]> wrote:
> May be the reason for Decimal to accept float arguments is that
NOT to accept float arguments.
--
http://mail.python.org/mailman/listinfo/python-list
Is there any consensus on what the best lightweight web-server is? Or
rather would Twisted be a better choice to choose as a framework that allows
me to serve html or xml data for light webservices. Or is CherryPy just as
good?
--
| _ | * | _ |
| _ | _ | * |
| * | * | * |
--
http://mail.python.o
t;[EMAIL PROTECTED]>wrote:
> On Tue, 23 Sep 2008 21:22:08 -0500, Michael Mabin <[EMAIL PROTECTED]>
> wrote:
>
>> Is there any consensus on what the best lightweight web-server is? Or
>> rather would Twisted be a better choice to choose as a framework that
>>
On Sep 24, 11:46 am, Mike Driscoll <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have been using the following code for over a year in one of my
> programs:
>
> f = urllib2.urlopen('https://www.companywebsite.com/somestring')
>
> It worked great until the middle of the afternoon yesterday. Now I get
> the
On Sep 24, 9:27 pm, Tim Arnold <[EMAIL PROTECTED]> wrote:
> I have a bunch of processes to run and each one needs its own working
> directory. I'd also like to know when all of the processes are
> finished.
>
> (1) First thought was threads, until I saw that os.chdir was process-
> global.
> (2) Ne
AP is possible but AFAIK does
not lead to full Notes users (with mailbox and Notes-ID file).
Ciao, Michael.
--
http://mail.python.org/mailman/listinfo/python-list
cursor.execute("""
SELECT titem.object_id, titem.tag_id
FROM tagging_taggeditem titem
WHERE titem.object_id IN (%s)
""" % ','.join([str(x) for x in [1,5,9]])
On Fri, Sep 26, 2008 at 6:23 AM, Tino Wildenhain <[EMAIL PROT
I laugh in the face of danger.
Give me a use case for an exploit.
On Fri, Sep 26, 2008 at 8:05 AM, Tino Wildenhain <[EMAIL PROTECTED]> wrote:
> Michael Mabin wrote:
>
>> cursor.execute("""
>> SELECT titem.object_id,
Sep 26, 2008 at 10:38 AM, Michael Mabin <[EMAIL PROTECTED]>wrote:
>
>> I laugh in the face of danger.
>>
>> Give me a use case for an exploit.
>>
>
> http://xkcd.com/327/
>
>
--
| _ | * | _ |
| _ | _ | * |
| * | * | * |
--
http://mail.python.org/mailman/listinfo/python-list
hat I happen to do) which won't be run by the general public.
Incidentally, couldn't input field edits prevent such exploits prior to
interpolation?
On Fri, Sep 26, 2008 at 11:38 AM, D'Arcy J.M. Cain <[EMAIL PROTECTED]> wrote:
> On Fri, 26 Sep 2008 11:00:59 -0500
> &
On Sep 25, 8:16 am, "Tim Arnold" <[EMAIL PROTECTED]> wrote:
> "Tim Arnold" <[EMAIL PROTECTED]> wrote in message
>
> news:[EMAIL PROTECTED]
>
> >I have a bunch of processes to run and each one needs its own working
> > directory. I'd also like to know when all of the processes are
> > finished.
>
>
so you wouldn't object then to something like ' in (%)' %
','.join([str_edit_for_exploit(x) for x in aList])
if str_edit_for_exploit applied security edits?
On Fri, Sep 26, 2008 at 2:28 PM, Benjamin Kaplan
<[EMAIL PROTECTED]>wrote:
>
>
>
oops. i meant.
' in (%s)' % ','.join([str_edit_for_exploit(x) for x in aList])
On Fri, Sep 26, 2008 at 5:05 PM, Michael Mabin <[EMAIL PROTECTED]> wrote:
> so you wouldn't object then to something like ' in (%)' %
> &
Steven D'Aprano wrote:
> On Fri, 26 Sep 2008 01:46:15 +0200, Stef Mientki wrote:
>
>> Secondly thoughtless copying of current behavior, doesn't bring any
>> progress,
>> and I think that's one of the reasons why we're still burdened by
>> inventions done 20 years ago,
>> e.g. "do you want to save
ata from the database does not have DROP, ALTER, or CREATE privileges on
that database?
On Sat, Sep 27, 2008 at 9:14 AM, Tino Wildenhain <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Michael Mabin wrote:
>
>> so you wouldn't object then to something like
>>
import commands ?
On Sat, Sep 27, 2008 at 8:06 AM, George Boutsioukis
<[EMAIL PROTECTED]>wrote:
> On Sat, 27 Sep 2008 10:05:01 +0200, Lars Stavholm wrote:
>
> > Hi All,
> >
> > I'm new to this list and hoping that this is not off-topic. If it is,
> > please point me in the right direction.
> >
>
etypes
<<< mimetypes.guess_type("LegalNotices.pdf")
>>> ('application/pdf', None)
-mike
--
Michael E. Crute
http://mike.crute.org
God put me on this earth to accomplish a certain number of things.
Right now I am so far behind that I will never die. --Bill Watterson
--
http://mail.python.org/mailman/listinfo/python-list
e this as if it were input by a user that might be a
hacker? This seems retarded and paranoid to me. And where in that post
does it say that the list is from web input? Although to be fair maybe most
of the Python community is doing web development.
Thanks for the stimulating and educational
retty similar to what the file command does but is
probably a better approach if you have to support multiple platforms.
-mike
--
Michael E. Crute
http://mike.crute.org
God put me on this earth to accomplish a certain number of things.
Right now I am so far beh
Tino, dude, I'm afraid I lied about my previous post being the last word.
There are some things you said here that must be addressed.
On Sun, Sep 28, 2008 at 6:00 AM, Tino Wildenhain <[EMAIL PROTECTED]> wrote:
> Michael Mabin wrote:
>
>> I'm exhausted, so I'l
r(random_number[3])
>>> + str(random_number[4])
>>>
>>>
>>
>> '%05i'%random.randint(0,9)
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
> This produces numbers other than 5 digit numbers. making the start
>
Sadly no. There is no utterance too inconsequential.
On Sun, Sep 28, 2008 at 3:10 PM, Steve Holden <[EMAIL PROTECTED]> wrote:
> Michael Mabin wrote:
> > Tino, dude, I'm afraid I lied about my previous post being the last
> > word. There are some things you said h
rst cgi
program. When you're comfortable with basic cgi you might want to look
into a framework like Django or CherryPy.
-mike
[1] http://docs.python.org/lib/module-cgi.html
--
____
Michael E. Crute
http://mike.crute.org
God put me on this earth to accomplish a cert
Blubaugh, David A. wrote:
> Thank You!!
>
> I am still new to Python!!
>
> David Blubaugh
As you've already noticed, plenty of folks here on the list are ready
help you out with issues the crop up as you learn python. So keep on
asking questions as you need assistance.
In the future, please
[EMAIL PROTECTED] wrote:
> I have implemented a simple Python XMLRPC server and need to call it
> from a C/C++ client. What is the simplest way to do this? I need to
> pass numerical arrays from C/C++ to Python.
Which do you need, C or C++? They are two different languages with
different possibil
Lawrence D'Oliveiro wrote:
> In message <[EMAIL PROTECTED]>, Grant
> Edwards wrote:
>
>> On 2008-09-23, Blubaugh, David A. <[EMAIL PROTECTED]> wrote:
>>
>>> I was wondering if anyone has come across the issue of not being allowed
>>> to have the following within a Python script operating under Lin
1, 4, 9, 16, 25, 36, 49, 64, 81],
[ 0, 1, 4, 9, 16, 25, 36, 49, 64, 81],
[ 0, 1, 4, 9, 16, 25, 36, 49, 64, 81],
[ 0, 1, 4, 9, 16, 25, 36, 49, 64, 81],
[ 0, 1, 4, 9, 16, 25, 36, 49, 64, 81]])
>>>
Michael
--
http://mail.python.org/mailman/listinfo/python-list
> Indentation
> makes all kinds of inlined code extremely clumsy or practically impossible
> in Python.
This is the only sensible argument against the indentation thing I've
heard. Python squirms about being inlined in a presentation template.
Making a direct competitor to PHP in pure Python is pr
While the new one is much better than the old website, the logo strikes
me as awful.
I tried to suggest repurposing the much better PyCon logo, but it
didn't raise the vast groundswell of support I wanted it to. But for
whatever its worth I'll try again. My rant is here:
http://tinyurl.com/rkq3s
> No one
> of the complainers and negativists do claim that they could do it much
> better.
Indeed, I do not have to be able to write a particular program to
notice it has bugs.
On the other hand, (since I think the design, while not brilliant, is
good) fixing the logo is something that can be ac
I think I agree with Steve here.
I suspect you should either have sufficiently trained your users in
Python, or have limited them to one-line statements which you could
then strip of leading whitespace before passing them to Python, or even
offered the alternative of one or the other. This would n
lade interface files (the raw XML Glade
saves your interfaces as) and then connect to various signals, access
the widgets, etc.
About as fast as anything I've found. Much slicker than VB (the only
previous RAD experience I'd had that I could actually do anythin in).
- Mich
5, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]
>>>
In this case, pyarray.ndlist behaves the same as numpy.array
Michael
--
http://mail.python.org/mailman/listinfo/python-list
od of the iterator
returned by enumerate() returns a tuple containing a count (from zero) and the
corresponding value obtained from iterating over iterable. enumerate() is
useful
for obtaining an indexed series: (0, seq[0]), (1, seq[1]), (2, seq[2]),
New
in version 2.3
Michael
--
http://mail.python.org/mailman/listinfo/python-list
e why this should be a
problem here. Interestingly, the problem disappears when I put the code
in m1 in a real main() function instead of "if __name__" etc. Though
this seems to solve my problem, I still want to understand what's
happening.
Thanks,
michael
m1.py:
eally see why this should be a
problem here. Interestingly, the problem disappears when I put the code
in m1 in a real main() function instead of "if __name__" etc. Though
this seems to solve my problem, I still want to understand what's
happening.
Thanks,
michael
m1.
main__" module free from stuff that
has to be imported by others. Would a module global.py (defining glob
and imported by whoever needs it) be more pythonic? (I didn't want to do
that because I really want to resist the temptation of introducing
glob1, glob2, glob3...)
michael
The name isn't changing, so it's a "make lemonade" situation.
What's the best use we can make of the name; how do we make it stick in
people's minds positively? How do we make a positive image out of it?
Shy tadpoles, by the way, ( http://python.org/images/python-logo.gif )
isn't it.
mt
--
ht
I like cheeseshop just fine, but have been a Monty Python fan since
they appeared on the CBC in, I think, 1969. I'm one of those people who
is always surprised when a MP bon mot is greeted with confusion and the
suspicion that I have finally lost my mind altogether. So...
If we are moving to the s
to
just changing one reference in a stylesheet.
Michael
--
http://mail.python.org/mailman/listinfo/python-list
27;abba', 'abbb', 'abbc', 'abbd',
'abc', 'abca', 'abcb', 'abcc', 'abcd', 'abd', 'abda', 'abdb', 'abdc',
...
'dcdc', 'dcdd', 'dd', 'dda', 'ddb', 'ddc', 'ddd', 'dda', 'ddaa', 'ddab',
'ddac',
'ddad', 'ddb', 'ddba', 'ddbb', 'ddbc', 'ddbd', 'ddc', 'ddca', 'ddcb', 'ddcc',
'ddcd', 'ddd', 'ddda', 'dddb', 'dddc', '']
If you want the list sorted by length, as in your example:
>>> sorted(_, key=len)
['a', 'b', 'c', 'd', 'aa', 'ab', 'ac', 'ad', 'aa', 'ab', 'ac', 'ad', 'aa',
'ab',
'ac', 'ad', 'ba', 'bb', 'bc', 'bd', 'ba', 'bb', 'bc', 'bd', 'ba', 'bb', 'bc',
'bd', 'ca', 'cb', 'cc', 'cd', 'ca', 'cb', 'cc', 'cd', 'ca', 'cb', 'cc', 'cd',
'da', 'db', 'dc', 'dd', 'da', 'db', 'dc', 'dd', 'da', 'db', 'dc', 'dd', 'aaa',
'aab', 'aac', 'aad', 'aba', 'abb', 'abc', 'abd', 'aca', 'acb', 'acc', 'acd',
'ada', 'adb', 'adc', 'add', 'aaa', 'aab', 'aac', 'aad', 'aaa', 'aab', 'aac',
'aad', 'aba', 'abb', 'abc', 'abd', 'aba', 'abb', 'abc', 'abd', 'aca',
HTH
Michael
--
http://mail.python.org/mailman/listinfo/python-list
x27;ve found myself to be more productive with GTK (both
PyGTK and GTKmm) than with any other system I've used (with the
possible exception of web interfaces).
- Michael
--
mouse, n: a device for pointing at the xterm in which you want to type.
-- Fortune
--
http://mail.python.org/mailman/listinfo/python-list
er I've
seen, any language, period. Only 2 things that it's missing (and I know
of no debugger that does them): Seamless debugging across C/C++ and
Python code, and going backwards.
- Michael
--
mouse, n: a device for pointing at the xterm in which you want to type.
-
;bbc', 'bbd', 'bca', 'bcb', 'bcc', 'bcd',
'bda', 'bdb', 'bdc', 'bdd', 'caa', 'cab', 'cac', 'cad', 'cba', 'cbb', 'cbc',
'cbd', 'cca', 'ccb', 'ccc', 'ccd', 'cda', 'cdb', 'cdc', 'cdd', 'daa', 'dab',
'dac', 'dad', 'dba', 'dbb', 'dbc', 'dbd', 'dca', 'dcb', 'dcc', 'dcd', 'dda',
'ddb', 'ddc', 'ddd', '', 'aaab', 'aaac', 'aaad', 'aaba', 'aabb', 'aabc',
'aabd', 'aaca', 'aacb', 'aacc', 'aacd', 'aada', 'aadb', 'aadc', 'aadd', 'abaa',
...
'dbcb', 'dbcc', 'dbcd', 'dbda', 'dbdb', 'dbdc', 'dbdd', 'dcaa', 'dcab', 'dcac',
'dcad', 'dcba', 'dcbb', 'dcbc', 'dcbd', 'dcca', 'dccb', 'dccc', 'dccd', 'dcda',
'dcdb', 'dcdc', 'dcdd', 'ddaa', 'ddab', 'ddac', 'ddad', 'ddba', 'ddbb', 'ddbc',
'ddbd', 'ddca', 'ddcb', 'ddcc', 'ddcd', 'ddda', 'dddb', 'dddc', '']
>>>
HTH
Michael
--
http://mail.python.org/mailman/listinfo/python-list
;
fingerprint, and then providing username/password as its credentials,
is any less secure than SSH with password/keyboard-interactive. Sure,
maybe not quite as secure as SSH w/ public key auth, but it's good
enough for a lot of stuff.
- Michael
--
mouse, n: a device for pointing at the xterm in which you want to type.
-- Fortune
--
http://mail.python.org/mailman/listinfo/python-list
entation of a line or a block.
>
> In addition, I have seen quite a few editors, which are definitely not
> what I want.
>
> Thank you so much for suggestions.
>
Give Komodo (http://www.activestate.com/Products/Komodo/?mp=1) a try.
Michael
--
http://mail.python.org/mailman/listinfo/python-list
ings e.g.,:
>>> def get_names_of(obj, ns):
... return [name for name, value in ns.iteritems() if value is obj]
...
>>> class A(object):
... def global_names_bound_to_me(self):
... return get_names_of(self, globals())
...
>>> a = A()
>>> a.g
Paul, thanks for the enlightening intro to pyparsing!
We don't really know what the application is (I suspect it's homework),
but whether it's homework or a real-world one-off this all seems like
overkill to me. There's a time for elegance and a time for quick and
dirty. Assuming line oriented inp
second = str(self._count)
return "%s%s%s" % (level, second, rest)
def replace(self, source):
return self.line_pattern.sub(self.sub, source)
>>> r = ReplacePtSubNumber()
>>> print r.replace(source_text)
A. Title Text
1. Title Text
2. Title Text
3. Title Text
B. Title Text
1. Title Text
2. Title Text
HTH
Michael
--
http://mail.python.org/mailman/listinfo/python-list
This behavior seems to be commonly wanted by people discovering Python,
and it is the rare case of something one can imagine that is really a
stretch to achieve in Python. Because more or less than one name may
refer to an object, in general an object can't know its name.
You can get part of the w
u're done with your homework (?), you can compare it with
> Guido's solution:
>
> http://svn.python.org/view/python/trunk/Demo/scripts/queens.py
>
>
>
>
>
Or, Tim Peters' generator-based one:
http://svn.python.org/view/python/trunk/Lib/test/test_generators.py
Michael
--
http://mail.python.org/mailman/listinfo/python-list
> What were you planning to do with this object exactly that didn't involve
> binding it to any other names during its lifetime?
Nothing so silly as that.
The idea is not to prevent other references from binding to the object,
but to allow the object to ensure that a certain symbol always points
I'd appreciate an explanation of why this doesn't work and any
workarounds.
It's not a showstopper, but I'd like to pseudo-inherit a bunch of magic
methods from an attribute, and would prefer to abstract the definitions
into a loop rather than write them all out.
thanks
mt
###
import ne
quot;")
WHITE = string.whitespace
def compare(a,b):
"""Compare two strings, disregarding whitespace -> bool"""
return a.translate(NULL, WHITE) == b.translate(NULL, WHITE)
Here, str.translate deletes the characters in its optional second argument.
{1: None, 3: None, 9: None, 5: None, 7: None}
Note the values, are irrelevant - we care only about the keys
Now, membership testing takes linear time:
>>> [item for item in ls2 if item in d1]
[3, 5, 7]
>>>
But, as you say, this approach is unnecessary, given sets.
HTH
Michael
--
http://mail.python.org/mailman/listinfo/python-list
Olivier Langlois wrote:
> Hi Michael!
>
> Your suggestion is fantastic and is doing exactly what I was looking
> for! Thank you very much.
> There is something that I'm wondering though. Why is the solution you
> proposed wouldn't work with Unicode strings?
>
Simp
Alex Martelli wrote:
> Michael Spencer <[EMAIL PROTECTED]> wrote:
>>
>> Here, str.translate deletes the characters in its optional second argument.
>> Note that this does not work with unicode strings.
>
> With unicode, you could do something strictly equ
c.co_freevars, c.co_cellvars)
@thunk
def simple_test():
a = 4
b = 2
return c*a+b
Then usage is:
>>> d = {"__builtins__":None, "c":10}
>>> eval(simple_test, d)
42
>>> d
{'__builtins__': None, 'a': 4, 'c': 10, 'b': 2}
>>>
Use at your peril!
Michael
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
>
>>>> " hello world ".split()
> ['hello', 'world']
a.split() == b.split() is a convenient test, provided you want to normalize
whitespace rather than ignore it. I took the OP's requirements to mean that
'A
Thanks! Only a minor correction: the last line should be
_setdelegate(myint, int,'__%s__' % spec)
The business with f.func_name struck me as unnecessary, but I was quite
wrong.
This was an interesting exercise for me. Thanks.
Michael
--
http://mail.python.org/mailman/listi
Still a bit confused actually. Any explanation of the following?
mt
def getf(method,name):
def f(self, *a, **k): return method(self.val, *a, **k)
f.func_name = name
return f
class myint(object):
def __init__(self, val):
self.val = int(val)
for spec in 'str repr has
I think this is great work but imagine what you could do with a real
logo!
Besides the pleasant colors what do you like about it?
I have in mind something with a coil motif but I can't execute it worth
a damn.
mt
--
http://mail.python.org/mailman/listinfo/python-list
4101 - 4200 of 5018 matches
Mail list logo