Steve Potter wrote:
> On Jul 6, 8:19 pm, Matt Nordhoff <[EMAIL PROTECTED]> wrote:
>> Steve Potter wrote:
>>> I'm working on a project to create a central administration interface
>>> for several websites located on different physical servers.
>>&g
mcl wrote:
> Why can I not the change the value of a variable in another class,
> when I have passed it via a parameter list.
>
> I am sure I am being stupid, but I thought passed objects were Read/
> Write
In Python, there are names which are bound to objects. Doing "foo = bar"
and then "foo = s
mcl wrote:
> On 7 Jul, 13:09, Jeff <[EMAIL PROTECTED]> wrote:
>> When you call c3.createJoe(c1.fred), you are passing a copy of the
>> value stored in c1.fred to your function. Python passes function
>> parameters by value. The function will not destructively modify its
>> arguments; you must exp
[EMAIL PROTECTED] wrote:
> Hi,
>
> I am looking fo svn library(module) which is used in the svn-
> mailer(http://opensource.perlig.de/svnmailer/) project. Does anybody
> know where can I find it(download url)? This is information which I
> received from python error:
>
> from svn import core as s
Jerry Hill wrote:
> On Mon, Jul 7, 2008 at 7:30 AM, mcl <[EMAIL PROTECTED]> wrote:
>> I did not think you had to make the distinction between 'byvar' and
>> 'byref' as in Basic.
>
> Python does not use "call by value" or "call by reference" semantics.
> Instead, python's model is "call by object".
skeept wrote:
> On Jul 9, 7:32 pm, [EMAIL PROTECTED] wrote:
>> I am trying to redirect stderr of a process to a temporary file and
>> then read back the contents of the file, all in the same python
>> script. As a simple exercise, I launched /bin/ls but this doesn't
>> work:
>>
>> #!/usr/bin/python
sanket wrote:
> Hello All,
>
> I have created an API which fetches some data from the database.
> I am using simplejson to encode it and return it back.
>
> Now the problem is that, this API is being called for millions of
> times in a sequence.
> I ran a profiler and saw that most of the time is
[EMAIL PROTECTED] wrote:
> Does python install fairly easily for a non-root user?
>
> I have an ssh login account onto a Linux system that currently
> provides Python 2.4.3 and I'd really like to use some of the
> improvements in Python 2.5.x.
>
> So, if I download the Python-2.5.2.tgz file is it
David Pratt wrote:
> Hi. I am trying to replace a system call with a subprocess call. I have
> tried subprocess.Popen and subprocess.call with but have not been
> successful. The command line would be:
>
> svnadmin dump /my/repository > svndump.db
>
> This is what I am using currently:
>
> os.
Matt Nordhoff wrote:
> David Pratt wrote:
>> Hi. I am trying to replace a system call with a subprocess call. I have
>> tried subprocess.Popen and subprocess.call with but have not been
>> successful. The command line would be:
>>
>> svnadmin dump /my/repository
David Pratt wrote:
> Hi David and Matt. I appreciate your help which has got me moving
> forward again so many thanks for your reply. I have been using
> subprocess.Popen a fair bit but this was the first time I had to use
> subprocess to capture large file output. The trouble I was having was
> wi
BonusOnus wrote:
> How do I pass a dictionary to a function as an argument?
>
>
> # Say I have a function foo...
> def foo (arg=[]):
> x = arg['name']
> y = arg['len']
>
> s = len (x)
>
> t = s + y
>
> return (s, t)
I assume you actually indented the body of the function?
> # The dictionary:
Gabriel Rossetti wrote:
> Hello everyone,
>
> we are writing an application that needs some cleanup to be done if the
> application is quit, normally (normal termination) or by a signal like
> SIGINT or SIGTERM. I know that the __del__ method exists, but unless I'm
> mistaken there is no guaran
Matt Nordhoff wrote:
> Gabriel Rossetti wrote:
>> Hello everyone,
>>
>> we are writing an application that needs some cleanup to be done if the
>> application is quit, normally (normal termination) or by a signal like
>> SIGINT or SIGTERM. I know that the __de
[EMAIL PROTECTED] wrote:
> By convention, I've read, your module begins with its import
> statements. Is this always sensible?
>
> I put imports that are needed for testing in the test code at the end
> of the module. If only a bit of the module has a visual interface, why
> pollute the global nam
John Salerno wrote:
>> replaces the elements in the slice by assigned elements.
>
>
> I don't understand the second part of that sentence. I'm assuming "it"
> refers to the list being assigned, "replaces the elements" is
> self-evident, but what does "by assigned elements" refer to? It seems
> wh
Wow, this message turned out to be *LONG*. And it also took a long time
to write. But I had fun with it, so ok. :-)
Michael Torrie wrote:
> Recently a post that mentioned a recipe that extended subprocess to
> allow killable processes caused me to do some thinking. Some of my
> larger bash script
[EMAIL PROTECTED] wrote:
> Hi everybody,
>
> I'm using the win32 console and have the following short program
> excerpt
>
> # media is a binary string (mysql escaped zipped file)
>
>>> print media
> xワユロ[ヨ...
> (works)
>
>>> print unicode(media)
> UnicodeDecodeError: 'ascii' codec can't decode
jmDesktop wrote:
> Hi, I wanted to buy a book on Python, but am concerned that some of
> them are too old. One I had come to after much research was Core
> Python by Wesley Chun. I looked at many others, but actually saw this
> one in the store and liked it. However, it is from 2006. I know
> t
Arnaud Delobelle wrote:
> More simply, use the rsplit() method of strings:
>
path = r'C:\myimages\imageone.jpg'
path.rsplit('.', 1)
> ['C:\\myimages\\imageone', 'jpg']
>
>
path = r"C:\blahblah.blah\images.20.jpg"
path.rsplit('.', 1)
> ['C:\\blahblah.blah\\images.20', 'jpg']
>
Mike Driscoll wrote:
> On May 6, 8:44 am, jmDesktop <[EMAIL PROTECTED]> wrote:
>> Studying OOP and noticed that Python does not have Interfaces. Is
>> that correct? Is my schooling for nought on these OOP concepts if I
>> use Python. Am I losing something if I don't use the "typical" oop
>> cons
Gandalf wrote:
> my server is my computer and all i did way to install python on it.
But what web server program are you using? Apache? IIS? Lighttpd?
--
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> You
> can't get out of the code block with pressing the Enter key; you have
> to press Ctrl+Z (if you're in Linux) in order to get out of that code
> block, which then throws you back to the Linux command line, but
> before that it prints this line
>
> [1]+ Stopped
John Salerno wrote:
> I know it's popular and very handy, but I'm curious if there are purists
> out there who think that using something like:
>
> for x in range(10):
> #do something 10 times
>
> is unPythonic. The reason I ask is because the structure of the for loop
> seems to be for itera
brad 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 all must
> be inserted into
dieter wrote:
> Hi,
>
> Overview
> ===
>
> I'm doing some simple file manipulation work and the process gets
> "Killed" everytime I run it. No traceback, no segfault... just the
> word "Killed" in the bash shell and the process ends. The first few
> batch runs would only succeed with one or t
Asterix wrote:
> how could I test that those 2 strings are the same:
>
> 'séd' (repr is 's\\xc3\\xa9d')
>
> u'séd' (repr is u's\\xe9d')
You may also want to look at unicodedata.normalize(). For example, é can
be represented multiple ways:
>>> import unicodedata
>>> unicodedata.normalize('NFC',
Barak, Ron wrote:
> Hi Fellow Pythonians,
>
> I stated getting the following when starting Python (2.5.2 on Windows XP):
>
> C:\Documents and Settings\RBARAK>python -v
> # installing zipimport hook
> import zipimport # builtin
> # installed zipimport hook
> # D:\Python25\lib\site.pyc matches D:
Emile van Sebille wrote:
> flit wrote:
>> Hello All,
>>
>> I will appreciate the help from the more skillfull pythonistas..
>>
>> I have a small app that generates a sequence like
>>
>> 00341
>> 01741
>> 03254
>
> Consider using a dict with sorted tuple keys, eg
>
> d = {}
>
> for seq in ['00341
Beema Shafreen wrote:
> hi all,
>
> I have a script using functions , I have a problem in returning the
> result. My script returns only one line , i donot know where the looping
> is giving problem, Can any one suggest, why this is happening and let me
> know how to return all the lines
>
> def
Gabriel Genellina wrote:
> En Thu, 11 Sep 2008 10:59:10 -0300, Matt Nordhoff
> <[EMAIL PROTECTED]> escribió:
>
>>>result = "%s\t%s\t%s" %(id,gene_symbol,ptms)
>>
>> This is very trivial, but you could change the above line to:
>>
&g
[EMAIL PROTECTED] wrote:
> Ben Keshet:
>> ...wrong. I thought I should omit the comma and didn't put it. I guess
>> that stating the obvious should be the first attempt with beginners like
>> me. Thanks for thinking about it (it's running perfect now).
>
> In CLisp, Scheme etc, lists such comma
Steven D'Aprano wrote:
> On Thu, 11 Sep 2008 17:27:33 +0200, Sjoerd Mullender wrote:
>
>> When mail messages bounce, the MTA (Message Transfer Agent--the program
>> that handles mail) *should* send the bounce message to whatever is in
>> the Sender header, and only if that header does not exist, s
Grant Edwards wrote:
> On 2008-09-12, Matt Nordhoff <[EMAIL PROTECTED]> wrote:
>
>> I think you misunderstand. He's referring to the Sender
>> header, not the From header. The messages the listbot sends
>> out have a Sender header of
>> "[EMAIL PR
Chris Rebert wrote:
> On Wed, Sep 24, 2008 at 2:02 PM, David Di Biase <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> I have a rather large list structure with tuples contained in them (it's
>> part of a specification I received) looks like so:
>> [(x1,y1,r1,d1),(x2,y2,r2,d2)...]
>>
>> The list can range f
[EMAIL PROTECTED] wrote:
> On Sep 24, 9:44 pm, "Chris Rebert" <[EMAIL PROTECTED]> wrote:
>> On Wed, Sep 24, 2008 at 8:30 PM, <[EMAIL PROTECTED]> wrote:
>>> I want to take a long alpha-numeric string with \n and white-space and
>>> place ALL elements of the string (even individual parts of a long
>
[EMAIL PROTECTED] wrote:
> I took over spam filter management for the python.org mailing lists a couple
> months ago and made a few changes to the way the spam filter is trained.
> Things seem to be at a reasonable level as far as I can tell (I see a few
> spams leak through each day), though I was
the module
object referred to by the name "one". Since there is only one instance
of a given module*, the change is indeed reflected everywhere the "one"
module is accessed.
The problem is that argFunc does not modify (or replace) one.myList, as
MRAB said.
* Unless you do something strange like reload() or editing sys.modules
or having module available under different names...or something.
--
Matt Nordhoff
--
http://mail.python.org/mailman/listinfo/python-list
', with the
>> '*'s removed.
>>
>> So in the case above n would be ['nbh', 'jkjsdfjasd']
>
> [s[1:-1] for s in l if (s[0] == s[-1] == '*')]
s[0] and s[-1] raise an IndexError if l contains an empty string.
Better something like:
>>> [s[1:-1] for s in l if (s[:1] == s[-1:] == '*')]
Or just the slightly more verbose startswith/endswith version.
--
Matt Nordhoff
--
http://mail.python.org/mailman/listinfo/python-list
name "_builtins_" is not
defined, as it says. You were probably looking for "__builtins__", with
2 underscores on each end, not just 1.
BTW, "__builtins__" is a CPython implementation detail. If you want to
play with built-in objects, you should import the __builtin__
Rick wrote:
> Is there any way to get the current time from time.gov using urllib2 or
> something similar?
>
> Does anyone have any examples of doing this?
>
> Thanks!
> Rick King
> Southfield MI
Why isn't your local system's clock accurate enough?
--
Matt N
Matt Nordhoff wrote:
> Rick wrote:
>> Is there any way to get the current time from time.gov using urllib2 or
>> something similar?
>>
>> Does anyone have any examples of doing this?
>>
>> Thanks!
>> Rick King
>> Southfield MI
>
> Why i
here were, this is not one of those situations.
--
Matt Nordhoff
--
http://mail.python.org/mailman/listinfo/python-list
27;s not much of an option! You should
use a regular argument and check len(args) or somesuch. Or, if you must
keep it an "option", do something equivalent for that.
BTW: Checked out optparse? It's bigger and sexier!
--
Matt Nordhoff
--
http://mail.python.org/mailman/listinfo/python-list
Andre Engels wrote:
[snip]
> However, I think that the better Python way would be to use a generator:
>
> def infinite_numbergenerator():
> n = 0
> while True:
> yield n
> n += 1
>
> for i in infinite_numbergenerator():
> ...
That's what itertools.count() is for.
Matt Nordhoff wrote:
> Andre Engels wrote:
> [snip]
>
>> However, I think that the better Python way would be to use a generator:
>>
>> def infinite_numbergenerator():
>> n = 0
>> while True:
>> yield n
>>
Gertjan Klein wrote:
> Alf P. Steinbach wrote:
>
>> So with 'w+' the only way to get garbage is if 'read' reads beyond the end
>> of
>> file, or 'open' doesn't conform to the documentation.
>
> It does read beyond the end of file. This is perhaps the way the
> underlying C library works, but it
non-Linux users, but there it is. Too bad, because
> inotify is pretty cool.
>
> Jason
Some other operating systems have similar facilities, e.g. FSEvents on OS X.
--
Matt Nordhoff
--
http://mail.python.org/mailman/listinfo/python-list
Tobiah wrote:
> Now that I use python, this is the amount of time
> per day that I spend adding forgotten semicolons while
> debugging other languages.
You can fix that by not using other languages. :>
--
Matt Nordhoff
--
http://mail.python.org/mailman/listinfo/python-list
x27;t particularly expensive, it would look nicer
to just use self.i and do "self.i == 0" in __call__.
Not that it matters, but this is probably faster than your version, too,
since it saves a method call.
By the way, IIRC Python only looks up double-underscore methods on the
class, not the instance. That's why you had to indirect through self.F.
--
Matt Nordhoff
--
http://mail.python.org/mailman/listinfo/python-list
101 - 150 of 150 matches
Mail list logo