Re: Contact information for Jim Hugunin?

2013-07-24 Thread Albert Hopkins
On Mon, Jul 22, 2013, at 05:33 PM, Larry Hastings wrote: > > > Does anybody have an email address (or anything, really) for Jim > Hugunin? He left Google in May and appears to have dropped off the face > of the internet. Please email me privately. > > I swear I will use the information only

Re: 'indent'ing Python in windows bat

2012-09-19 Thread Albert Hopkins
On Tue, 2012-09-18 at 22:12 -0600, Jason Friedman wrote: > > I'm converting windows bat files little by little to Python 3 as I find time > > and learn Python. > > The most efficient method for some lines is to call Python like: > > python -c "import sys; sys.exit(3)" > > > > How do I "indent" if I

Re: Fastest web framework

2012-09-24 Thread Albert Hopkins
On Sun, 2012-09-23 at 12:19 +0300, Andriy Kornatskyy wrote: > I have run recently a benchmark of a trivial 'hello world' application for > various python web frameworks (bottle, django, flask, pyramid, web.py, > wheezy.web) hosted in uWSGI/cpython2.7 and gunicorn/pypy1.9... you might find > it i

Re: who can give me some practical tutorials on django 1.4 or 1.5?

2012-11-04 Thread Albert Hopkins
On Sun, 2012-11-04 at 13:29 +0800, Levi Nie wrote: > Who can give me some practical tutorials on django 1.4 or 1.5? > Thank you. Is the official[1] tutorial not practical enough? [1] https://docs.djangoproject.com/en/1.4/intro/tutorial01/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Tarfile and usernames

2012-12-30 Thread Albert Hopkins
On Sun, Dec 30, 2012, at 01:57 PM, Nicholas Cole wrote: Dear List, I'm hoping to use the tarfile module in the standard library to move some files between computers. I can't see documented anywhere what this library does with userids and groupids. I can't guarantee that the computers invo

Re: When is overriding __getattr__ is useful?

2013-01-07 Thread Albert Hopkins
On Mon, Jan 7, 2013, at 10:54 AM, Rodrick Brown wrote: > Can someone provide an example why one would want to override __getattr__ > and __getattribute__ in a class? They're good for cases when you want to provide an "attribute-like" quality but you don't know the attribute in advance. For exa

Re: sockobj.connect Errno 13 Permission denied

2013-01-26 Thread Albert Hopkins
On Sat, Jan 26, 2013, at 08:52 AM, Joel Goldstick wrote: > On Sat, Jan 26, 2013 at 8:47 AM, Joel Goldstick > wrote: > > > > > > > > > On Sat, Jan 26, 2013 at 6:19 AM, nobody wrote: > > > >> Hi, > >> > >> I have a client program Client.py which has a statement of > >> sockobj.connect(), the port

Re: subtle error slows code by 10x (builtin sum()) - replace builtin sum without using import?

2011-07-01 Thread Albert Hopkins
On Friday, July 1 at 19:17 (-0700), bdb112 said: > Question: > Can I replace the builtin sum function globally for test purposes so > that my large set of codes uses the replacement? > > The replacement would simply issue warnings.warn() if it detected an > ndarray argument, then call the origi

Re: Restarting a daemon

2011-04-26 Thread Albert Hopkins
On Tue, 2011-04-26 at 06:13 -0600, Jeffrey Barish wrote: > Not exactly a Python question, but I thought I would start here. > > I have a server that runs as a daemon. I can restart the server manually > with the command > > myserver restart > > This command starts a new myserver which first l

Re: How to concatenate unicode strings ???

2011-04-26 Thread Albert Hopkins
On Tue, 2011-04-26 at 17:58 +0200, Ariel wrote: > Hi everybody, how could I concatenate unicode strings ??? > What I want to do is this: > > unicode('this an example language ') + unicode('español') > > but I get an: > Traceback (most recent call last): > File "", line 1, in > UnicodeDecodeE

Re: PIL: The _imaging C module is not installed

2011-05-05 Thread Albert Hopkins
On Thu, 2011-05-05 at 15:35 +0200, Nico Grubert wrote: > Hi there > > I am having trouble to install PIL 1.1.7 on CentOS. > > I read and followed the instructions from > http://effbot.org/zone/pil-imaging-not-installed.htm > > However, I still get the "The _imaging C module is not installed" err

Re: PIL: The _imaging C module is not installed

2011-05-05 Thread Albert Hopkins
Oh I forgot to say, after installing these libraries, you will need to re-compile (install) PIL. -a -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL: The _imaging C module is not installed

2011-05-05 Thread Albert Hopkins
On Fri, 2011-05-06 at 01:45 +0200, Michel Claveau - MVP wrote: > Hi! > > > you need to install the appropriate libraries, among which are: > > libjpeg-devel > > freetype-devel > > libpng-devel > > OK, but where can I find it? I want use PIL with Python under Windows, > and I can't compile C's so

Re: if statement multiple or

2011-05-06 Thread Albert Hopkins
On Fri, 2011-05-06 at 13:47 +0300, Lutfi Oduncuoglu wrote: > Hi, > > I am trying to write a script and I realised that I need to use > something like > > if ('a' or 'b' or 'c') not in line: >print line > The expression: ('a' or 'b' or 'c') evaluates to True True not in line Is

Re: if statement multiple or

2011-05-06 Thread Albert Hopkins
Correction: ('a' or 'b' or 'c') evaluates to 'a' -- http://mail.python.org/mailman/listinfo/python-list

Re: FW: help please

2011-05-17 Thread Albert Hopkins
On Tue, 2011-05-17 at 10:18 -0600, Littlefield, Tyler wrote: > Not to be pedantic or anything, and I may not be able to help > regardless, but it looks like your space key is fixed, and I don't > really care to pick through and try to play hangman with your message. I actually, at first glance,

Re: FW: help please

2011-05-18 Thread Albert Hopkins
On Tue, 2011-05-17 at 21:46 -0300, Gabriel Genellina wrote: > En Tue, 17 May 2011 16:48:29 -0300, Albert Hopkins > escribió: > > On Tue, 2011-05-17 at 10:18 -0600, Littlefield, Tyler wrote: > > >> Not to be pedantic or anything, and I may not be able to help > >&

Re: FW: help please

2011-05-18 Thread Albert Hopkins
On Wed, 2011-05-18 at 13:39 +0100, Stuart MacKay wrote: > If you were required to answer the question then asking the poster to > phrase it better is going to help solve the issue faster but for a > mailing list like this simply ignore it. Which is what I've done. -- http://mail.python.org/ma

Re: How To Make Fast Money Legally

2011-05-18 Thread Albert Hopkins
On Wed, 2011-05-18 at 15:48 -0400, D'Arcy J.M. Cain wrote: > On Wed, 18 May 2011 12:06:07 -0700 (PDT) > "tmac641...@yahoo.com" wrote: > > HOW TO MAKE EASY MONEY FAST AND LEGALLY > > Wow! Was this stuck in someone's mail queue since 1992? Me too! -- http://mail.python.org/mailman/listi

Re: changing current dir and executing a shell script

2011-05-27 Thread Albert Hopkins
On Fri, 2011-05-27 at 14:25 -0700, suresh wrote: > Hi, > I want to execute the following command line stuff from inside python. > $cd directory > $./executable > > I tried the following but I get errors > import subprocess > subprocess.check_call('cd dir_name;./executable') > > Due to filename p

Re: changing current dir and executing a shell script

2011-05-28 Thread Albert Hopkins
On Sat, 2011-05-28 at 09:41 +0200, Peter Otten wrote: > > You don't want to do this because "cd" is a built-in shell command, > and > > subprocess does not execute within a shell (by default). > > The problem is not that cd is built-in, but that there is no shell at > all. > You can change that w

Re: float("nan") in set or as key

2011-05-28 Thread Albert Hopkins
On Sun, 2011-05-29 at 00:41 +0100, MRAB wrote: > Here's a curiosity. float("nan") can occur multiple times in a set or as > a key in a dict: > > >>> {float("nan"), float("nan")} > {nan, nan} > These two nans are not equal (they are two different nans) > except that sometimes it can't: > > >>

Re: print function and unwanted trailing space

2013-09-12 Thread Albert Hopkins
On Wed, Sep 11, 2013, at 07:36 AM, Wayne Werner wrote: > On Sat, 31 Aug 2013, candide wrote: > > # - > > for i in range(5): > >print(i, end=' ') # <- The last ' ' is unwanted > > print() > > # - > > Then why not define end='' instead?

Re: error in except

2013-02-04 Thread Albert Hopkins
On Mon, Feb 4, 2013, at 04:49 PM, Rodrick Brown wrote: > For the life of me I cant figure out why this exception is being thrown. > How could I use pdb to debug this? > > $ python udp_local2.py server > File "udp_local2.py", line 36 > except: > ^ > SyntaxError: invalid syntax > >

Re: Best Practice Question

2013-02-05 Thread Albert Hopkins
[...] > By the way, did someone ever notice that r'\' fails ? I'm sure there's a > reason for that... (python 2.5) Anyone knows ? > > r'\' > SyntaxError: EOL while scanning single-quoted string > > "Even in a raw string, string quotes can be escaped with a backslash, but the backslash remains in

Re: Is Python programming language?

2013-02-08 Thread Albert Hopkins
On Fri, Feb 8, 2013, at 08:03 AM, gmspro wrote: > Hello all, > > One said, Python is not programming language, rather scripting language, > is that true? > According to Wikipedia[1] a "scripting languages" are a subset of "programming languages" so it goes that any "scripting language" is, be

Re: how to call shell?

2013-02-12 Thread Albert Hopkins
On Tue, Feb 12, 2013, at 12:12 AM, contro opinion wrote: > >>> import os > >>> os.system("i=3") > 0 > >>> os.system("echo $i") > > 0 > >>> > why i can't get the value of i ? Whenever you call os.system, a new shell is created and the command is run, system() then waits for the command to comple

Re: AttributeError: 'gr_hier_block2_sptr' object has no attribute 'set_callback'

2013-02-14 Thread Albert Hopkins
On Thu, Feb 14, 2013, at 04:39 PM, Dave Angel wrote: [... snip] > For those of us using text-based email, the program in this message is > totally unreadable. This is a text mailing-list, so please put your > email program in text mode, or you'll lose much of your audience. For those of us n

Re: Is Python "venerable"?

2013-02-20 Thread Albert Hopkins
On Tue, Feb 19, 2013, at 11:10 PM, Gene Heskett wrote: [...] > And even us old (78) farts are calling things Kewl now. 78??? Is that the year you were born or the years since you were born? -a -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Newbie

2013-02-24 Thread Albert Hopkins
> Most of what gets hung in art galleries these days is far less > visually pleasing than well-written code. +1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is Ruby on Rails more popular than Django?

2013-03-06 Thread Albert Hopkins
On Wed, Mar 6, 2013, at 02:16 PM, Tim Johnson wrote: > I had problems getting django to work on my hostmonster account > which is shared hosting and supports fast_cgi but not wsgi. I put > that effort on hold for now, as it was just R&D for me, but > I would welcome you to take a look at

When is min(a, b) != min(b, a)?

2008-01-20 Thread Albert Hopkins
This issue may have been referred to in news:<[EMAIL PROTECTED]> but I didn't entirely understand the explanation. Basically I have this: >>> a = float(6) >>> b = float('nan') >>> min(a, b) 6.0 >>> min(b, a) nan >>> max(a, b) 6.0 >>> max(b, a) nan Before

Re: When is min(a, b) != min(b, a)?

2008-01-20 Thread Albert Hopkins
On Sun, 20 Jan 2008 20:16:18 -0800, Paddy wrote: > I am definitely NOT a floating point expert, but I did find this: > http://en.wikipedia.org/wiki/IEEE_754r#min_and_max > > P.S. What platform /Compiler are you using for Python? Linux with GCC 4 -a -- http://mail.python.org/mailman/listinfo/p

Re: Looking for an efficient Python script to download and save a .zip file programmatically

2009-01-10 Thread Albert Hopkins
On Sat, 2009-01-10 at 17:12 +, David Shi wrote: > I am looking for an efficient Python script to download and save > a .zip file programmatically (from http or https call). > > Regards. > > David urllib? -a -- http://mail.python.org/mailman/listinfo/python-list

Re: trying to modify locals() dictionary

2009-01-12 Thread Albert Hopkins
On Mon, 2009-01-12 at 19:51 +0100, TP wrote: > Hi everybody, > > I try to modify locals() as an exercise. > According to the context (function or __main__), it works differently (see > below). Why? Thanks > > Julien Per the locals() documentation @ http://docs.python.org/library/functions.html

Re: exec in a nested function yields an error

2009-01-13 Thread Albert Hopkins
On Tue, 2009-01-13 at 16:13 +0100, TP wrote: > Hi everybody, > > Try the following program: > > > def f(): > def f_nested(): > exec "a=2" > print a > f() > > > It yields an error. > $ python nested_exec.py > File "nested_exec.py", l

Re: basic python list/dict/key question/issues..

2009-01-13 Thread Albert Hopkins
On Tue, 2009-01-13 at 08:59 -0800, bruce wrote: > Hi.. > > quite new to python, and have a couple of basic question: > > i have > ("term":["1","2","3"]) > > as i understand it, this is a list, yes/no? > No, that's invalid syntax: >>> ("term":["1","2","3"]) File "", line 1

Re: Read binary file and dump data in

2009-01-13 Thread Albert Hopkins
On Tue, 2009-01-13 at 12:02 -0800, Santiago Romero wrote: > Hi. > > Until now, all my python programs worked with text files. But now I'm > porting an small old C program I wrote lot of years ago to python and > I'm having problems with datatypes (I think). > > some C code: > > fp = fopen( fi

Re: pep 8 constants

2009-01-14 Thread Albert Hopkins
On Wed, 2009-01-14 at 16:58 +1000, James Mills wrote: [...] > Still I would avoid using this idiom altogether > and jsut stick with default values. For Example: > > FOO = 1 > > def f(x=FOO): >... > > > Use this instead: > > def f(x=1): >... That only works well when "1" is only used o

Re: Kill a function while it's being executed

2009-02-04 Thread Albert Hopkins
On Wed, 2009-02-04 at 13:40 +0200, Noam Aigerman wrote: > Hi All, > I have a script in which I receive a list of functions. I iterate over > the list and run each function. This functions are created by some other > user who is using the lib I wrote. Now, there are some cases in which > the functio

Re: where clause

2009-02-05 Thread Albert Hopkins
On Thu, 2009-02-05 at 10:04 -0800, bearophileh...@lycos.com wrote: > This comes after a small discussion in another Python newsgroup. > Haskell supports a where clause, that's syntactic sugar that allows > you to define things like this: > > p = a / b > where > a = 20 / len(c) > b = foo(

Re: Is c.l.py becoming less friendly?

2009-02-06 Thread Albert Hopkins
Probably that [c.l.]python is becoming more popular and, like most things as they become popular, it loses its "purity"... much like the Internet in the early 1990s. -- http://mail.python.org/mailman/listinfo/python-list

Re: isfifo?

2009-02-07 Thread Albert Hopkins
On Sat, 2009-02-07 at 17:12 +, rdmur...@bitdance.com wrote: > I've googled and looked through os.path, but I don't see a method for > determining if a path points to a FIFO. Anyone know of a simple way to > do so? import os import stat st_mode = os.stat(path)[0] isfifo = stat.S_ISFIFO(st_mod

Re: bool evaluations of generators vs lists

2009-02-10 Thread Albert Hopkins
On Tue, 2009-02-10 at 11:15 -0800, Josh Dukes wrote: > quite simply...what??? > > In [108]: bool([ x for x in range(10) if False ]) > Out[108]: False > > In [109]: bool( x for x in range(10) if False ) > Out[109]: True > > Why do these two evaluate differently? I was expecting that they would >

Re: bool evaluations of generators vs lists

2009-02-10 Thread Albert Hopkins
On Tue, 2009-02-10 at 12:50 -0800, Josh Dukes wrote: > The thing I don't understand is why a generator that has no iterable > values is different from an empty list. Why shouldn't bool == > has_value?? Technically a list, a tuple, and a string are also objects > but if they lack values they're eva

Re: Unicode issue on Windows cmd line

2009-02-11 Thread Albert Hopkins
On Wed, 2009-02-11 at 10:35 -0800, jeffg wrote: > Having issue on Windows cmd. > > Python.exe > >>>a = u'\xf0' > >>>print a > > This gives a unicode error. > > Works fine in IDLE, PythonWin, and my Macbook but I need to run this > from a windows batch. > > Character should look like this "ð". >

Re: Function name limit in Python ?

2009-02-14 Thread Albert Hopkins
On Sat, 2009-02-14 at 07:45 -0700, Linuxguy123 wrote: > Excuse my ignorance, but is there a limit to the size of function names > in Python ? > > I named a function getSynclientVersion() and I got an error when I > called it. You forgot to paste the error. -- http://mail.python.org/mailman/lis

Re: listing files by modification time

2009-02-17 Thread Albert Hopkins
On Tue, 2009-02-17 at 19:46 +0530, Deepak Rokade wrote: > > Yes I can do that but for that I will have to go through entire list > of files and also I will have to first get the whole list of files > present in directory. > > In case of my application this list can be huge and so want to list > t

Re: Regular expression bug?

2009-02-19 Thread Albert Hopkins
On Thu, 2009-02-19 at 10:55 -0800, Ron Garret wrote: > I'm trying to split a CamelCase string into its constituent components. > This kind of works: > > >>> re.split('[a-z][A-Z]', 'fooBarBaz') > ['fo', 'a', 'az'] > > but it consumes the boundary characters. To fix this I tried using > lookahe

Re: Forwarding keyword arguments from one function to another

2009-02-22 Thread Albert Hopkins
On Sun, 2009-02-22 at 11:44 -0800, Ravi wrote: > The following code didn't work: > > class X(object): > def f(self, **kwds): > print kwds > try: > print kwds['i'] * 2 > except KeyError: > print

Re: Forwarding keyword arguments from one function to another

2009-02-22 Thread Albert Hopkins
On Sun, 2009-02-22 at 12:09 -0800, Ravi wrote: > I am sorry about the typo mistake, well the code snippets are as: > > # Non Working: > > class X(object): > def f(self, **kwds): > print kwds > try: > print kwds['i'] * 2 > except KeyError: > print "unknown keyword argument" > s

Re: pickle.load() on an dictionary of dictionaries doesn't load full data structure on first call

2009-02-22 Thread Albert Hopkins
On Sun, 2009-02-22 at 16:15 -0800, James Pearson wrote: > I've been using irclib to write a simple irc bot, and I was running > into some difficulties with pickle. Upon some experimentation with > pdb, I found that pickle.load() doesn't load *all* of the data the > _first_ time it's called. > > F

Re: Python Script to search by Date

2008-11-25 Thread Albert Hopkins
On Tue, 2008-11-25 at 16:10 -0800, [EMAIL PROTECTED] wrote: > What I'm trying to do is decompress a bunch of files depending on the > date/time specified. > > So, we have full backups created every Sunday and transaction backups > every hour afterwards. > > I have everything compressed at an hour

Re: newbie question

2008-11-26 Thread Albert Hopkins
On Wed, 2008-11-26 at 11:11 -0800, Nan wrote: > Hello, >I just started to use Python. I wrote the following code and > expected 'main' would be called. > > def main(): > print "hello" > > main > > But I was wrong. I have to use 'main()' to invoke main. The python > interpreter does not giv

Re: Version upgrade blocked mentally

2008-11-29 Thread Albert Hopkins
On Sat, 2008-11-29 at 12:32 -0800, Adam E wrote: > I have read in my copy of Programming Python that all strings will be > Unicode and there will be a byte type. > > This is mentally keeping me from upgrading to 2.6 . Care to explain? Actually what you describe is a change change takes place in

Re: Convert hexadecimal characters to ascii

2008-11-29 Thread Albert Hopkins
On Sat, 2008-11-29 at 20:39 +, Durand wrote: > Hi, > > I've got this weird problem where in some strings, parts of the string > are in hexadecimal, or thats what I think they are. I'm not exactly > sure...I get something like this: 's\x08 \x08Test!' from parsing a log > file. From what I fo

Re: Emacs vs. Eclipse vs. Vim

2008-11-29 Thread Albert Hopkins
On Sun, 2008-11-30 at 02:18 +0100, Stef Mientki wrote: > > First, you must understand that this is an extremelly dangerous > > question to ask on a public newsgroup (expecially regarding the first > > and the third in the series). Wars have began over this. Many people > > were harmed in those war

Re: Obama's Birth Certificate - Demand that US presidential electors investigate Obama's eligibility

2008-12-03 Thread Albert Hopkins
This has nothing to do with Python. Please take this thread to cares.who.someone. -- http://mail.python.org/mailman/listinfo/python-list

Re: "as" keyword woes

2008-12-03 Thread Albert Hopkins
On Wed, 2008-12-03 at 13:38 -0800, Warren DeLano wrote: > A bottom line / pragmatic question... hopefully not a FAQ. > > Why was it necessary to make "as" a reserved keyword? > > And more to the point, why was it necessary to prevent developers from > being able to refer to attributes named "as

Re: Python 3 read() function

2008-12-04 Thread Albert Hopkins
On Thu, 2008-12-04 at 20:01 +0100, Дамјан Георгиевски wrote: > > I don't think it matters. Here's a quick comparison between 2.5 and > > 3.0 on a relatively small 17 meg file: > > > > C:\>c:\Python30\python -m timeit -n 1 > > "open('C:\\work\\temp\\bppd_vsub.csv', 'rb').read()" > > 1 loops, best

Re: "as" keyword woes

2008-12-04 Thread Albert Hopkins
It's been a while so I can't remember, but it seems like "yield" was dropped in to python relatively quickly in 2.2. Was there a similar outrage when "yield" became a keyword? -a -- http://mail.python.org/mailman/listinfo/python-list

Re: Insert Multiple Records Using One Insert Statemen with MySQLdb module

2008-12-06 Thread Albert Hopkins
On Sat, 2008-12-06 at 04:03 -0800, [EMAIL PROTECTED] wrote: > Hi, > > I'd like to insert Multiple Records Using One Insert Statement > > inserting one record using one insert statement works > this is the example: > > import MySQLdb > conn = MySQLdb.connect(host="localhost",.) > cursore = co

When (and why) to use del?

2008-12-09 Thread Albert Hopkins
I'm looking at a person's code and I see a lot of stuff like this: def myfunction(): # do some stuff stuff my_string = function_that_returns_string() # do some stuff with my_string del my_string # do some other stuff r

Can't figure out where SyntaxError: can not delete variable 'x' referenced in nested scope us coming from in python >=2.6

2008-12-09 Thread Albert Hopkins
Say I have module foo.py: def a(x): def b(): x del x If I run foo.py under Python 2.4.4 I get: File "foo.py", line 4 del x SyntaxError: can not delete variable 'x' referenced in nested scope Under Python

Re: Is 3.0 worth breaking backward compatibility?

2008-12-09 Thread Albert Hopkins
On Tue, 2008-12-09 at 20:56 +, Lie Ryan wrote: > Actually I noticed a tendency from open-source projects to have slow > increment of version number, while proprietary projects usually have > big > version numbers. > > Linux 2.x: 1991 Python 3.x.x: 1991. Apache 2.0: 1995. OpenOffice.org > 3.0

Re: Can't figure out where SyntaxError: can not delete variable 'x' referenced in nested scope us coming from in python >=2.6

2008-12-09 Thread Albert Hopkins
On Tue, 2008-12-09 at 22:57 +, Steven D'Aprano wrote: [...] > > So is there a way to find the offending code w/o having to go > through > > every line of code in 'foo' by hand? > > Just search for "del x" in your code. Your editor does have a search > function, surely? > > Well, you'd th

Re: How to read stdout from subprocess as it is being produced

2008-12-19 Thread Albert Hopkins
On Fri, 2008-12-19 at 06:34 -0800, Alex wrote: > Hi, > > I have a Pyhon GUI application that launches subprocess. > I would like to read the subprocess' stdout as it is being produced > (show it in GUI), without hanging the GUI. > > I guess threading will solve the no-hanging issue, but as far as

Re: print to console without a line break

2008-12-23 Thread Albert Hopkins
On Tue, 2008-12-23 at 13:18 +, Lie Ryan wrote: > On Tue, 23 Dec 2008 11:50:59 +0100, Qian Xu wrote: > > > Hello All, > > > > Is it possible to print something to console without a line break? > > > > I tried: > > sys.stdout.write("Testing something ...") // nothing will be printed > > ti

Re: need help with list/variables

2008-12-30 Thread Albert Hopkins
On Tue, 2008-12-30 at 11:31 -0800, wx1...@gmail.com wrote: > I have a list and would like to parse the list appending each list > item to the end of a variable on a new line. > > for instance > > mylist = ['something\n', 'another something\n', 'something again\n'] > > then parse mylist to make i

Re: parse/slice/...

2009-01-06 Thread Albert Hopkins
On Tue, 2009-01-06 at 11:23 -0800, rcmn wrote: > I'm not sure how to call it sorry for the subject description. >Here what i'm trying to accomplish. > the script i'm working on, take a submitted list (for line in file) > and generate thread for it. unfortunately winxp has a limit of 500 > threa

Re: How do you write to the printer ?

2009-01-08 Thread Albert Hopkins
On Wed, 2009-01-07 at 16:46 -0600, da...@bag.python.org wrote: > Can find nothing in the on-line docs or a book. > Groping in the dark I attempted : > > script24 > import io > io.open('stdprn','w') # accepted > stdprn.write('hello printer') # fails < stdprn is not defined >

Re: parsing grub's menu.lst

2008-11-17 Thread Albert Hopkins
On Mon, 2008-11-17 at 10:27 -0800, CarlFK wrote: > I need some code that will read in grubs menu.lst file, and give me a > list of dicts: > > [{'title':'Ubuntu, kernel 2.6.15-23-686', > 'root':'(hd0,0)', > 'kernel':'/boot/vmlinuz-2.6.15-23-686 root=/dev/hda1 ro quiet splash', > 'initrd':'/boot/ini

Re: Retrieve Custom 404 page.

2008-11-17 Thread Albert Hopkins
On Mon, 2008-11-17 at 13:59 -0800, godavemon wrote: > I'm using urllib2 to pull pages for a custom version of a web proxy > and am having issues with 404 errors. Urllib2 does a great job of > letting me know that a 404 happened with the following code. > > import urllib2 > url = 'http://cnn.com/a

Re: subprocess with shared environment?

2008-11-17 Thread Albert Hopkins
On Mon, 2008-11-17 at 15:27 -0800, rowen wrote: > I'd like to replace some shell scripts with Python, but one step of > the script modifies my environment in a way that the subsequent steps > require. > > A simple translation to a few lines of subprocess.call(...) fails > because the first call mo

Re: setting permissions to a file from linux.

2008-11-18 Thread Albert Hopkins
On Tue, 2008-11-18 at 04:36 -0800, gaurav kashyap wrote: > Hi all, > I have a text file in a directory on unix system. > Using a python program i want to change that file's permissions. > How could this be done. > > Thanks os.chmod = chmod(...) chmod(path, mode) Change the access per

Re: Can someone tell me why i get None at the end please this has me stuck for ages

2009-02-23 Thread Albert Hopkins
On Mon, 2009-02-23 at 19:22 +, Gary Wood wrote: > '''exercise to complete and test this function''' > import string > def joinStrings(items): > '''Join all the strings in stringList into one string, > and return the result. For example: > >>> print joinStrings(['very', 'hot', 'day']

Re: Is there any equivalent feature available in Python..?

2009-02-24 Thread Albert Hopkins
On Tue, 2009-02-24 at 11:05 -0800, zaheer.ag...@gmail.com wrote: > Hi, > > Is there any Python equivalent of java jar,can I include all my > sources,properties file etc into a single file.Is there anyway in > Python that I can run like the following > > java -jar Mytest.jar --startwebserver > >

Re: Lambda function

2009-02-25 Thread Albert Hopkins
On Wed, 2009-02-25 at 17:56 +0530, aditya saurabh wrote: > I defined two functions - lets say > fa = lambda x: 2*x > fb = lambda x: 3*x > Now I would like to use fa*fb in terms of x > is there a way? > Thanks in advance I'm not sure what "use fa*fb in terms of x" means. But if you mean fa(x) * fb

Re: Can someone explain this behavior to me?

2009-02-26 Thread Albert Hopkins
On Thu, 2009-02-26 at 13:48 -0800, Jesse Aldridge wrote: > I have one module called foo.py > - > class Foo: > foo = None > > def get_foo(): > return Foo.foo > > if __name__ == "__main__": > import bar > Foo.foo = "foo" > bar.go() > - > A

Re: Wanting to fire an event when property content changes

2009-03-03 Thread Albert Hopkins
On Tue, 2009-03-03 at 13:41 -0600, nuwandame wrote: > What I am wanting to do is execute code whenever a property of a class > object has been changed. > > i.e. > > class test: > > testproperty = None > > > bob = test() > bob.testproperty = 'something' > > So, when bob.testproperty is set

Re: "/a" is not "/a" ?

2009-03-07 Thread Albert Hopkins
On Fri, 2009-03-06 at 23:57 -0800, Paul Rubin wrote: > alex23 writes: > > But _you_ only _just_ stated "It does have some (generally small) > > performance ramifications as > > well" and provided timing examples to show it. Without qualification. > > The performance difference can be large if the

Re: "/a" is not "/a" ?

2009-03-07 Thread Albert Hopkins
On Sat, 2009-03-07 at 03:07 -0500, Albert Hopkins wrote: > On Fri, 2009-03-06 at 23:57 -0800, Paul Rubin wrote: > > alex23 writes: > > > But _you_ only _just_ stated "It does have some (generally small) > > > performance ramifications as > > > well

Re: Raw String Question

2009-03-12 Thread Albert Hopkins
> > Yep...as documented[1], "even a raw string cannot end in an odd number > > of backslashes". > > So how do you explain this? > > >>> r'a\'b' > "a\\'b" That doesn't "end in an odd number of backslashes." Python is __repr__esenting a raw string as a "regular" string. Literally they

Re: unbiased benchmark

2009-03-12 Thread Albert Hopkins
On Thu, 2009-03-12 at 13:25 -0700, Chris Rebert wrote: > On Thu, Mar 12, 2009 at 1:07 PM, Sam Ettessoc wrote: > > I would like to share a benchmark I did. The computer used was a > > 2160MHz Intel Core Duo w/ 2000MB of 667MHz DDR2 SDRAM running MAC OS > > 10.5.6 and a lots of software running (a t

Re: Getting final url when original url redirects

2009-03-12 Thread Albert Hopkins
On Thu, 2009-03-12 at 12:57 -0700, IanR wrote: > I'm processing RSS content from a # of given sources. Most of the > time the url given by the RSS feed redirects to the real URL (I'm > guessing they do this for tracking purposes) > > For example. > > This is a url that I get from and RSS feed, >

Re: How to find "in" in the documentation

2009-03-13 Thread Albert Hopkins
On Fri, 2009-03-13 at 21:01 +, tinn...@isbd.co.uk wrote: > I've had this trouble before, how do I find the details of how "in" > works in the documentation. E.g. the details of:- > > if string in bigstring: > > It gets a mention in the "if" section but not a lot. > >From http://docs.py

Re: Neatest way to do a case insensitive "in"?

2009-03-13 Thread Albert Hopkins
On Fri, 2009-03-13 at 21:04 +, tinn...@isbd.co.uk wrote: > What's the neatest way to do the following in case insensitive fashion:- > > if stringA in stringB: > bla bla bla > > I know I can just do:- > > if stringA.lower() in stringB.lower(): > bla bla bla > > But I

Re: Tuple passed to function recognised as string

2009-03-18 Thread Albert Hopkins
On Wed, 2009-03-18 at 16:58 -0700, Mike314 wrote: > Hello, > >I have following code: > > def test_func(val): > print type(val) > > test_func(val=('val1')) > test_func(val=('val1', 'val2')) > > The output is quite different: > > > > > Why I have string in the first case? You could h

Re: Can I rely on...

2009-03-19 Thread Albert Hopkins
On Thu, 2009-03-19 at 08:42 -0700, Emanuele D'Arrigo wrote: > Hi everybody, > > I just had a bit of a shiver for something I'm doing often in my code > but that might be based on a wrong assumption on my part. Take the > following code: > > pattern = "aPattern" > > compiledPatterns = [ ] > compi

Re: Missing values in tuple assignment

2009-03-19 Thread Albert Hopkins
On Thu, 2009-03-19 at 11:57 -0500, Jim Garrison wrote: > Use case: parsing a simple config file line where lines start with a > keyword and have optional arguments. I want to extract the keyword and > then pass the rest of the line to a function to process it. An obvious > use of split(None,1) >

Re: Neatest way to do a case insensitive "in"?

2009-03-19 Thread Albert Hopkins
On Fri, 2009-03-20 at 07:25 +1100, Jervis Whitley wrote: > > > >if stringA.lower() in stringB.lower(): > >bla bla bla > > > > from string import lower > > if lower(stringA) in lower(stringB): > # was this what you were after? > This is analogous to standing behind a

Re: Neatest way to do a case insensitive "in"?

2009-03-19 Thread Albert Hopkins
On Fri, 2009-03-20 at 08:52 +1100, Jervis Whitley wrote: > On Fri, Mar 20, 2009 at 8:28 AM, Albert Hopkins > wrote: > > On Fri, 2009-03-20 at 07:25 +1100, Jervis Whitley wrote: > >> > > >> >if stringA.lower() in stringB.lower(): > >> >

Re: get rid of duplicate elements in list without set

2009-03-20 Thread Albert Hopkins
On Fri, 2009-03-20 at 07:16 -0700, Alexzive wrote: > Hello there, > > I'd like to get the same result of set() but getting an indexable > object. > How to get this in an efficient way? > > Example using set > > A = [1, 2, 2 ,2 , 3 ,4] > B= set(A) > B = ([1, 2, 3, 4]) > > B[2] > TypeError: unin

Re: meta question - how to read comp.lang.python w/o usenet feed/google interface?

2009-03-20 Thread Albert Hopkins
On Fri, 2009-03-20 at 07:42 -0700, Esmail wrote: > Hi all, > > I've been reading/posting to usenet since the 80s with a variety of > tools (vn, and most recently Thunderbird) but since my ISP > (TimeWarner) no longer provides usenet feeds I'm stuck. > > I am not crazy about the web interface via

Re: get rid of duplicate elements in list without set

2009-03-20 Thread Albert Hopkins
On Fri, 2009-03-20 at 07:54 -0700, thomasvang...@gmail.com wrote: > You could use: > B=list(set(A)).sort() > Hope that helps. Which will assign None to B. sorted(list(... or B.sort() is probably what you meant. -- http://mail.python.org/mailman/listinfo/python-list

Re: py2exe linux equivalent

2009-03-20 Thread Albert Hopkins
On Fri, 2009-03-20 at 12:59 -0700, Brendan Miller wrote: > I have a python application that I want to package up and deploy to > various people using RHEL 4. > > I'm using python 2.6 to develop the app. The RHEL 4 machines have an > older version of python I'd rather not code against (although tha

Re: A problem with subprocess

2009-03-20 Thread Albert Hopkins
On Fri, 2009-03-20 at 22:14 -0400, Colin J. Williams wrote: > Below is a test script: > > # tSubProcess.py > > import subprocess > import sys > try: >v= subprocess.Popen('ftype > py=C:\Python25\Python.exe') > except WindowsError: >print(sys.exc_info()) > > Here is the output: > > *** P

Re: __init__ vs. __del__

2009-03-21 Thread Albert Hopkins
On Sat, 2009-03-21 at 17:41 -0700, Randy Turner wrote: > Hi, > > > I was reading a book on Python-3 programming recently and the book > stated that, while there is an __init__ method for initializing > objects, there was a __del__ method but the __del__ method is not > guaranteed to be called whe

Re: 3.0 - bsddb removed

2009-03-22 Thread Albert Hopkins
On Sun, 2009-03-22 at 15:55 +, Sean wrote: > Anyone got any thoughts about what to use as a replacement. I need > something (like bsddb) which uses dictionary syntax to read and write an > underlying (fast!) btree or similar. > gdbm -- http://mail.python.org/mailman/listinfo/python-list

Re: Another form of dynamic import

2009-03-25 Thread Albert Hopkins
Also, instead of caching exceptions you can do lazy lookups kinda like this: - # a.py class A: pass - # b.py class B:

  1   2   3   >