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
> Does Jython 2.5 honour the PYTHONSTARTUP environment variable? According > to my testing, it doesn't. > > There used to be a page describing the differences between Jython and > CPython here: > > http://www.jython.org/docs/differences.html > > but it appears to have been eaten by the 404 Monst

RE: emded revision control in Python application?

2012-06-22 Thread Prasad, Ramit
>I have an application that would benefit from collaborative > working. Over time users construct a "data environment" which is a > number of files in JSON format contained in a few directories (in the > future I'll probably place these in a zip so the environment is > contained within a si

RE: using SQLalchemy

2012-06-22 Thread Prasad, Ramit
> > We have a very chaotic database (on MySql) at the moment, with for > > I'm trying to use SQLalchemy and it looks absolutely great, but in > > general as a policy we don't use external dependencies.. > > That's a very foolish general policy, a lot of the power of python is in > the huge array o

RE: how to interact with Windows cmd?

2012-07-10 Thread Prasad, Ramit
> what I want to do is > 1.open cmd > 2.waiting for user's typing > 3.when I type "dir" > 4.print the result of "dir" > 5.then I type some other commands, printing the result until I type > 'exit' > > I used > p=subprocess.Popen('cmd',stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=s > ubproce

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) while OS X will m

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: function sees VERBOSE False > Haskell

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
>('per1','persona1.1','pro1'),('per1','persona1.1','pro2'),('per1','persona1.1','pro3'),('per1','persona1.1','pro4'),('per1','persona1.1','pro5'),('per2','persona2.1','pro1'),('per2','persona2.1','pro2'),('per2','persona2.1','pro3'),('per2','persona2.1','pro4'),('per2','persona2.1','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
? wrote: > I'm a little teapot ... himself the question: if I want to appeal to the > widget, knowing his name... ? > > # appropriated the name of the widget > label = Label(frame, width = 40, text='text', name = 'name') > ... > name_='name' > configure(name_) > ... > def configure(n

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
Den wrote: > On Wednesday, October 17, 2012 11:06:43 PM UTC-7, Zero Piraeus wrote: > > : > > > > > > What are people's preferred strategies for dealing with lines that go > > > > over 79 characters? A few I can think of off the bat: > > > > I personally just keep typing until my statement is finis

RE: A desperate lunge for on-topic-ness

2012-10-18 Thread Prasad, Ramit
Chris Angelico wrote: > On Fri, Oct 19, 2012 at 3:13 AM, Neil Cerutti wrote: > > Though technology has moved along swiftly, keeping your code > > accessible to the guy using a crummy old console xterm might > > still be worthwhile, and it makes printouts easy to create. > > And keeping your inte

RE: OT Questions

2012-10-18 Thread Prasad, Ramit
David Hutto wrote: > On Wed, Oct 17, 2012 at 7:12 PM, Steven D'Aprano > wrote: > > On Wed, 17 Oct 2012 18:05:12 -0400, Dwight Hutto wrote: > > > >> this was just a confidence statement that I'm > >> intelligent as well, so don't get uppity with me. > > > > Please tone down the aggression. > > > >

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
Hans Mulder wrote: > On 18/10/12 08:31:51, Steven D'Aprano wrote: > > On Thu, 18 Oct 2012 02:06:19 -0400, Zero Piraeus wrote: > >> 3. Say "well, at least it's not a backslash" and break the line using > >> > parentheses. > > I mostly do this. Since most lines include a bracket of some sort, I > > r

RE: len() on mutables vs. immutables

2012-10-18 Thread Prasad, Ramit
Terry Reedy wrote: > On 10/18/2012 1:23 PM, Demian Brecht wrote: > > > When len() is called passing an immutable built-in type (such as a > > string), I'd assume that the overhead in doing so is simply a function > > call and there are no on-call calculations done. Is that correct? > > See below.

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
Peng Yu wrote > Hi, > > I installed Python using python-2.7.3-macosx10.6.dmg on my Mac OS > 10.8.2. > > When try to use pip to install packages, I get the following message. > Then the installation fails. > > gcc-4.2 not found, using clang instead > > > I then create a link from /usr/bin/gcc t

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
Chris Angelico wrote: > On Sat, Oct 20, 2012 at 4:08 AM, Pradipto Banerjee > wrote: > > 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 fil

RE: Python does not take up available physical memory

2012-10-19 Thread Prasad, Ramit
Pradipto Banerjee wrote: > Thanks, I tried that. Still got MemoryError, but at least this time python > tried to use the physical memory. > What I noticed is that before it gave me the error it used up to 1.5GB (of > the 2.23 GB originally showed as > available) - so in general, python takes up m

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

2012-10-19 Thread Prasad, Ramit
Kevin Holleran wrote: > Hi, > > I have written a script to poll some registry values but remote registry is > turned off through GPO on the > network I need to run it against.  The account running the script is an admin > on these boxes.  Is there a way > for me to turn on remote registry for th

RE: Tkinter Create/Destory Button

2012-10-19 Thread Prasad, Ramit
bbbenrothsch...@gmail.com wrote: > I am trying to create a button in Tkinter and then when it is pressed delete > it/have it disappear. Does anyone > know the simplest script to do that with. Thanks for your help. Try http://www.gossamer-threads.com/lists/python/python/118851 . If you just want

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 confidential and subject to important dis

RE: regex function driving me nuts

2012-10-23 Thread Prasad, Ramit
MartinD wrote: > Hi, > > I'm new to Python. > Does someone has an idea what's wrong. I tried everything. The only regex > that is tested is the last one in a > whole list of regex in keywords.txt > Thanks! > Martin > > > > def checkKeywords( str, lstKeywords ): > > for regex in

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

2012-10-23 Thread Prasad, Ramit
Nick Sabalausky wrote: > On Mon, 22 Oct 2012 14:35:23 -0700 (PDT) > darnold wrote: > > > > i'm not brave enough to dig too deeply into SQLAlchemy, but maybe this > > will help? : > > > > http://kashififtikhar.blogspot.com/2010/07/using-sqlalchemy-reflection-with-pylons.html > > > > that came up fr

RE: Appending a list using list obtained from a class

2012-10-25 Thread Prasad, Ramit
Demian Brecht wrote: > On 2012-10-24, at 8:00 AM, inshu chauhan wrote: > > > Yes, a Class method returns a list. I am trying to append this in main() to > > make another list. > > But the list i am getting after appending i showing addresses like this > > '<__main__.Point object at > 0x0254FAB0

RE: resume execution after catching with an excepthook?

2012-10-25 Thread Prasad, Ramit
andrea crotti wrote: > 2012/10/25 Steven D'Aprano : > > On Wed, 24 Oct 2012 13:51:30 +0100, andrea crotti wrote: > > [snip] > > Without a try...except block, execution will cease after an exception is > > caught, even when using sys.excepthook. I don't believe that there is any > > way to jump back

RE: turn list of letters into an array of integers

2012-10-25 Thread Prasad, Ramit
David Hutto wrote: > On Wed, Oct 24, 2012 at 1:23 AM, seektime wrote: > > Here's some example code. The input is a list which is a "matrix" of > > letters: > >a b a > >b b a > > > > and I'd like to turn this into a Python array: > > > > 1 2 1 > > 2 2 1 > > > > so 1 replaces a, and

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

2012-10-29 Thread Prasad, Ramit
Thomas Rachel wrote: > Am 26.10.2012 09:49 schrieb Ulrich Eckhardt: > > Hi! > > > > General advise when assembling strings is to not concatenate them > > repeatedly but instead use string's join() function, because it avoids > > repeated reallocations and is at least as expressive as any alternativ

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

RE: Python3.3 str() bug?

2012-11-09 Thread Prasad, Ramit
Chris Angelico wrote: > > What you really should be doing is not transforming the whole > structure, but explicitly transforming each part inside it. I > recommend you stop fighting the language and start thinking about your > data as either *bytes* or *characters* and using the appropriate data >

  1   2   3   >