Edward Elliott wrote:
> Tab is not 4 spaces. Tab is 1 level of indentation. The confusion that
> tabs equals some fixed width, or can/should be set to some fixed width, is
> the entire problem hampering their use. It implies that conversion between
> tabs and spaces is straightforward when it is
"John Salerno" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thanks, that looks pretty good. Although I have to say, a do/while
> structure is the much more obvious way. I wonder why it hasn't been
> added to the language.
Been suggested many times, been considered, and rejected.
On 5/15/06, Brian Quinlan <[EMAIL PROTECTED]> wrote:
> The problem with tabs is that people use tabs for alignment e.g.
>
> def foo():
>->query = """SELECT *
>-> -> -> FROM sometable
>-> -> -> WHERE condition"""
>
> Now I change my editor to use 8-space tabs and the code is all
Le Lundi 15 Mai 2006 19:24, Roy Smith a écrit :
> d = {}
> d.reserve (10*1000*1000)
d={}.fromkeys(xrange(5*10**6)) ?
--
_
Maric Michaud
_
Aristote - www.aristote.info
3 place des tapis
69004 Lyon
Tel: +33 426 880 097
--
http://mail.python.org/mailman/listinfo/python-li
Peter Decker wrote:
> Funny, I was going to say that the problem is when the author prefers
> a font with a differntly-sized space. Some of us got rid of editing in
> fixed-width fonts when we left Fortran.
Don't know what all of the hub-bub here is regarding tab/space
indentation. My punched car
Peter,
I filed a bug report.
Thanks,
rick
--
http://mail.python.org/mailman/listinfo/python-list
Brian Quinlan wrote:
> The problem with tabs is that people use tabs for alignment e.g.
>
> def foo():
>->query = """SELECT *
>-> -> -> FROM sometable
>-> -> -> WHERE condition"""
Sure it's a problem. When programmers do bad things, what is your response?
Slap his nose and
QOTW: "It seems if you lurk here [on comp.lang.python] long enough you
eventually get all you[r] questions answered without even asking!" - Ted Landis
"We're going to learn from Python. JavaScript is pretty close to Python"
- Brendan Eich
Scott David Daniels shows how to find all occurrenc
Terry Reedy wrote:
> "John Salerno" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> Thanks, that looks pretty good. Although I have to say, a do/while
>> structure is the much more obvious way. I wonder why it hasn't been
>> added to the language.
>
> Been suggested many times, b
"Claudio Grondi" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Chris Foote wrote:
> > Hi all.
> >
> > I have the need to store a large (10M) number of keys in a hash table,
> > based on a tuple of (long_integer, integer). The standard python
> > dictionary works well for small numb
Ken Tilton wrote:
>
>
> Ben wrote:
>
>>
>> Nothing you have described sounds that complicated, and you never come
>> up with concrete objections to other peoples code (apart that it took
>> 10 years to write in Lisp, so it must be really hard)
>
>
> Oh, now I have to spend an hour dissecting
Just a quickie for today: Is it common (and also preferred, which are
two different things!) to create a function that has the sole job of
calling another function?
Example: for fun and exercise, I'm creating a program that takes a quote
and converts it into a cryptogram. Right now I have four
Thomas Dybdahl Ahle <[EMAIL PROTECTED]> writes:
> byte[] array2 = bytes1.CryptDeriveKey("DES", "MD5", 0, array1);
> > Anybody know how to do this in python?
I'm not aware of a standard that says how CryptDeriveKey is supposed
to work. Or rather, there are multiple possible standard ways to do
it.
[I trimmed some of the newsgroups away; this mostly concerns Python and Lisp]
Ken Tilton <[EMAIL PROTECTED]> writes:
> Lasse Rasinen wrote:
> > Ken Tilton <[EMAIL PROTECTED]> writes:
> >
> >>>if any concepts have survived to the Python version. Since Python's object
> >>>model is sufficiently dif
Hello.
I am stuck; provided is the code and error-msg:
file front_ui.py:
class Front(object):
_images = [] # Holds image refs to prevent GC
def __init__(self, root):
# Widget Initialization
self._listbox_1 = Tkinter.Listbox(root,
height = 0,
widt
John Salerno <[EMAIL PROTECTED]> writes:
> So my first question is this: should I make a Cryptogram class for
> this, or are functions fine? If the latter, then back to my original
> point: can I do something like this:
>
> def convert_quote(quote):
> return make_code(quote)
It's fine to do
On Mon, 15 May 2006 18:26:01 GMT,
John Salerno <[EMAIL PROTECTED]> wrote:
> So my first question is this: should I make a Cryptogram class for
> this, or are functions fine? ...
Perhaps I'm "old school," but I don't bother with classes unless I'm
going to end up with multiple instances (or I'm pu
Ronny Mandal schrieb:
> Hello.
>
> I am stuck; provided is the code and error-msg:
>
> file front_ui.py:
>
> class Front(object):
> _images = [] # Holds image refs to prevent GC
> def __init__(self, root):
>
>
> # Widget Initialization
> self._listbox_1 = Tkinter.Listbo
Thanks, but the problem was my undentation, after making one indent,
it worked as expected. :)
-Ronny M
--
http://mail.python.org/mailman/listinfo/python-list
John Salerno wrote:
> ...Is it common ...[and preferred] to create a function that has the sole job
> of
> calling another function?
>
> Example: ... cryptogram. Right now I have four functions:
>
> convert_quote -- the main function that starts it all
> make_code -- makes and returns the crypt
Ronny Mandal wrote:
> file front_ui.py:
>
> class Front(object):
> _images = [] # Holds image refs to prevent GC
> def __init__(self, root):
> # Widget Initialization
> self._listbox_1 = Tkinter.Listbox(root,
> height = 0,
> width = 0,
> ...
>
Maric Michaud schrieb:
> Le Lundi 15 Mai 2006 19:24, Roy Smith a écrit :
>> d = {}
>> d.reserve (10*1000*1000)
>
> d={}.fromkeys(xrange(5*10**6)) ?
That is a totally different beast. You don't want to insert arbitrary
keys, you want the internal hash-array to be of the right size.
Diez
--
http
John Salerno wrote:
> Just a quickie for today
Another quick one I'll combine in this thread: How can I create two
separate conditions in a for loop?
Such as this, which doesn't seem to work beyond string.punctuation:
for char in string.punctuation or string.whitespace:
--
http://mail.python.o
Ronny Mandal schrieb:
> Thanks, but the problem was my undentation, after making one indent,
> it worked as expected. :)
I seriously doubt that. I guess you didn't show us the real code. But
there is no way that an instance variable can be accessed on type-level
in a derived class (or from anywh
Dan Sommers wrote:
> Perhaps I'm "old school," but I don't bother with classes unless I'm
> going to end up with multiple instances (or I'm pushed into a corner by,
> e.g., a GUI framework).
Thanks to all of you! In fact, I sort of came to this same conclusion. I
started with a class, but realiz
John Salerno wrote:
> John Salerno wrote:
>> Just a quickie for today
>
> Another quick one I'll combine in this thread: How can I create two
> separate conditions in a for loop?
>
> Such as this, which doesn't seem to work beyond string.punctuation:
>
> for char in string.punctuation or string
QOTW
"Programming is not just creating strings of instructions for a
computer to execute. It's also 'literary' in that you are trying to
communicate a program structure to other humans reading the code." Paul
Rubin
rpd
--
http://mail.python.org/mailman/listinfo/python-list
Lasse Rasinen wrote:
> [I trimmed some of the newsgroups away; this mostly concerns Python and Lisp]
>
> Ken Tilton <[EMAIL PROTECTED]> writes:
>
>
>>Lasse Rasinen wrote:
>>
>>>Ken Tilton <[EMAIL PROTECTED]> writes:
>>>
>>>
>if any concepts have survived to the Python version. Since Python
John Salerno wrote:
>> How can I create two separate conditions in a for loop?
>...
> I tried this:
>
> punc_space = string.punctuation + string.whitespace
> for char in punc_space:
That's probably best. If the sources are not so simple, you could use:
import itertools
for char in i
Thanks, that was my problem. Can you point me to some documentation on
MySQLdb? I've been googling to get answers and that obviously has not
been working.
In article <[EMAIL PROTECTED]>,
"Wade Leftwich" <[EMAIL PROTECTED]> wrote:
> Works fine for me, and I certainly hope MySQLdb is ready fo
Try these:http://sourceforge.net/docman/?group_id=22307and for the Python DB API overall:http://www.python.org/dev/peps/pep-0249/
LouOn 5/15/06, Lorenzo Thurman <[EMAIL PROTECTED]> wrote:
Thanks, that was my problem. Can you point me to some documentation onMySQLdb? I've been googling to get answer
Scott David Daniels wrote:
> John Salerno wrote:
>>> How can I create two separate conditions in a for loop?
>> ... I tried this:
>>
>> punc_space = string.punctuation + string.whitespace
>> for char in punc_space:
>
> That's probably best. If the sources are not so simple, you could use:
>
>
Alrighty, here is what I've come up with. Any suggestions for tweaks or
speed-boosting efficiency? Just kidding. :)
Maybe the weakest part is how the code is determined (just shuffling the
letters in the alphabet). Perhaps there's a better way? Although it
seems effective to me
import str
Lorenzo Thurman wrote:
> Thanks, that was my problem. Can you point me to some documentation on
> MySQLdb? I've been googling to get answers and that obviously has not
> been working.
I've been looking into this too lately, and finding thorough docs for it
is hard. Have you seen these yet:
htt
John Salerno a écrit :
> Just a quickie for today: Is it common (and also preferred, which are
> two different things!) to create a function that has the sole job of
> calling another function?
(pasted):
> def convert_quote(quote):
> return make_code(quote)
>
> Or does it not make sense
why isn't re.search recognizing "file"? I can print the contents of "file".
import win32com.client
import re
D=MSWord.Documents.Open('C:/test/Test.doc')
file=D.Content
print file
match = re.search('(Table ?)', file)
if match:
print "Table Number is: ", match.group(1)
Traceback (most recen
Paul Rubin a écrit :
> John Salerno <[EMAIL PROTECTED]> writes:
>
>>So my first question is this: should I make a Cryptogram class for
>>this, or are functions fine? If the latter, then back to my original
>>point: can I do something like this:
>>
>>def convert_quote(quote):
>> return make_cod
John Salerno a écrit :
> John Salerno wrote:
>
>> John Salerno wrote:
>>
>>> Just a quickie for today
>>
>>
>> Another quick one I'll combine in this thread: How can I create two
>> separate conditions in a for loop?
>>
>> Such as this, which doesn't seem to work beyond string.punctuation:
>>
>>
Roy Smith:
> I am befuddled as to why
> people thought creating a dict by keyword would be a useful thing to
> do, but left out (and, indeed, eliminated the chance to add the syntax
> later) the obviously useful ability to hint at the size.
Adding the keyword syntax doesn't require much memory to
On 5/15/06, Cameron Laird <[EMAIL PROTECTED]> wrote:
> In article <[EMAIL PROTECTED]>,
> Delaney, Timothy (Tim) <[EMAIL PROTECTED]> wrote:
> .
> .
> .
> >That's exactly my point. Assuming your test coverage is good, such an
> >
Sorry for cross-posting, but this IS a cross-platform issue.
Christian Tismer tismer at stackless.com wrote:
> Sven Suursoho wrote:
>
> >>> Is there any way to rewrite following program to handle returned
> >>> generator without hitting this bug?
>
> The only way I can think of getting aroun
John Salerno a écrit :
> Alrighty, here is what I've come up with. Any suggestions for tweaks or
> speed-boosting efficiency? Just kidding. :)
Too late ! You asked for it, you get it !-)
> Maybe the weakest part is how the code is determined (just shuffling the
> letters in the alphabet). Perha
John Salerno <[EMAIL PROTECTED]> writes:
> def convert_quote(quote):
> coded_quote = make_code(quote)
> author = coded_quote.split('|')[1]
> quote = coded_quote.split('|')[0]
> return quote, author
I think it's a little bit ugly (plus inefficient) to split the quote twice.
You
Bruno Desthuilliers <[EMAIL PROTECTED]> writes:
> def convert_quote(quote):
>return make_code(quote).split('|', 1)
I thought about suggesting that, but it's semantically different than
the original since it fails to raise an error if no vertical bar is
present. I don't know if that's good or
Lance Hoffmeyer a écrit :
> why isn't re.search recognizing "file"? I can print the contents of "file".
>
>
> import win32com.client
> import re
>
> D=MSWord.Documents.Open('C:/test/Test.doc')
> file=D.Content
> print file
>
> match = re.search('(Table ?)', file)
> if match:
>print "Table
Hello,
I am having trouble getting the ThreadingMixIn to do what I want.
Looking over the docs (and some old code I wrote which successfully
does what I want), I arrived at the following:
import time
import SocketServer
import BaseHTTPServer
class TheServer(SocketServer.ThreadingMixIn,
BaseHTTPS
On 5/15/06, Edward Elliott <[EMAIL PROTECTED]> wrote:
> If such tools are lacking, use substitutes in the meantime. Don't allow any
> code to be checked in where a line departs more than one tab indentation
> level from its neighbors. It's not perfect, but it eliminates the worst
> offenses. Go
George Sakkis a écrit :
(snip)
> def length(iterable):
> try: return len(iterable)
> except:
except TypeError:
> i = 0
> for x in iterable: i += 1
> return i
>
(snip)
--
http://mail.python.org/mailman/listinfo/python-list
Hannu Krosing <[EMAIL PROTECTED]> writes:
>> Sven Suursoho wrote:
>>> As for testing in actual pl/python build environment, we had objections
>>> from
>>> leading postgresql Tom Lane that even if we do test it at build time,
>>> a determined DBA may substitute a buggy python.so later and still c
Paul Rubin a écrit :
> Bruno Desthuilliers <[EMAIL PROTECTED]> writes:
>
>>def convert_quote(quote):
>> return make_code(quote).split('|', 1)
>
>
> I thought about suggesting that, but it's semantically different than
> the original since it fails to raise an error if no vertical bar is
> pres
Does anybody know an easy way (or tool) to guess the language of a
given text string?
e.g.
Feeding in "This is an example." --> should return "english" or ISO
code
Feeding in "Das ist ein Beispiel." --> should return "german" or ISO
code
Feeding in "Esto es un ejemplo." --> should return "spanis
Ühel kenal päeval, E, 2006-05-15 kell 17:21, kirjutas Tom Lane:
> Hannu Krosing <[EMAIL PROTECTED]> writes:
> >> Sven Suursoho wrote:
> >>> As for testing in actual pl/python build environment, we had objections
> >>> from
> >>> leading postgresql Tom Lane that even if we do test it at build time
And others (including Fredrik Lundh) have found the same bug, it seems.
http://mail.python.org/pipermail/python-list/2005-September/297157.html
--
http://mail.python.org/mailman/listinfo/python-list
A search to see how many words from the text belong to
english/german/spanish common word dictionaries would be an easy way to
get a crude guess at the language.
--
http://mail.python.org/mailman/listinfo/python-list
Roman wrote:
> Does anybody know an easy way (or tool) to guess the language of a
> given text string?
>
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/355807
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/326576
--
http://mail.python.org/mailman/listinfo/python-list
"Lee Caine" <[EMAIL PROTECTED]> writes:
> Im new to python and am in need of a little help
Possibly also new to command-line shells?
> Im attempting to write a program that finds and replaces text in all
> files in a given directory.
> example of running the program with arguments
> >python
1. Why is two minutes to insert 5M keys "bad" for you? What would be
"good"? What would be good/bad look-up times? Have you measured the
typical look-up time? How often is the dict creation required to be
done? How often does the data change? Is multi-user access required for
(a) look-up (b) updat
Harry George wrote:
> The reason is simple: People get confused, and accidentally get the
> wrong tab indents when they move among editors or among settings on
> the same editor.
People certainly do get confused. I'm always amazed that so many
people, even amongst those who manage to make a livin
Sounds like PyTables could be useful.
http://www.pytables.org
--
lpc
--
http://mail.python.org/mailman/listinfo/python-list
Hey all, in perl I was able to use the same regular expression multiple times
changing one part of it
via a previously defined array and put the results into a new array
IN PERL:
my @targets = ('OVERALL RATING',
'CLOTHING', '
ITEMS',
'ACCESSORIES',
Dear Python experts, I'm a beginner of Python programming. I have a question about Python modules. With the following: = import sys, os, string, math from Numeric import * from Matrix import * = at the beginning of my Python script, it complained that "ImportErr
Shirley Li wrote:
> Dear Python experts,
>
> I'm a beginner of Python programming.I have a question about Python
> modules.
>
> With the following:
> =
> import sys, os, string, math
> from Numeric import *
> from Matrix import *
> =
> at the beginning of my Py
Hi, I've written a top-down recursive decent parser for SPICE circuit
descriptions. For debugging purposes, I wanted each production
rule/function to know what its own name was, so at the beginning of
each rule/function, I make a call to inspect.stack()[0][3] (I think...)
and that fetches the name
Hi,
How would one go about getting sys.argv fom within the context of a C
API extention module? I want to pass it along to C library that I'm
calling from my module code.
TIA~
I'm trying to load the sys module using:
PyObject *_argv = PyImport_ImportModule("sys.argv");
but it is coming back N
Ken Tilton <[EMAIL PROTECTED]> wrote:
+---
| Having the reference implementation is the only thing that makes this
| conceivably doable in a summer. What you are missing is something I have
| often also gotten wrong: the core, cool functionality always comes easy
| in the proof-of-c
[EMAIL PROTECTED]
> Hi, I've written a top-down recursive decent parser for SPICE circuit
> descriptions. For debugging purposes, I wanted each production
> rule/function to know what its own name was, so at the beginning of
> each rule/function, I make a call to inspect.stack()[0][3] (I think...)
Roy Smith wrote:
> In article <[EMAIL PROTECTED]>, Chris Foote <[EMAIL PROTECTED]>
> wrote:
>
>> I have the need to store a large (10M) number of keys in a hash table,
>> based on a tuple of (long_integer, integer). The standard python
>> dictionary works well for small numbers of keys, but star
Aahz wrote:
> In article <[EMAIL PROTECTED]>,
> Roy Smith <[EMAIL PROTECTED]> wrote:
>> In article <[EMAIL PROTECTED]>, Chris Foote <[EMAIL PROTECTED]>
>> wrote:
>>> I have the need to store a large (10M) number of keys in a hash table,
>>> based on a tuple of (long_integer, integer). The standa
> PyObject *_argv = PyImport_ImportModule("sys.argv");
What does the name of the function tell you? You can't do that in one
hit. Start with
PyObject *_sys = PyImport_ImportModule("sys");
then you need to get the module's argv attribute.
However a better design might be have your extension module
John Machin wrote:
> > PyObject *_argv = PyImport_ImportModule("sys.argv");
>
> What does the name of the function tell you? You can't do that in one
> hit. Start with
> PyObject *_sys = PyImport_ImportModule("sys");
> then you need to get the module's argv attribute.
I just figured this out, doh
I am using Python 2.4.3
>>>class K(object,list):
...: pass
...:
Traceback (most recent call last):
File "", line 1, in ?
TypeError: Error when calling the metaclass bases
Cannot create a consistent method resolution
order
[EMAIL PROTECTED] writes:
> >>>class K(object,list):
>...: pass
>...:
>
> Traceback (most recent call last):
> File "", line 1, in ?
> TypeError: Error when calling the metaclass bases
> Cannot create a consistent metho
Guido has proposed a syntax for type annotations in Python-3000.
Example:
def foo(x: t1, y: t2) -> t3:
...body...
http://www.artima.com/weblogs/viewpost.jsp?thread=87182
The types are dynamic and there is significant execution of code prior
to the function body being called. Which tends to
Question for you: what do you think that "class K(object,list):"
means?? What are you trying to achieve? What do you plan to do with K?
If you want it to be a subclass of list, all you have to do is "class
K(list):".
--
http://mail.python.org/mailman/listinfo/python-list
Section 2.3 of the Python 2.5. tutorial
"The following sections describe the standard types that are built into
the interpreter. Historically, Python's built-in types have differed
from user-defined types because it was not possible to use the built-in
types as the basis for object-oriented inheri
In article <[EMAIL PROTECTED]>,
John Salerno <[EMAIL PROTECTED]> wrote:
> http://sourceforge.net/docman/?group_id=22307
Yes, I did, but I did not find them thorough enough.
--
"My Break-Dancing days are over, but there's always the Funky Chicken"
--The Full Monty
--
http://mail.python.org/mai
In article <[EMAIL PROTECTED]>,
Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
> On Mon, 15 May 2006 20:14:29 GMT, John Salerno
> <[EMAIL PROTECTED]> declaimed the following in comp.lang.python:
>
> > Lorenzo Thurman wrote:
> > > Thanks, that was my problem. Can you point me to some documentation
Den Mon, 15 May 2006 11:32:47 -0700. skrev Paul Rubin:
> Thomas Dybdahl Ahle <[EMAIL PROTECTED]> writes:
>> byte[] array2 = bytes1.CryptDeriveKey("DES", "MD5", 0, array1);
>> > Anybody know how to do this in python?
>
> I'm not aware of a standard that says how CryptDeriveKey is supposed
> to work
I don't like string interpolation within REs, it pops me out of 'RE
mode' as I scan the line.
Maybe creating a dict of matchobjects could be used in the larger
context?:
dict( [(t, re.search(t+regexp_tail, file2) for t in targets] )
(untested).
- Pad.
--
http://mail.python.org/mailman/listi
Tim Peters wrote:
> [EMAIL PROTECTED]
> > Hi, I've written a top-down recursive decent parser for SPICE circuit
> > descriptions. For debugging purposes, I wanted each production
...
> > Any clues?
>
> It should go much faster to use a function that doesn't crawl the
> entire call stack. For e
Think about how well the above solutions scale as len(targets)
increases.
1. Make "targets" a set, not a list.
2. Have *ONE* regex which includes a bracketed match for a generic
target e.g. ([A-Z\s]+)
3. Do *ONE* regex search, not 1 per target
4. If successful, check if the bracketed gizmoid is in
Le Lundi 15 Mai 2006 21:07, Diez B. Roggisch a écrit :
> > d={}.fromkeys(xrange(5*10**6)) ?
>
> That is a totally different beast. You don't want to insert arbitrary
> keys, you want the internal hash-array to be of the right size.
But you can replace the xrange part by any generator function you
Would you believe "steps 3 & 4"?
--
http://mail.python.org/mailman/listinfo/python-list
Hi
This is what I'm looking for.
Thank you.
Roman
gene tani schrieb:
> Roman wrote:
> > Does anybody know an easy way (or tool) to guess the language of a
> > given text string?
> >
>
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/355807
> http://aspn.activestate.com/ASPN/Cookboo
[EMAIL PROTECTED] wrote:
> I am using Python 2.4.3
>
class K(object,list):
>...: pass
>...:
>
> Traceback (most recent call last):
> File "", line 1, in ?
> TypeError: Error when calling the metaclass bases
> Canno
Hi, I'm interested in using python to start writing a CAD program for
electrical design. I just got done reading Steven Rubin's book, I've
used "real" EDA tools, and I have an MSEE, so I know what I *want* at
the end of this; I just have never taken on a programming task of this
magnitude. I've s
"Dennis Lee Bieber" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Mon, 15 May 2006 19:41:39 -0500, Lance Hoffmeyer
> <[EMAIL PROTECTED]> declaimed the following in comp.lang.python:
> > I would have something similar to perl above:
> >
> >
> > targets = ['OVERALL RATING',
> >
101 - 187 of 187 matches
Mail list logo