I often use
if 0:
bunch of lines of code
That way, it's very easy to reenable the code, or to add an else, etc.
I can even put things like 'if 0 and USE_FOO_FEATURE' to document what
is being commented out. It's much more flexible than commenting out.
--
Want to play tabletop RPGs over the i
If I want to write my code in a separate text editor (I like UltraEdit)
but then press a single button to have that code run in the IDLE
environment, is that possible? I know that you can configure UE to run
external tools, but I can't figure out how to run IDLE this way, because
when I check o
On 29 Mar 2006 05:06:10 -0800, rumours say that "Thomas W"
<[EMAIL PROTECTED]> might have written:
>How can I use python to find images that looks quite similar? Thought
>I'd scale the images down to 32x32 and convert it to use a standard
>palette of 256 colors then compare the result pixel for pi
Jed Parsons wrote:
> Am I somehow accumulating a growing list of loggers by having this code
> at the top of a zope Extension?
I'd rather look after the number of handlers which is probably growing and
causing your problem. Normally it shouldn't matter how often you repeat
the logging.getLogger(n
Alejandro Dubrovsky <[EMAIL PROTECTED]> writes:
> John J. Lee wrote:
>
> > FWIW, at a glance, Python 2.3.4 has neither of the bugs I mentioned,
> > but the code I posted seems to work with 2.3.4. I'm not particularly
> > interested in what's wrong with 2.3.4's version or your usage of it
> > (pr
In wxPython I install a top-level exception handler to intercept
exceptions and display them in the GUI.
With Tkinter, I'm trying to do the same.
in __init__
sys.excepthook = self.ExceptionHandler
def ExceptionHandler(self, type, value, tb):
tblist = traceback.format_tb(tb)
Jed Parsons wrote:
> Thanks, Peter and alex23,
>
> The metalog test shows that the code is only being executed once at a time.
>
> And if I take those lines and put them in a shell script (fixing the
> FileHandler - sorry about the bad copy there), they work as expected,
> producing a single lo
Carl Banks wrote:
> Ron Adam wrote:
>> Carl Banks wrote:
>>
>>> In Python, yes and no are the only possible answers. Probably the only
>>> analogous thing you could do in Python would be for all() to raise
>>> ValueError when passed an empty sequence.
>> There is also 'None' which serves a similar
lol!
--
http://mail.python.org/mailman/listinfo/python-list
What do you want to search for in the file?
how big is the file?
What format is the data in the file?
- Paddy.
--
http://mail.python.org/mailman/listinfo/python-list
John Salerno wrote:
> If I want to write my code in a separate text editor (I like UltraEdit)
> but then press a single button to have that code run in the IDLE
> environment, is that possible? I know that you can configure UE to run
> external tools, but I can't figure out how to run IDLE this
Paul Rubin wrote:
> "Terry Reedy" <[EMAIL PROTECTED]> writes:
>> 1. It is pure duplication that *adds* keystrokes.
>>
> Nobody says you shouldn't use list(s) if you know you're dealing with
> a set. The idea of s.values() is so you can duck-type between dicts
> and sets.
You could just do the fol
Oops, I'm afraid I replied to Brian only instead of to the whole distribution list. I copy the message I sent to him so that everyone can read it:I'm afraid I cannot use the zlib library provided by Python, since
the ZIP files I'm supposed to send must be password-protected, and I
haven't been able
I am presently looking at a commercial product called dbqwiksite. I
generates php code.
I know that sounds lame, but the demos were impressive.
If I could get the product to work like they show in the demos it would
be great.
It uses ODBC to connect to a mysql database; but I can't get it to wor
I am presently looking at a commercial product called dbqwiksite. I
generates php code.
I know that sounds lame, but the demos were impressive.
If I could get the product to work like they show in the demos it would
be great.
It uses ODBC to connect to a mysql database; but I can't get it to wor
Hello,
I am trying to write a script that takes strings from a text file and searches to see if they are present in another text file...here is the code:
import osimport re
search = open("c:\python24\scripts\pii\expected_rules_results.txt")
def find(x): file = open("c:\python24\scripts\pii\dav
[EMAIL PROTECTED] wrote:
> Like in C we comment like
> /*
> Bunch of lines of code
> */
>
scite has a feature where you modify your delimiter in block comments,
i.e. what comes after "#"
http://scintilla.sourceforge.net/SciTEDoc.html
--
http://mail.python.org/mailman/listinfo/python-list
I used a python api for the linkpoint.com processor a few years ago
I think they still have the python api
--
http://mail.python.org/mailman/listinfo/python-list
> For example, I've never seen an "object-relational mapping" (technical
> term for cruft that tries to avoid people having to learn and use SQL)
> which doesn't drive me into a murderous, foam-at-mouth rage in a very
> short time -- I *WANT* my SQL, I *LOVE* SQL, it's *WAY* more powerful
> and sui
Ben Cartwright wrote:
> [EMAIL PROTECTED] wrote:
> > I like to define a big dictionary in two
> > files and use it my main file, build.py
> >
> > I want the definition to go into build_cfg.py and build_cfg_static.py.
> >
> > build_cfg_static.py:
> > target_db = {}
> > target_db['foo'] = 'bar'
> >
>
Ben Finney wrote:
> [EMAIL PROTECTED] writes:
>
> > I'm fairly new to python. I like to define a big dictionary in two
> > files and use it my main file, build.py
> >
> > I want the definition to go into build_cfg.py and build_cfg_static.py.
>
> That sounds like a very confusing architecture, and s
here is a sample of a .txt file :
I want to search for the whole number. If possible, fuzzy search would
be nice too, but not mandatory..
1975|Y|35136|72|1927|||3|005503|003|19870301|19950301|14416887|151|2301|100039292|N|84|F|50||10|A|100|Y|037|Y|89005|3042|M|S|P|
Thanks!
Jack
--
http://mai
here is a sample of a .txt file :
I want to search for the whole number. If possible, fuzzy search would
be nice too, but not mandatory..
1975|Y|35136|72|1927|||3|005503|003|19870301|19950301|14416887|151|2301|100039292|N|84|F|50||10|A|100|Y|037|Y|89005|3042|M|S|P|
Thanks!
Jack
--
http://mai
Ed Singleton wrote:
> On 30 Mar 2006 16:30:24 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >
> > What are you saying? Ideas must come only from those
> > with the time and skill to implement them? No one else
> > need apply?
>
> Ideas can come from anyone and they do come from anyone all
[EMAIL PROTECTED] wrote:
> > "Ed" == Ed Singleton <[EMAIL PROTECTED]> writes:
>
> Ed> Go to the wiki, make the changes you want, and feel good about
> Ed> yourself for once.
>
> +1 QOTW.
I suggest leaving off the "for once". Otherwise, it is just
another gratuitous insult, of the kin
what i do is open idle, import the codefile i've begun to write, and
then write a function:
def r():
reload(codefile)
then when I want to run it after changes, I just call the function
manually in idle.
--
http://mail.python.org/mailman/listinfo/python-list
Ravi Teja wrote:
>> ... I've never seen an "object-relational mapping" (technical term for
>> cruft that tries to avoid people having to learn and use SQL) which
>> doesn't drive me into a murderous, foam-at-mouth rage in a very
>> short time -- I *WANT* my SQL, I *LOVE* SQL, it's *WAY* more powerf
"Karthik Gurusamy" <[EMAIL PROTECTED]> writes:
> Ben Finney wrote:
>> That sounds like a very confusing architecture, and smells very
>> much like some kind of premature optimisation. What leads you to
>> that design? It's very likely a better design can be suggested to
>> meet your actual require
Christos Georgiou wrote:
> I did make a module based on imgseek, and together with PIL,
> I manage my archive of email attachments (it's incredible how many
> different versions of the same picture people send you: gif, jpg
> in different sizes etc) and it works fairly well.
>
> E-mail me if
Thanks, Kent and Peter,
Definitely making progress here. I've got propagate = 0, and am testing
for handlers before doing any addHandler business. (The handlers test
seems to make the most difference.)
I'm down to two entries per time now! And prodding Zope to reload the
module doesn't ca
Kent Johnson wrote:
> John Salerno wrote:
>> If I want to write my code in a separate text editor (I like UltraEdit)
>> but then press a single button to have that code run in the IDLE
>> environment, is that possible? I know that you can configure UE to run
>> external tools, but I can't figure
Ok, I'm stuck on another Python challenge question. Apparently what you
have to do is search through a huge group of characters and find a
single lowercase character that has exactly three uppercase characters
on either side of it. Here's what I have so far:
pattern = '([a-z][A-Z]{3}[a-z][A-Z]{
John Salerno wrote:
> Ok, I'm stuck on another Python challenge question. Apparently what you
> have to do is search through a huge group of characters and find a
> single lowercase character that has exactly three uppercase characters
> on either side of it. Here's what I have so far:
>
> patt
In Python,
When using the default except (like following)
try:
some code that might blow up
except:
print "some error message"
Is there a way to show what error it is throwing?
Like in Java, you can do
catch (Exception e){
System.out.println(e);
}
Or something like that.
Is there
Em Sex, 2006-03-31 às 15:51 -0800, kbperry escreveu:
> Is there a way to show what error it is throwing?
>
> Like in Java, you can do
> catch (Exception e){
> System.out.println(e);
> }
>
> Is there an equivalent way to do this in Python?
>>> try:
... print 1/0
... except Exception, e:
.
kbperry wrote:
> In Python,
> When using the default except (like following)
>
> try:
> some code that might blow up
>
> except:
> print "some error message"
>
>
> Is there a way to show what error it is throwing?
>
> Like in Java, you can do
> catch (Exception e){
> System.out.println
[EMAIL PROTECTED] wrote:
> Ed Singleton wrote:
> >
> > Ideas can come from anyone and they do come from anyone all the time,
> > and as such they are fairly worthless unless acted upon.
>
> That is pretty obvious. The question is about who does
> the acting. Your position seems to be that
> only
Ron Adam <[EMAIL PROTECTED]> writes:
> The 'not not S' is just a conversion to bool. Is the following less
> contorted to you?
>
> >>> bool([])
> False
Oh ok. Yes, bool(S) is much less contorted than "not not S".
> 'Is all True' isn't the same as 'Has all True'. As I said, I'm not
> questioni
Finding similar images is not at all a trivial task. Entire PhD
dissertations have been committed to it. The solutions are still very
unreliable as of yet. If you want to find more, you can read the
research out of the ongoing Image CLEF track. I worked with them
briefly a couple of years ago in co
[kbperry wrote]
> In Python,
> When using the default except (like following)
>
> try:
> some code that might blow up
>
> except:
> print "some error message"
>>> try:
... 1/0
... except:
... import traceback
... traceback.print_exc()
...
Tracebac
Here's a wrapper for V4L.
http://antonym.org/libfg
--
http://mail.python.org/mailman/listinfo/python-list
In using a simple smtp routine:
# begin example
>>> import smtplib
>>> server = smtplib.SMTP('outgoing.verizon.net')
>>> server.sendmail('[EMAIL PROTECTED]', '[EMAIL PROTECTED]',
"""To: [EMAIL PROTECTED]
From: [EMAIL PROTECTED]
Subject: Shakespeare Quote
Tis like the breath of an unfeed lawyer...
John Salerno wrote:
> Ok, I'm stuck on another Python challenge question. Apparently what you
> have to do is search through a huge group of characters and find a
> single lowercase character that has exactly three uppercase characters
> on either side of it. Here's what I have so far:
>
> pattern
"""there is threee directories,one of these is used for the base
directory,decided by the user, default is d0"""
import shutil
#the three directories
d0='D:/Program Files/eb/mb/S'
d1='O:/eb/mb/S'
d2='P:/S/eb/mb/S'
#to backup
def update(base):
l=[d0,d1,d2]
l.remove(base)
On 31 Mar 2006 18:20:27 -0800, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> In using a simple smtp routine:
>
> # begin example
> >>> import smtplib
> >>> server = smtplib.SMTP('outgoing.verizon.net')
> >>> server.sendmail('[EMAIL PROTECTED]', '[EMAIL PROTECTED]',
> """To: [EMAIL PROTECTED]
> Fro
Justin Azoff wrote:
> John Salerno wrote:
>> Ok, I'm stuck on another Python challenge question. Apparently what you
>> have to do is search through a huge group of characters and find a
>> single lowercase character that has exactly three uppercase characters
>> on either side of it. Here's what I
I'm having some problems getting the logging module to work with the
threading module. I've narrowed the problem down to the following
code:
import logging, threading
update_log = logging.getLogger('update_log')
update_log.addHandler(logging.FileHandler("/tmp/update_log"))
class dlThread(thread
Agreed. Mine was hardly a complete list.
Another bit I lost is keeping data operations close to the database. I
am more likely to use multiple languages/frameworks over the same
database than change databases for the same application. I actually
prefer functions and procedures within the DB (even
Can I use Pickle to store about 500,000 key value pairs.. or should I
use mySql. Which one is best for performance, as the key value pair
increases.
Thanks
--
http://mail.python.org/mailman/listinfo/python-list
Can someone explain to me how this works:
def printBackward(list):
if list == None: return
head = list
tail = list.next
printBackward(tail)
print head,
>>> printBackward(node1)
3 2 1
The printable value of node1 is 1, node2 is 2 and node 3 is 3.
node1.next is node2, node2.next
[EMAIL PROTECTED] writes:
> Can I use Pickle to store about 500,000 key value pairs.. or should I
> use mySql. Which one is best for performance, as the key value pair
> increases.
That's an awfully large pickle. Maybe you want shelve. If there
are frequent updates, multiple clients, etc., then
John Salerno wrote:
> The printable value of node1 is 1, node2 is 2 and node 3 is 3.
>
> node1.next is node2, node2.next is node3 and node3.next is None.
>
> This might be painfully obvious, but I don't understand when the print
> statement is getting called. If you call printBackward with node1, t
So, Is Shelve a perfect solution (besides Mysql), to store large
key/value pairs, and which are updated frequently by multiple clients.
Thanks
Paul Rubin wrote:
> [EMAIL PROTECTED] writes:
> > Can I use Pickle to store about 500,000 key value pairs.. or should I
> > use mySql. Which one is best f
> "Jack" == Jack <[EMAIL PROTECTED]> writes:
> Hi I have a lot of data that is in a TEXT file which are numbers
> does anyone have a good suggestion for indexing TEXT numbers
> (zip codes, other codes, dollar amounts, quantities, etc). since
> Lucene and other indexers are real
[EMAIL PROTECTED] writes:
> So, Is Shelve a perfect solution (besides Mysql), to store large
> key/value pairs, and which are updated frequently by multiple clients.
No, shelve is for use within a single process. With multiple clients
and frequent updates, you need a real database and some knowle
>
> But what you overlook is SQL's strength:
>
> SQL can be translated into _very_ efficient query plans w/o changing
> the SQL. SQL's query optimizers (more properly, de-pessimizers) give
Premature optimization is the root of all evil.
On the top level of an appliciation the goal is to o
Programing Languiges Are Ment to be free. That is why i am starting The
Coo De Tar thats french for Blow of state it is a flash/java
alternative and if you are going to use a server side languige use
Perl,Python or better yet Ruby. What is the point of a languige without
a standerd and without a op
A Propriatary Languige Is An Oxymorron A propriatary OS is An
Oxymoron Take Pro-DOS for example A Knock-off of MS-DOG, the worst
operating system it did not use ONE IOTA OF MS CODE BUT IT was a
sucsefull knockoff. same thing will happen to JAVA
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Programing Languiges Are Ment to be free. That is why i am starting The
> Coo De Tar thats french for Blow of state it is a flash/java
> alternative and if you are going to use a server side languige use
> Perl,Python or better yet Ruby
John,
If your file has the .py or .pyc extension on it, it should just run at
the command line from its own directory, assuming your environment and
path variables are set correctly.
I use NoteTab which has a different way of doing it, but basically you
should be able to run:
c:\mydir>script.py
Jed Parsons wrote:
>
> Thanks, Kent and Peter,
>
> Definitely making progress here. I've got propagate = 0, and am testing
> for handlers before doing any addHandler business. (The handlers test
> seems to make the most difference.)
>
> I'm down to two entries per time now! And prodding Zop
Thanks guys! I appreciate the help.
I have a Python book, but it didn't mention this at all. I also tried
looking through the online docs to no avail.
--
http://mail.python.org/mailman/listinfo/python-list
John Salerno wrote:
> Kent Johnson wrote:
>>You probably don't need to do that. Just run the file in python
>>directly. I don't know UE, but when you configure an external tool, tell
>>it to run python.exe and pass the current file as a command line parameter.
>>
> I've tried a lot of combinatio
On 31 Mar 2006 20:59:16 -0800, [EMAIL PROTECTED] wrote, quoted or
indirectly quoted someone who said :
>Programing Languiges Are Ment to be free. That is why i am starting The
>Coo De Tar thats french for Blow of state it is a flash/java
>alternative and if you are going to use a server side langu
Perhaps what you have said is correct. But XML is more direct for
programmers and readers in my view point.
bayerj 写道:
> Mind, that XML documents are not more flexible than RDBMS.
>
> You can represent any XML document in a RDBMS. You cannot represent any
> RDBMS in an XML document. RDBMS are (st
I V wrote:
> Note that print gets called after _each_ time that printBackward
> returns. So, as the different calls to printBackward return, they print
> whatever 'head' was set to in that invocation. Now, logically enough,
> the last call to printBackward is the first to return, so the last
> va
Kent Johnson wrote:
> John Salerno wrote:
>> Kent Johnson wrote:
>>> You probably don't need to do that. Just run the file in python
>>> directly. I don't know UE, but when you configure an external tool, tell
>>> it to run python.exe and pass the current file as a command line parameter.
>>>
>>
"kbperry" <[EMAIL PROTECTED]> writes:
> In Python,
> When using the default except (like following)
>
> try:
> some code that might blow up
>
> except:
> print "some error message"
This will catch *every* exception, and throw it away before it gets to
your "print" statement.
This is almo
On Fri, 31 Mar 2006 16:29:00 -0800, Paul Rubin wrote:
> I think "S and all(S)" is the right way to express that, if that's
> what's intended.
I still would like a standard function, because "S and all(S)" does not
work with iterators. I proposed one possible function, truecount(S), that
returns a
The list.sort() method accepts a "key=" parameter to let you specify a
function that will change the way it sorts. In Python 2.5, min() and
max() now accept a "key=" parameter that changes how the functions decide
min or max.
Should any() and all() take a key= argument?
Example:
>>> lst = [2, 4
hi
i tried to search 2 patterns
pat1 = re.compile("blah")
pat2 = re.compile("blah2")
if i do
if re.findall(pat1,something) and re.findall(pat2,something):
do something
if does not work
but when i do a nest if,
if re.findall(pat1,something) :
if re.findall(pat2,s
[EMAIL PROTECTED]:
>Can I use Pickle to store about 500,000 key value pairs..
Performance would be horrible. Use a BTree in ZODB instead:
http://www.zope.org/Wikis/ZODB/guide/node6.html#SECTION00063
>or should I use mySql.
You should use a relational database, such as PostgreSQL
Hi looking for help with what should be a fairly simple Python problem, relating to VB inter-operability.
Got a great response from a fellow named Matt at [EMAIL PROTECTED], pointed me in some good directions - some areas, concerns still foggy on, the below thread is included any feedbac
Hi looking for help with what should be a fairly simple Python problem, relating to VB inter-operability.
Got a great response from a fellow named Matt at [EMAIL PROTECTED], pointed me in some good directions - some areas, concerns still foggy on, the below thread is included any feedbac
As the only director of the Python Software Foundation to vote against a
recent Board motion to implement the change in licensing terms described in
http://pyfound.blogspot.com/2006/04/python-25-licensing-change.html
I would like to place on record my protest against this change. I think
it
Hi,
> i tried to search 2 patterns
>
> pat1 = re.compile("blah")
> pat2 = re.compile("blah2")
>
>
> if i do
> if re.findall(pat1,something) and re.findall(pat2,something):
>do something
>
> if does not work
>
> but when i do a nest if,
>
> if re.findall(pat1,something) :
>
Luc The Perverse wrote:
> <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Programing Languiges Are Ment to be free. That is why i am starting The
> > Coo De Tar thats french for Blow of state it is a flash/java
> > alternative and if you are going to use a server side languige us
[EMAIL PROTECTED] wrote:
> > (and probably for no thanks),
>
> Do you think you know me well enough from a
> handful of usenet postings to conclude that?
yes. anyone who's been involved with open source project long
enough has seen enough people like you to know you. you're not
unique, in any w
101 - 178 of 178 matches
Mail list logo