On Jan 6, 11:02 am, Duncan Booth duncan.bo...@invalid.invalid wrote:
Your complaint seems to be that:
r1 = myFunc1(...)
is unclear when you don't know where myfunc1 originates, so why don't
you write:
r1 = MyModule1.myFunc1(...)
--
Duncan Boothhttp://kupuguy.blogspot.com
My
You might want to check out the Python 2.7 'pipes' standard library
module: http://docs.python.org/library/pipes.html
--
http://mail.python.org/mailman/listinfo/python-list
But sometimes you just wanna do it the way you wanna do it. If you
name your tests like 'test_01_yadda' and test_02_whatever', then they
will be run in the order you want, as given by the numbers.
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 3, 2:36 am, shai garcia melodybel...@gmail.com wrote:
can you pls help me to make a database program in python?
It's better if you do your homework yourself. You learn more that
way. Now, if you have a specific question about some detail of your
assignment, and can show us that you've
On Sep 3, 12:22 am, John Nagle na...@animats.com wrote:
I would expect MySQLdb to rollback on a control-C, but it doesn't
seem to have done so.
Something is broken.
I wouldn't expect it to, I'd expect to roll back on an exception, or
commit if not. Perhaps this will help you. I use it
On Sep 3, 1:52 pm, alistair alistair.cal...@gmail.com wrote:
I'm new to python and my programming years are a ways behind me, so I
was looking for some help in parsing a file into a chart using the
Google Charts API.
Try this:
http://pygooglechart.slowchop.com/
--
On Aug 8, 8:43 pm, rantingrick rantingr...@gmail.com wrote:
Hello folks,
You all know i been forced to use Ruby and i am not happy about that.
***Blablabla cut long rant***
Xah, this is really you, isn't it. Come on, confess.
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 4, 9:10 am, BobAalsma bob.aal...@aalsmacons.nl wrote:
I'm working on a set of scripts and I can't get a replace to work in
the script - please help.
bestandsnaam_nieuw.replace(KLANTNAAM_OUT,KLANTNAAM_IN)
I'm not sure what you are intending to do here, but
On Apr 16, 11:18 am, pca pcarb...@yooper.be wrote:
Dear all,
Could “reactive programming” still increase the productivity and joy
of Python programming? I’d like to hear your thoughts on the idea
that object-oriented “programming by formula”, as in a spreadsheet,
would simplify our work,
http://jrvarma.wordpress.com/2010/04/16/the-sec-and-the-python/
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 14, 4:50 pm, Michel michel.metz...@gmail.com wrote:
Hi,
I would like to create a binary package of python that we will ship
with our product. I need to be able to install the package anywhere in
the file system.
The interpreter seems to be ok with that, but a few other tools that
New submission from Mike Kent mike.k...@sage.com:
If select.select() returns two or more empty lists, these empty lists will all
refer to the same list; that is, they will have identical id()'s. If you then
have reason to alter one of the returned empty lists, you are altering all
Changes by Mike Kent mike.k...@sage.com:
--
type: - behavior
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8329
___
___
Python-bugs-list mailing
On Mar 30, 11:40 am, gentlestone tibor.b...@hotmail.com wrote:
Hi, how can I write the popular C/JAVA syntax in Python?
Java example:
return (a==b) ? 'Yes' : 'No'
My first idea is:
return ('No','Yes')[bool(a==b)]
Is there a more elegant/common python expression for this?
return
On Mar 4, 8:04 pm, Robert Kern robert.k...@gmail.com wrote:
No, the try: finally: is not implicit. See the source for
contextlib.GeneratorContextManager. When __exit__() gets an exception from the
with: block, it will push it into the generator using its .throw() method.
This
raises the
On Mar 3, 10:56 am, Alf P. Steinbach al...@start.no wrote:
* Mike Kent:
What's the compelling use case for this vs. a simple try/finally?
if you thought about it you would mean a simple try/else. finally is
always
executed. which is incorrect for cleanup
by the way, that's one advantage
On Mar 4, 12:30 pm, Robert Kern robert.k...@gmail.com wrote:
He's ignorant of the use cases of the with: statement, true.
humor Ouch! Ignorant of the use cases of the with statement, am I?
Odd, I use it all the time. /humor
Given only your
example of the with: statement, it is hard to fault
On Mar 3, 12:00 pm, Robert Kern robert.k...@gmail.com wrote:
On 2010-03-03 09:39 AM, Mike Kent wrote:
What's the compelling use case for this vs. a simple try/finally?
original_dir = os.getcwd()
try:
os.chdir(somewhere)
# Do other stuff
finally
What's the compelling use case for this vs. a simple try/finally?
original_dir = os.getcwd()
try:
os.chdir(somewhere)
# Do other stuff
finally:
os.chdir(original_dir)
# Do other cleanup
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 27, 1:49 am, John Machin sjmac...@lexicon.net wrote:
I am
having a look at eval and exec
WRONG WAY
GO BACK
+1 QOTW
--
http://mail.python.org/mailman/listinfo/python-list
I'd like to ship only the .pyc files for a module. I was hoping the
standard distutils setup.py could handle this, but so far, I've not
figured out how.
After a bit of work, I discovered that if I create a MANIFEST.in file,
and put 'include mymodule/*.pyc' and 'exclude mymodule/*.py' in it,
then
I use Fabric (http://www.nongnu.org/fab/) as my Python-based
deployment tool, but it uses ssh/scp, not sftp.
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 2, 6:40 pm, Baris Demir demirba...@gmail.com wrote:
def simpleCut(d=dict()):
temp=d
for i in temp.keys():
if (temp[i] == ...) :
temp[i]=new_value
return temp
You have been bitten by the shared default parameter noobie trap:
I'm having a problem building the Python 2.5.2 curses module on HP/UX
11.11 using gcc 3.3.6, and was hoping someone had a solution.
Compiling Modules/_cursesmodule.c is giving several warnings, but no
errors. The relevant compile/link output is below. The key output
line is:
*** WARNING:
To followup on this:
Terry: Yes, I did in fact miss the 'buffer' parameter to open.
Setting the buffer parameter to 0 did in fact fix the test code that I
gave above, but oddly, did not fix my actual production code; it
continues to get the data as first read, rather than what is currently
on the
Before I file a bug report against Python 2.5.2, I want to run this by
the newsgroup to make sure I'm not being stupid.
I have a text file of fixed-length records I want to read in random
order. That file is being changed in real-time by another process,
and my process want to see the changes to
On Aug 29, 2:28 pm, [EMAIL PROTECTED] wrote:
Sorry : Earlier mail had a typo in Subject line which might look
in-appropriate to my friends
Hi,
I've a list some of whose elements with character \.
I want to delete this last character from the elements that have this
character set at their
On Aug 27, 9:35 am, brad [EMAIL PROTECTED] wrote:
Recently had a need to us a multimap container in C++. I now need to
write equivalent Python code. How does Python handle this?
k['1'] = 'Tom'
k['1'] = 'Bob'
k['1'] = 'Joe'
...
Same key, but different values. No overwrites either They
On Jul 1, 2:49 pm, Brandon [EMAIL PROTECTED] wrote:
How do I convert a string to a char array? I am doing this so I can edit
the string received from an sql query so I can remove unnecessary
characters.
Answering your specific question:
Python 2.5.1 (r251:54863, Mar 31 2008, 11:09:52)
[GCC
I recently wanted to do the same kind of thing. See this tread:
http://groups.google.com/group/comp.lang.python/browse_thread/thread/f27c3b7950424e1c
for details on how to do it.
--
http://mail.python.org/mailman/listinfo/python-list
On Jun 13, 8:43 pm, Matimus [EMAIL PROTECTED] wrote:
...chop...
So, it looks like as long as you want to subclass list, you are stuck
implementing both __*slice__ and __*item__ methods.
Matt
Thanks. That was clear and concise, just what I needed.
--
For Python 2.5 and new-style classes, what special method is called
for mylist[2:4] = seq and for del mylist[2:4] (given that mylist is a
list, and seq is some sequence)?
I'm trying to subclass list, and I'm having trouble determining what
special methods I have to override in my class for the
On Jun 3, 6:11 pm, [EMAIL PROTECTED] wrote:
Hello all,
I have come across this issue in Python and I cannot quite understand
what is going on.
class Param():
def __init__(self, data={}, condition=False):
if condition:
data['class']=Advanced
print data
In
On May 13, 2:39 pm, Georgy Panterov [EMAIL PROTECTED] wrote:
def deal_hand(deck):
HAND=[]
for _ in range(2):
i=random.randint(0,len(deck)) #produces a random card from the deck
^ Here i can be from 0 thru (the number of cards in the
deck).
On May 2, 9:47 am, Jetus [EMAIL PROTECTED] wrote:
Hello Marc;
Thanks for the input! I am worried about the comma in the data
items, how do I tell Python to look for the data first, then use
the comma separator?
Marc has already given you the correct answer. You really should read
up on
You could use http://docs.python.org/lib/module-optparse.html
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 16, 10:26 am, Mike Driscoll [EMAIL PROTECTED] wrote:
Yeah, I noticed that Google Groups has really sucked this week. I'm
using the Google Groups Killfile for Greasemonkey now and it helps a
lot. I like Google, but my loyalty only goes to far. This is a
complete lack of customer
So my question is this - what is the easiest way to interface to this
serial device?
http://pyserial.sourceforge.net/
or perhaps
http://pyusb.berlios.de/
--
http://mail.python.org/mailman/listinfo/python-list
In a comment Guido made on a recent bug report for the 'freeze'
utility, he stated:
I think nobody really cares about freeze any more -- it isn't
maintained.
That being the case, what is the preferred/best replacement for freeze
on a *nix platform? I'm looking for something that, like freeze,
On Jan 26, 7:23 am, Dox33 [EMAIL PROTECTED] wrote:
I ran into a very strange behaviour of raw_input().
I hope somebody can tell me how to fix this.
===CUT===
*** Thirst, redirect stderr to file, STRANGE behaviour..
From the command prompt I run:
python script.py 2 stderr_catch.txt
This
If it weren't for the documentation...
If the prompt argument is present, it is written to *standard output*
without a trailing newline.
--
mvh Björn
I have reported this issue to the python-dev mailing list, and Guido
agrees that this is a bug in Python. It turns out that the key is
On Jan 24, 5:13 pm, Terry Reedy [EMAIL PROTECTED] wrote:
Ben Finney [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
| Mike Kent [EMAIL PROTECTED] writes:
|
| A bug issue has been opened in the Python Trac system for this.
|
| Wouldn't it be better to report it in the official
On Jan 23, 9:03 am, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
print foo
print bar
has a newline in between foo and bar
print foo,
print bar
has a space in between foo and bar
How prevent ANYTHING from going in between foo and bar ??
(Without defining a string variable.)
Chris
It's often useful for debugging to print something to stderr, and to
route the error output to a file using '2filename' on the command
line.
However, when I try that with a python script, all prompt output from
raw_input goes to stderr. Consider the following test program:
=== Start test.py ===
Gabriel, thank you for clarifying the source of this behavior. Still,
I'm surprised it would be hard-coded into Python. Consider an
interactive program, that asks the user several questions, and
displays paragraphs of information based on those questions. The
paragraphs are output using print,
I recently found myself needing to do this a lot:
lock a record in a file
read the record into a buffer
alter the buffer
write the buffer back to the record
unlock the record
I'd love to be able to create a context for this to use with the
'with' statement, something like:
from __future__
On Nov 22, 8:23 pm, bruce [EMAIL PROTECTED] wrote:
is there a function/feature/etc.. that i can run on foo.py that would walk
through the entire list of files that make up foo.py, so i could see the
list of *.py files that are required to run foo.py.
There's this:
Conference page
// with links to program details //
(updated Friday 10/12)
http://www.sigapl.org/apl2007.html
Co-located with OOPSLA 2007
http://www.oopsla.org/oopsla2007
On-line registration (through Wednesday 10/17)
On-line registration is through the OOPSLA registrar
http://www.regmaster.com/conf/oopsla2007.html
APL 2007 home page
http://www.sigapl.org/apl2007.html
--
http://mail.python.org/mailman/listinfo/python-list
( Details and abstracts coming to the APL 2007 web page
http://www.sigapl.org/apl2007.html
shortly. In the meantime ... )
Tutorials and workshops
Introduction to APL (Ray Polivka)
OO for APLers, APL for OOers (Dan Baronet)
... others in the works
Presentations
APL 2007 conference on Array Programming
co-located with OOPSLA 2007
Sponsor: ACM SIGAPL
Where:Montreal
When: October 21 (tutorials)
October 22/23 (main conference program)
Keynote Guy Steele
speaker:
The APL2007 URL was given incorrectly should be
http://www.sigapl.org/apl2007.html
--
http://mail.python.org/mailman/listinfo/python-list
, CANADA
Conference hotel: Hyatt Regency Montreal
Committee
General Chair Guy Laroque [EMAIL PROTECTED]
Program Chair Lynne C. Shaw[EMAIL PROTECTED]
Treasurer Steven H. Rogers [EMAIL PROTECTED]
Publicity Mike Kent[EMAIL
On Mar 23, 2:37 pm, Paulo da Silva [EMAIL PROTECTED] wrote:
Hi!
I was told in this NG that string is obsolet. I should use
str methods.
So, how do I join a list of strings delimited by a given
char, let's say ','?
Old way:
l=['a','b','c']
jl=string.join(l,',')
New way?
Thanks
On Mar 15, 11:13 am, tonyr1988 [EMAIL PROTECTED] wrote:
if __name__=='__main__':
x = DemoClass
x.WriteToFile
You meant to create a DemoClass instance object, but instead, you
obtained a reference to the class object. You want 'x = DemoClass()'
instead.
You meant to call the
On Mar 4, 1:15 pm, Jan Danielsson [EMAIL PROTECTED] wrote:
When I run doxygen on my python files, it does document classes, but
not standalone functions.
Look in the doxygen config file for your python project, named
'Doxyfile', for the config setting
'EXTRACT_ALL', and read the comments
robert wrote:
I want to use a computation cache scheme like
o = CACHECOMPUTE complex-key-expr expensive-calc-expr
frequently and elegantly without writing complex-key-expr or
expensive-calc-expr twice.
So its ugly:
_=complex-key-expr; o=cache.get(_) or
John Salerno wrote:
I'm a little confused. Why doesn't s evaluate to True in the first part,
but it does in the second? Is the first statement something different?
s = 'hello'
s == True
False
if s:
print 'hi'
hi
Thanks.
Excellent question! This should help:
s =
feed_list = open(feed_listing.conf,r)
What could it be about the above line that means Open this file for
READ ONLY?
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
I'm new at Python and I need a little advice. Part of the script I'm
trying to write needs to be aware of all the files of a certain
extension in the script's path and all sub-directories.
What you want is os.walk().
How about using os.listdir to build a list of filenames, then sorting
them by modification time (via os.stat)?
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
You may want to look at pexpect:
http://pexpect.sourceforge.net/
But I am not sure about its support on windows.
To the best of my recent investigation, and an email exchange with the
author of pexpect, it is NOT supported under Windows.
--
gmax2006 wrote:
Hi,
I am developing scripts that must run on both Linux and windows.
My scripts contain lots of relative paths (such as log\\log.txt or
ctl\\table.ctl) If I use os.sep, it makes the code ugly. Is there any
tips or techniques to have Python automatically converts \\ to / when
rwboley wrote:
My question is: how can I make that graphing step easier? Ideally I'd
like the chart to exist on it's own page, but I have no idea where to
even begin to implement this. Any thoughts would be appreciated.
I've seen several people recommend matplotlib for this kind of thing.
[EMAIL PROTECTED] wrote:
Hello,Im using Python 2.4.2 and I'm starting a few very basic
programs,but theres two problems I've not found the answers for.
My first problem is I need code that will count the number of letters
in a string and return that number to a variable.
s = hello
len(s)
5
Roman wrote:
I would appreciate it if somebody could tell me where I went wrong in
the following snipet:
When I run I get no result
cnt = 0
p=[]
reader = csv.reader(file(f:\webserver\inp.txt), dialect=excel,
quotechar=', delimiter='\t')
for line in reader:
Roman wrote:
Thanks for your help
My intention is to create matrix based on parsed csv file. So, I would
like to have a list of columns (which are also lists).
I have made the following changes and it still doesn't work.
cnt = 0
p=[[], [], [], [], [], [], [], [], [], [], []]
reader =
James Mitchelhill wrote:
Sorry for the clunky subject line - I have a feeling that not knowing
the proper terms for this is part of my problem.
I'm trying to write a class that analyses some data. I only want it to
do as much work as necessary, so it saves method results to a
dictionary,
David Vincent wrote:
import unittest
class IntegerArithmenticTestCase(unittest.TestCase):
def testAdd(self): ## test method names begin 'test*'
assertEquals((1 + 2), 3)
assertEquals(0 + 1, 1)
assertEquals is a member function, inherited from unittest.TestCase, so
Yes, you can go that route. But since it appears that what you are
doing is unit testing related, and you are interested in aranging for
all of your unit test cases to be run automatically, I'd suggest using
the unittest module.
--
http://mail.python.org/mailman/listinfo/python-list
MTD wrote:
Hello,
I'm wondering if there's a quick way of resolving this problem.
In a program, I have a list of tuples of form (str,int), where int is a
count of how often str occurs
...
So clearly that doesn't work... any ideas?
Yes, use the proper tool for the job. Tuples are
robin wrote:
from SOAPpy import WSDL
WSDLFILE = '/pathtomy/googleapi/GoogleSearch.wsdl'
APIKEY = ''
_server = WSDL.Proxy(WSDLFILE)
Robin, note this part of the URI set in WSDLFILE:
'/pathtomy/googleapi'. Get it? 'path to my google api'. You must set
this part to the actual path where
If anyone is successfully compiling Pyton 2.3 on an SCO OpenServer 5
box, I'd appreciate hearing from you on how you managed to do it. So
far, I'm unable to get a python that doesn't coredump.
--
http://mail.python.org/mailman/listinfo/python-list
I need to compile Python on OpenServer 5 because I need to 'freeze'
our Python app, and running 'freeze' requires a working, compilable
source installation of Python.
--
http://mail.python.org/mailman/listinfo/python-list
When you did:
b = a[:]
b was then a copy of a, rather than just a reference to the same a.
But what does a contain? It contains two sublists -- that is, it
contains references to two sublists. So b, which is now a copy of a,
contains copies of the two references to the same two sublists.
What
Python 2.4.2 (#1, Nov 29 2005, 14:04:55)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type help, copyright, credits or license for more information.
import os
d = /home/testuser/projects
os.path.basename(d)
'projects'
os.path.dirname(d)
'/home/testuser'
--
76 matches
Mail list logo