Re: How to exctract title of links

2005-04-26 Thread prasad
import htmllib, formatter, urllib class x(htmllib.HTMLParser): inanchor = True # indicates whether we are inside anchor element def dump(self, tag, attrs): #print tag, for a, v in attrs: if a in ['a', 'src', 'href']: print v, print #

RE: Python 3: dict & dict.keys()

2013-07-24 Thread Prasad, Ramit
Stefan Behnel wrote: > Ethan Furman, 24.07.2013 20:31: > > On 07/24/2013 10:23 AM, Stefan Behnel wrote: > >> Peter Otten, 24.07.2013 08:23: > >>> Ethan Furman wrote: > > So, my question boils down to: in Python 3 how is dict.keys() different > from dict? What are the use cases? > >

RE: Python 3: dict & dict.keys()

2013-07-25 Thread Prasad, Ramit
Terry Reedy wrote: > > On 7/24/2013 4:34 PM, Prasad, Ramit wrote: > > > I am still not clear on the advantage of views vs. iterators. > > A1: Views are iterables that can be iterated more than once. Therefore, > they can be passed to a function that re-iterates its

RE: RE Module Performance

2013-07-25 Thread Prasad, Ramit
Chris Angelico wrote: > On Fri, Jul 26, 2013 at 5:07 AM, wrote: > > Let start with a simple string \textemdash or \texttendash > > > sys.getsizeof('-') > > 40 > sys.getsizeof('a') > > 26 > > Most of the cost is in those two apostrophes, look: > > >>> sys.getsizeof('a') > 26 > >>> sys.

RE: Creating a Simple User Interface for a Function

2013-07-26 Thread Prasad, Ramit
CTSB01 wrote: > On Thursday, July 25, 2013 3:19:27 PM UTC-4, Dave Angel wrote: > > On 07/25/2013 12:03 PM, CTSB01 wrote: > > > > > I have the following code that runs perfectly: > > > > > > > def psi_j(x, j): > > > > >rtn = [] > > > > >for n2 in range(0, len(x) * j - 2

RE: Python Script Hashplings

2013-07-26 Thread Prasad, Ramit
Devyn Collier Johnson wrote: > Thanks Matthew Lefavor! But specifically, why use "#!/usr/bin/env python3" > instead of > "#!/usr/bin/python3"? > > Mahalo, > > DCJ I believe this will work on Windows for Python 3.3+ and also with virtualenv. https://pypi.python.org/pypi/virtualenv Virtualenv i

RE: dump a multi dimensional dictionary

2013-07-26 Thread Prasad, Ramit
cerr wrote: > Hi, > > Can I somehow use pickle.dump() to store a dictionary of lists to a file? > I tried this: > > >>> import pickle > >>> mylist = [] > >>> mydict = {} > >>> mylist = '1','2' > >>> mydict['3'] = mylist > >>> fhg = open ("test", 'w') > >>> pickle.dump(

RE: Jython and PYTHONSTARTUP

2012-06-22 Thread Prasad, Ramit
;" http://www.jython.org/docs/tutorial/interpreter.html?highlight=pythonstartup Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main Street | Houston, TX 77002 work phone: 713 - 216 - 5423 -- This email is confidential and subject to important disclaimers and cond

RE: emded revision control in Python application?

2012-06-22 Thread Prasad, Ramit
y: table_name( revision_number, file/config name, data, username, timestamp ). Otherwise, if you want to track "environments" and not files: table_name( revision_number, data, username, timestamp ). Where revision number can be a sequence used to track / change current configuration. I r

RE: using SQLalchemy

2012-06-22 Thread Prasad, Ramit
have better things to do than implementing a dozen (or more) major libraries like lxml and xlwt just to name a few. For that matter, I do not think mysqldb is a built-in Python package. :) Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main Street | Houston, TX

RE: how to interact with Windows cmd?

2012-07-10 Thread Prasad, Ramit
ect > 2. after this, I typed like "cd .." but I/O is already closed so I > can't do another things.. > > Is there any good way? Not much experience with subprocess, but from what I have read on here shell=True is usually bad. If you are trying to use Python as a s

RE: How to safely maintain a status file

2012-07-13 Thread Prasad, Ramit
while OS X will move a file to Trash quite happily only tell me it cannot remove the file when I try to empty the Trash. Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main Street | Houston, TX 77002 work phone: 713 - 216 - 5423 -- This email is confidentia

RE: lambda in list comprehension acting funny

2012-07-13 Thread Prasad, Ramit
t;> VERBOSE = True >>> caller() calling function with arg 1 I might be being OCD, but caller needs `global VERBOSE` for that to work as you explain. Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main Street | Houston, TX 77002 work phone: 713 - 216 - 542

RE: adding a simulation mode

2012-07-13 Thread Prasad, Ramit
> > Please do NOT catch BaseException, since that is the wrong thing to do. > > I would agree if you had said "in production code". > > If you are investigating why a third-party function is stopping your > interpreter, then catching BaseException may tell you that the code > is raising the wrong

RE: [Python] RE: How to safely maintain a status file

2012-07-13 Thread Prasad, Ramit
> >> Well "neat tricks" aside, I am of the firm belief that deleting files > should > >> never be possible whilst they are open. > > This is one of the few instances I think Windows does something better > > than OS X. Windows will check before you attempt to delete (i.e. move > > to Recycling Bin)

RE: lambda in list comprehension acting funny

2012-07-13 Thread Prasad, Ramit
> >> VERBOSE = True > >> > >> def function(arg): > >> if VERBOSE: > >>print("calling function with arg %r" % arg) > >> process(arg) > >> > >> def caller(): > >> VERBOSE = False > >> function(1) > >> > >> - > >> Python semantics: fu

RE: assertraises behaviour

2012-07-17 Thread Prasad, Ramit
> > import unittest > > > > class TestWithRaises(unittest.TestCase): > > def test_first(self): > > assert False > > > > def test_second(self): > > print("also called") > > assert True > > > > if __name__ == '__main__': > > unittest.main() > > > > in this ca

RE: assertraises behaviour

2012-07-17 Thread Prasad, Ramit
> On 17/07/2012 18:49, Prasad, Ramit wrote: > >>> import unittest > >>> > >>> class TestWithRaises(unittest.TestCase): > >>> def test_first(self): > >>> assert False > >>> > >>>

RE: shutil ignore fails on passing a tuple?

2012-07-19 Thread Prasad, Ramit
> >>> ipatterns > ('*.txt', '*.hdf', '*.pdf', '*.png') > >>> igf = shutil.ignore_patterns(ipatterns) > >>> ignorethis = igf(ddftopdir,os.listdir(ddftopdir)) > > Traceback (most recent call last): > File "", line 1, in > ignorethis = igf(ddftopdir,os.listdir(ddftopdir)) > File "C:\Python27

RE: Finding duplicate file names and modifying them based on elements of the path

2012-07-19 Thread Prasad, Ramit
> > I am making the assumption that you intend to collapse the directory > > tree and store each file in the same directory, otherwise I can't think > > of why you need to do this. > > Hi Simon, thanks for the reply. It's not quite this - what I am doing > is creating a zip file with relative path

RE: help

2012-07-19 Thread Prasad, Ramit
er2','persona2.3','pro1'),('per2','persona2.3','pro2'),('per2','persona2.3','pro3'),('per2','persona2.3','pro4'),('per2','persona2.3','pro5'),('per2&

RE: from future import pass_function

2012-07-26 Thread Prasad, Ramit
> No offence to all the well meaning participants here, but this looks like > trolling I thought Ranting Rick had sole dominion over trolling? Ramit This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accura

RE: Is Python a commercial proposition ?

2012-07-30 Thread Prasad, Ramit
> I work in financials and the majority of our apps are developed in C++ > and Java yet all the tools that startup, deploy and conduct rigorous > unit testing are implemented in Python or Shell scripts that wrap > Python scripts. > > Python definitely has its place in the enterprise however not so

RE: [Python] Re: PyPI question, or, maybe I'm just stupid

2012-07-30 Thread Prasad, Ramit
> > However, personally, I am not interested in all the details (typically > > found in "CHANGES.txt") but some (often implicit) information is > > sufficient for me: something like "major API change", "minor bug > > fixes". Thus, think carefully what you put on the overview page. > I see your poi

RE: [ANN] pyknon: Simple Python library to generate music in a hacker friendly way.

2012-07-30 Thread Prasad, Ramit
> >> I would suggest you change the theme -- using Firefox 3.6 the page is > >> very difficult to read. > > > > Thanks for the report. Do you mind if I ask why you are using such an > > old version? > > (It looks fine with Firefox 14.0.1) > > > That version works for me -- I don't like upgrading

RE: why the different output in Eclipse and Python Shell?

2012-08-01 Thread Prasad, Ramit
> > my code in Eclipse: > > > > dict.fromkeys(['China','America']) > > print "dict is",dict > > > > output: dict is > > > > my code in Python Shell: > > > > dict.fromkeys(['China','America']) > > > > output:{'America': None, 'China': None} > > > > Output in Python Shell is what i wanna,but why not

RE: EXTERNAL: Re: missing python-config and building python on Windows

2012-08-01 Thread Prasad, Ramit
> On 7/31/2012 11:49 PM, Mark Hammond wrote: > > On 1/08/2012 10:48 AM, Damon Register wrote: > >> 1. though I have looked in a few readme files, I don't see instructions for > >> installing what I have just built using MSVC. Where can I find the > >> instructions for installing after buil

RE: Is Python a commercial proposition ?

2012-08-02 Thread Prasad, Ramit
> I'm in stuck record mode here, but one of the things I really enjoy > about reading here is the way things do go off topic. IMHO makes for a > far more interesting experience. YMMV. +1 Ramit This email is confidential and subject to important disclaimers and conditions including on offers fo

RE: attribute is accessed from Nonetype

2012-08-03 Thread Prasad, Ramit
> Also, please use the names correctly and consistently. The None object > (yes, there is only one) is not the same as a none object. And there is > no standard type called Nonetype. To be fair, this is not very clear to a beginner. >>> len(None) # Python 2.6 TypeError: object of type 'NoneTyp

RE: Calling Values

2012-08-03 Thread Prasad, Ramit
> def func1(): > > num1=10 > > num2=20 > > print "The Second Number is:",num2 > > return > > > def func2(): > > func1() > num3=num1+num2 > > num4=num3+num1 > > print "New Number One is:",num3 > > print "New Number Two is:",num4 > >

python-list@python.org

2012-08-20 Thread Prasad, Ramit
> > I also tend to blame M$ (Outlook and variants) for this tendency to > > quote everything and top-post -- Outlook makes it almost impossible > > to do a trim&interleave response style. > > I that Outlook & Co are guilty. That and the fact that few people even > think about this. Nonsense, I po

RE: [ANNC] pybotwar-0.8

2012-08-20 Thread Prasad, Ramit
>Look you are the only person complaining about top-posting. >GMail uses top-posting by default. >I can't help it if you feel irritated by it. He is most certainly not the only person to feel irritated nor even the only person who has requested you not to top post. He does happen to be the most

RE: [ANNC] pybotwar-0.8

2012-08-20 Thread Prasad, Ramit
> I'll be using Google Groups (hopefully it won't top-post by default) to post > stuff. Thanks for not top-posting. Even if it is the default, it is not difficult to change. :) Ramit This email is confidential and subject to important disclaimers and conditions including on offers for the pu

python-list@python.org

2012-08-24 Thread Prasad, Ramit
Ulrich Eckhardt wrote: > A good tool would reduce the effort and guide users, like e.g. giving > them a hint if they leave the whole mail they're replying to as copy. > Several corporate email solutions (like MS Outlook/Exchange) put very > little emphasis on communication efficiency but only on ey

RE: help with simple print statement!

2012-08-24 Thread Prasad, Ramit
Willem Krayenhoff Any idea why print isn't working here?   I tried restarting my Command prompt.  Also, print doesn't work inside a class. -- Best Wishes,      Bruce      C: 604-441-5791      My Availability  Just as a note, this is a usenet group that can be accessed via email; a good po

RE: How to print something only if it exists?

2012-09-13 Thread Prasad, Ramit
tinn...@isbd.co.uk wrote: > I want to print a series of list elements some of which may not exist, > e.g. I have a line:- > > print day, fld[1], balance, fld[2] > > fld[2] doesn't always exist (fld is the result of a split) so the > print fails when it isn't set. > > I know I could simply u

RE: Comparing strings from the back?

2012-09-13 Thread Prasad, Ramit
Dwight Hutto wrote: > Why don' you just time it,eit lops through incrementing thmax input/ What? Without context I have no idea what this means. Ramit -- This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities,

RE: pythonOCC examples doesn't work?

2012-09-13 Thread Prasad, Ramit
Dwight Hutto wrote: [snip] > On Wed, Sep 12, 2012 at 3:37 AM, Mark Lawrence > wrote: [snip] > Others would be able to see this for themselves but > > you insist on sending email without context. Please don't do this. > > How are my emails without context? I'm referring the OP to the docs,

RE: Which Version of Python?

2012-09-13 Thread Prasad, Ramit
Ramchandra Apte wrote: > On Wednesday, 12 September 2012 14:11:56 UTC+5:30, Ramchandra Apte wrote: > > On Wednesday, 12 September 2012 14:04:56 UTC+5:30, alex23 wrote: > > > On 12 Sep, 16:31, Mark Lawrence wrote: > > > > Perhaps this will sway youhttp://docs.python.org/dev/whatsnew/3.3.html > >

RE: Comparing strings from the back?

2012-09-14 Thread Prasad, Ramit
Dwight Hutto wrote: > On Thu, Sep 13, 2012 at 5:17 PM, Mark Lawrence > wrote: > > On 13/09/2012 21:34, Joshua Landau wrote: > >> > >> On 13 September 2012 20:53, Mark Lawrence > wrote:acci sequence > >> > >>> On 13/09/2012 19:39

RE: pythonOCC examples doesn't work?

2012-09-14 Thread Prasad, Ramit
Dwight Hutto wrote: > Chris Angelico wrote: > > honest. How do you feel? Interesting... > > > Um, I guess like an inconsiderate bandwidth hog, but from now on I'll > trim more text. > > First it was too little, and now it's too much. It is a fine line to walk and nobody does it perfectly all the

RE: Comparing strings from the back?

2012-09-14 Thread Prasad, Ramit
Dwight Hutto wrote: > On Fri, Sep 14, 2012 at 4:20 AM, alex23 wrote: > > On Sep 14, 6:04 pm, Dwight Hutto wrote: > >> > Using foreign names derogatively is a common tactic of the racist. > >> > >> Not really. But nice spin on my pun to make me look bad. > > > > It actually *is* common behaviour o

RE: Decorators not worth the effort

2012-09-14 Thread Prasad, Ramit
Jean-Michel Pichavant wrote: [snip] > Ultimately, the goal is to have something like > > @timeout(2) > def doAction1 > > @timeout(4) > def doAction2 [snip] > Here's Steven example: > > # Untested! > def timeout(t=15): > # Decorator factory. Return a decorator to actually do the work. >

RE: How to limit CPU usage in Python

2012-09-27 Thread Prasad, Ramit
Paul Rubin wrote: > Rolando Cañer Roblejo writes: > > Is it possible for me to put a limit in the amount of processor usage > > (% CPU) that my current python script is using? Is there any module > > useful for this task? > > One way is check your cpu usage once in a while, compare with elapsed >

RE: Redirecting STDOUT to a Python Variable

2012-09-27 Thread Prasad, Ramit
Hans Mulder wrote: > On 22/09/12 23:57:52, ross.mars...@gmail.com wrote: > > To capture the traceback, so to put it in a log, I use this > > > > import traceback > > > > def get_traceback(): # obtain and return the traceback > > exc_type, exc_value, exc_traceback = sys.exc_info() > > return

RE: One of my joomla webpages has been hacked. Please help.

2012-09-27 Thread Prasad, Ramit
? G??ee? wrote: > I shouldn't have asked about Joomla here, or even about Python embedding > within Joomla cms. I was under the impression that the latter was relevant to > ask here but it seems it isnt. > > My bad, let's just close this thread so i don't waste anyone's time. Now when/if you

RE: For Counter Variable

2012-09-27 Thread Prasad, Ramit
Tim Chase wrote: > [snip] though I'm minorly miffed that > enumerate()'s starting-offset wasn't back-ported into earlier 2.x > versions and have had to code around it for 1-based indexing; either > extra "+1"s or whip up my own simple enumerate() generator). Starting offset is in Python 2.6, unle

RE: Capitalization for variable that holds a class

2012-09-27 Thread Prasad, Ramit
Dennis Lee Bieber wrote: > Sent: Sunday, September 23, 2012 11:53 AM > To: python-list@python.org > Subject: Re: Capitalization for variable that holds a class > > On Sun, 23 Sep 2012 16:48:38 +0100, Joshua Landau > declaimed the following in > gmane.comp.python.general: > > > Simple question: >

RE: A little morning puzzle

2012-09-27 Thread Prasad, Ramit
Dwight Hutto wrote: > > Ergo: 'enumerate()' is the correct suggestion over manually > > maintaining your own index, despite it ostensibly being "more" code > > due to its implementation. > > But, therefore, that doesn't mean that the coder can just USE a > function, and not be able to design it th

RE: Fastest web framework

2012-09-27 Thread Prasad, Ramit
Andriy Kornatskyy wrote: > Try to see 'Hello World' benchmark as an answer to the question how effective > is the framework inside... > > If computer X boots faster than Y, it means it is more effective in this > particular area. > > If a sportsman runs a distance 1 second faster than other, he g

RE: data attributes override method attributes?

2012-09-28 Thread Prasad, Ramit
Terry Reedy wrote: > On 9/25/2012 4:07 PM, Ian Kelly wrote: > > On Tue, Sep 25, 2012 at 1:58 PM, Terry Reedy wrote: > >> On 9/25/2012 11:03 AM, Chris Angelico wrote: > >>> Instance attributes override (shadow) class attributes. > >> > >> > >> except for (some? all?) special methods > > > > Those n

RE: regular expression : the dollar sign ($) work with re.match() or re.search() ?

2012-09-28 Thread Prasad, Ramit
iMath wrote: > Sent: Wednesday, September 26, 2012 2:39 AM > To: python-list@python.org > Subject: regular expression : the dollar sign ($) work with re.match() or > re.search() ? > > I only know the dollar sign ($) will match a pattern from the > end of a string,but which method does it work wi

RE: [python-list] python application file format

2012-09-28 Thread Prasad, Ramit
Benjamin Jessup wrote: > Hello all, > > What do people recommend for a file format for a python desktop > application? Data is complex with 100s/1000s of class instances, which > reference each other. > > Write the file with struct module? (Rebuild object pointers, safe, > compact, portable, not

RE: Experimental Python-based shell

2012-10-04 Thread Prasad, Ramit
(A little quoting manipulation to make it easier to read with appropriate context.) > > On Wed, Oct 3, 2012 at 11:25 AM, Amirouche Boubekki > > wrote: > > > 2012/10/3 Jonathan Hayward > > > The chief benefit besides the searching, so far, is that you can use Py3k > > > mixed with shell command

RE: final question: logging to stdout and updating files

2012-10-04 Thread Prasad, Ramit
Chris Angelico wrote: > Sent: Thursday, October 04, 2012 9:28 AM > To: python-list@python.org > Subject: Re: final question: logging to stdout and updating files > > On Fri, Oct 5, 2012 at 12:00 AM, Steven D'Aprano > wrote: > > That is *terrible* advice. But if you insist on following it, you can

RE: notmm is dead!

2012-10-05 Thread Prasad, Ramit
Steven D'Aprano wrote: > Sent: Thursday, October 04, 2012 7:22 PM > To: python-list@python.org > Subject: Re: notmm is dead! > > On Thu, 04 Oct 2012 14:10:46 -0400, Etienne Robillard wrote: > > > Dear list, > > > > Due to lack of energy and resources i'm really sad to announce the > > removal of

RE: Insert item before each element of a list

2012-10-08 Thread Prasad, Ramit
Agon Hajdari wrote: > Sent: Monday, October 08, 2012 3:12 PM > To: python-list@python.org > Subject: Re: Insert item before each element of a list > > On 10/08/2012 09:45 PM, Chris Kaynor wrote: > > [('insertme', i) for i in x] > > This is not enough, you have to merge it afterwards. Why do you

RE: Insert item before each element of a list

2012-10-08 Thread Prasad, Ramit
Agon Hajdari wrote: > On 10/08/2012 11:15 PM, Prasad, Ramit wrote: > > Agon Hajdari wrote: > >> > >> On 10/08/2012 09:45 PM, Chris Kaynor wrote: > >>> [('insertme', i) for i in x] > >> > >> This is not enough, you have to merge it

RE: Unpaking Tuple

2012-10-08 Thread Prasad, Ramit
Thomas Bach wrote: > Hi there, > > On Sat, Oct 06, 2012 at 03:08:38PM +, Steven D'Aprano wrote: > > > > my_tuple = my_tuple[:4] > > a,b,c,d = my_tuple if len(my_tuple) == 4 else (my_tuple + (None,)*4)[:4] > > > > Are you sure this works as you expect? I just stumbled over the following: > >

RE: RE: Unpaking Tuple

2012-10-09 Thread Prasad, Ramit
Bob Martin wrote > in 682592 20121008 232126 "Prasad, Ramit" wrote: > >Thomas Bach wrote:=0D=0A> Hi there,=0D=0A> =0D=0A> On Sat, Oct 06, 2012 at = > >03:08:38PM +, Steven D'Aprano wrote:=0D=0A> >=0D=0A> > my_tuple =3D my_= > >tuple[:4

RE: for-loop on cmd-line

2012-10-11 Thread Prasad, Ramit
Chris Angelico wrote: > On Fri, Oct 12, 2012 at 3:49 AM, Gisle Vanem wrote: > > wrote in comp.lang.python > > > > (my ISP no longer updates this group. Last message is from 8. April. > > Does the postings to the python mailing-list automatically get reposted to > > comp.lang.python?) > > Yes, c.

RE: Tkinter how to access the widget by name

2012-10-15 Thread Prasad, Ramit
Label(frame, width = 40, text='text', name = 'name') widgets.append( label ) def configure(name_): found = False for w in widgets: if w.name == name_: # No idea how to get name from Tk widget found = True break if found: #

RE: Aggressive language on python-list

2012-10-16 Thread Prasad, Ramit
Steven D'Aprano wrote: > On Tue, 16 Oct 2012 09:27:48 -0700, rurpy wrote about trolls and dicks: > > > The best advise is to ignore such posts and encourage others to do the > > same. > > If you ignore such posts, how will the poster know they are unacceptable? > > How should somebody distinguis

RE: system tray or notification area in python

2012-10-16 Thread Prasad, Ramit
Daniel Fetchinson wrote: > >> Hi folks, > >> > >> I'm using a stand alone window manager without gnome or kde or any > >> other de. But I still would like to have a system tray or notification > >> area and so far used stalonetray for this. Stalonetray is written in C > >> and is a GTK application,

RE: OT Questions

2012-10-17 Thread Prasad, Ramit
David Hutto wrote: > On Wed, Oct 17, 2012 at 2:06 AM, Demian Brecht wrote: > > * Your strength is not design. Using bevel and emboss (and a pattern here > > and there) does not constitute good > design. > > It's simplicity within a symbolism, and now that I need money for > medical reasons, the

RE: A desperate lunge for on-topic-ness

2012-10-18 Thread Prasad, Ramit
st in the developer communities). They often default to 80 characters, but handle various sizes. So that comparison is not quite fair. Ramit Prasad This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, ac

RE: A desperate lunge for on-topic-ness

2012-10-18 Thread Prasad, Ramit
> ChrisA > -- Home and end do not bother me much as I can usually use ctrl+a/ctrl+e for the same purpose. I do wish I found a better way to page up/down. Ramit Prasad This email is confidential and subject to important disclaimers and conditions including on offers for the purchase o

RE: OT Questions

2012-10-18 Thread Prasad, Ramit
you write here is public and can be seen by anyone with access to the Internet and a search engine. That includes prospective clients/employers! I know there is an increasing trend for employers to search the Internet to learn about potential employees. I do the same before I hire a company fo

RE: OT Questions

2012-10-18 Thread Prasad, Ramit
David Hutto wrote: > On Wed, Oct 17, 2012 at 12:38 PM, Prasad, Ramit > wrote: > > David Hutto wrote: > >> On Wed, Oct 17, 2012 at 2:06 AM, Demian Brecht > >> wrote: [snip] > > > The question is whose opinion matters. Yours? Mine? Others? Personally, >

RE: A desperate lunge for on-topic-ness

2012-10-18 Thread Prasad, Ramit
not look like it was un-indented to be part of a different block. if looks_like_it_might_be_spam( some_longer_variables, here_and_here, and_here_also): logger.notice("might be spam") move_to_spam_folder(some_longer_variables) update_spam_statistics(here_

RE: len() on mutables vs. immutables

2012-10-18 Thread Prasad, Ramit
time. That includes the possibility > of a subtraction as indicated above. > Why does pointer arithmetic work for dicts? I would think the position of a value would be based on the hash of the key and thus "random" for the context of this conversation. Ramit Prasad This email is

RE: len() on mutables vs. immutables

2012-10-18 Thread Prasad, Ramit
Ian Kelly wrote: > Sent: Thursday, October 18, 2012 2:39 PM > To: Python > Subject: Re: len() on mutables vs. immutables > > On Thu, Oct 18, 2012 at 1:18 PM, Prasad, Ramit > wrote: > > Why does pointer arithmetic work for dicts? I would think the position > > of

RE: pip fails to install packages on moutain loin (Mac OS 10.8.2)

2012-10-18 Thread Prasad, Ramit
it separate from the OS X system Python. MacPorts will take care of everything for you as long as you have Xcode installed. `sudo ports install py27-pip` Ramit Prasad This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sal

RE: Python does not take up available physical memory

2012-10-19 Thread Prasad, Ramit
Emile van Sebille wrote: > On 10/19/2012 10:08 AM, Pradipto Banerjee wrote: > > Hi, > > > > I am trying to read a file into memory. The size of the file is around 1 > > GB. I have a 3GB memory PC and the Windows Task Manager shows 2.3 GB > > available physical memory when I was trying to read the

RE: Python does not take up available physical memory

2012-10-19 Thread Prasad, Ramit
ython 2.5+ I would do the following instead. with open(filename) as f: for line in f: # do something with line This will automatically close the file when it is done. I doubt it will help with memory issues, but closing files after you are done with them is a Good practice. Ram

RE: Python does not take up available physical memory

2012-10-19 Thread Prasad, Ramit
python takes up more memory than the size of the > file itself. Of course it will. Python has to keep its own code in memory and load the file. Not to mention that the file is converted from data into a Python object with its own overhead. Ramit Prasad This email is confidential and su

RE: Is there a way to programmatically turn on remote registry?

2012-10-19 Thread Prasad, Ramit
oft.com/en-us/library/cc754820.aspx [2] http://fuzzytolerance.info/using-python-to-manage-windows-services/ Ramit Prasad This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of inform

RE: Tkinter Create/Destory Button

2012-10-19 Thread Prasad, Ramit
you just want to disable/enable the button while leaving it visible maybe try setting the config state as shown here: http://www.daniweb.com/software-development/python/threads/69669/tkinter-button-disable-# . Hope that helps, Ramit Prasad This email is confidential and subject to important di

RE: A desperate lunge for on-topic-ness

2012-10-22 Thread Prasad, Ramit
Roy Smith wrote: > Pet peeve of the day... > > Why do you have to write: > > global foo > foo = 4 > > when > > global foo = 4 > > would have been so much easier? To make it more annoying for people who use globals, duh. :) Ramit Prasad This email is c

RE: regex function driving me nuts

2012-10-23 Thread Prasad, Ramit
t is always helpful to provide python version, operating system version, full error message, and input/expected output for the code. Now I can tell you are using Python 2.x but without having any clue what is in keywords1.txt it is impossible to figure out what the problem might be. Other than us

RE: SQLAlchemy: How to do Table Reflection and MySQL?

2012-10-23 Thread Prasad, Ramit
ms to > defeat much of the point for me. I may as well just set up the tables > manually without the reflection, which is what I'll probably do. > > Maybe I just misunderstood what was meant in the SQLAlchemy docs here?: > > "but note that SA can also “import” whole

RE: Appending a list using list obtained from a class

2012-10-25 Thread Prasad, Ramit
s the str version. >>> class t(object): ... def __str__(self): ... return 'str' ... def __repr__(self): ... return 'repr' ... >>> a = t() >>> print [a] [repr] >>> print a str >>> print a.__class__.__base_

RE: resume execution after catching with an excepthook?

2012-10-25 Thread Prasad, Ramit
t; long time. Probably needed only by me in debugging mode, but anyway I > can do the simple try/except then, thanks.. On the other hand, if you store state externally (pickle?) maybe you can just restart at the last "check point". That way even if the program dies you can recover on

RE: turn list of letters into an array of integers

2012-10-25 Thread Prasad, Ramit
> for num in range(0,range_of_seq): >if num % 3 != 0: >next_3_d_array.append(num) >if num % 3 == 0: >array_list.append(next_3_d_array) >next_3_d_array = [ ] > Wow, that looks complicated. Why hardcode to

RE: better way for ' '.join(args) + '\n'?

2012-10-29 Thread Prasad, Ramit
arg 2', > "even args containing a ' are ok") > > For Windows, you'll have to modify this somehow. > The subprocess module suggests using pipes.quote for escaping. >>> a ('program name', 'argu"ment 1', '$arg 2', &q

RE: how to change os.popen4 to subprocess

2012-10-30 Thread Prasad, Ramit
Replying to skyworld because I could not find the original message from MRAB. skyworld wrote: > On Oct 27, 11:02 am, MRAB wrote: > > On 2012-10-27 03:28, skyworld wrote:> Hi, > > > > > I'm new to python and I'm trying to porting some scripts from v0.96 to > > > v2.0.1. A piece of code is like thi

RE: date and time comparison how to

2012-10-31 Thread Prasad, Ramit
Gary Herron wrote: > On 10/29/2012 04:13 PM, noydb wrote: > > All, > > > > I need help with a date and time comparison. > > > > Say a user enters a date-n-time and a file on disk. I want to compare the > > date and time of the file to the > entered date-n-time; if the file is newer than the enter

RE: Obnoxious postings from Google Groups

2012-11-06 Thread Prasad, Ramit
Grant Edwards wrote: > On 2012-11-05, Roy Smith wrote: > > In article , > > Chris Angelico wrote: > > > >> It's nothing to do with operating system. File names are names, and > >> spaces in them are seldom worth the hassle unless you manipulate those > >> files solely using a GUI. > > > > That's

RE: Obnoxious postings from Google Groups

2012-11-06 Thread Prasad, Ramit
Steven D'Aprano wrote: > > On Mon, 05 Nov 2012 14:47:47 -0500, Dennis Lee Bieber wrote: > [snip] > > Nevertheless, I do tend to prefer underscores to spaces, simply because I > often use naive tools that treat spaces as separators. That is, command > line shells. I visually prefer spaces but it

RE: Multi-dimensional list initialization

2012-11-06 Thread Prasad, Ramit
Ian Kelly wrote: > > On Tue, Nov 6, 2012 at 1:21 AM, Andrew Robinson > [snip] > > See if you can find *any* python program where people desired the > > multiplication to have the die effect that changing an object in one of the > > sub lists -- changes all the objects in the other sub lists. > >

RE: Logging output to be redirected to a particular folder

2012-11-06 Thread Prasad, Ramit
Dennis Lee Bieber wrote: > > On Tue, 06 Nov 2012 13:26:11 +0100, Peter Otten <__pete...@web.de> > declaimed the following in gmane.comp.python.general: > > > anuradha.raghupathy2...@gmail.com wrote: [snip] > > > def main(): > > >logging.basicConfig(Filename='c://myapp.log', level=logging.ERRO

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

2012-11-06 Thread Prasad, Ramit
Levi Nie wrote: > > Who can give me some practical tutorials on django 1.4 or 1.5? > Thank you. Maybe this will help: http://gettingstartedwithdjango.com/resources/ ~Ramit This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sa

RE: Obnoxious postings from Google Groups

2012-11-06 Thread Prasad, Ramit
Steven D'Aprano wrote: > > On Tue, 06 Nov 2012 17:16:44 +0000, Prasad, Ramit wrote: > > >> To enter the newline, I typed Ctrl-Q to tell bash to treat the next > >> character as a literal, and then typed Ctrl-J to get a newline. > > > > That sounds

RE: Multi-dimensional list initialization

2012-11-06 Thread Prasad, Ramit
Andrew Robinson wrote: > > On 11/06/2012 01:04 AM, Steven D'Aprano wrote: > > On Mon, 05 Nov 2012 21:51:24 -0800, Andrew Robinson wrote: > > [snip] > > Q: What about other mutable objects like sets or dicts? > > A: No, the elements are never copied. > They aren't list multiplication comp

RE: How to only get a list of the names of the non-directory files in current directory ('.')?

2012-11-06 Thread Prasad, Ramit
iMath wrote: > how to get a list of names of everything in the current directory ? http://lmgtfy.com/?q=python+get+files+in+directory ~Ramit This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and

RE: Multi-dimensional list initialization

2012-11-07 Thread Prasad, Ramit
Gregory Ewing wrote: > > Roy Smith wrote: > > Call by social network? The called function likes the object. > > Depending on how it feels, it can also comment on some of the object's > > attributes. > > And then finds that it has inadvertently shared all its > private data with other functions a

RE: Right solution to unicode error?

2012-11-07 Thread Prasad, Ramit
Anders wrote: > > I've run into a Unicode error, and despite doing some googling, I > can't figure out the right way to fix it. I have a Python 2.6 script > that reads my Outlook 2010 task list. I'm able to read the tasks from > Outlook and store them as a list of objects without a hitch. But whe

RE: Right solution to unicode error?

2012-11-08 Thread Prasad, Ramit
wxjmfa...@gmail.com wrote: > > Le jeudi 8 novembre 2012 19:49:24 UTC+1, Ian a écrit : > > On Thu, Nov 8, 2012 at 11:32 AM, Oscar Benjamin > > > > wrote: > > > > > If I want the other characters to work I need to change the code page: > > > > > > O:\>chcp 65001 > > > Active code page: 65001 > > >

RE: Writing game-state data...

2012-11-09 Thread Prasad, Ramit
Graham Fielding wrote: > > Hey, folks, me again! > > I've been puzzling over this for a while now: > > I'm trying to write data to a file to save the state of my game using the > following function: > > def save_game(): >     #open a new empty shelve (possibly overwriting an old one) to write

RE: duck typing assert

2012-11-09 Thread Prasad, Ramit
Andriy Kornatskyy wrote: > > Thank you for all comments. > > > It makes very good sense to say: > > > > duckmatch(IFoo).compare(Foo) > > Since we do duck match of IFoo... but there is no `duck match`, there is > `duck test`. I believe instead of > `compare` is more readable with `equals`. Than

  1   2   3   4   >