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 >

RE: Multi-dimensional list initialization

2012-11-09 Thread Prasad, Ramit
Dennis Lee Bieber wrote: > > On Fri, 9 Nov 2012 17:07:09 +1100, Chris Angelico > declaimed the following in gmane.comp.python.general: > > > On Fri, Nov 9, 2012 at 12:39 PM, Mark Lawrence > > wrote: > > > On 07/11/2012 01:55, Steven D'Aprano wrote: > > >> > > >> > > >> Who knows? Who cares? No

RE: problem with module PyVisa

2012-11-09 Thread Prasad, Ramit
Jean Dubois wrote: > > On 9 nov, 17:40, Rodrick Brown wrote: > > It seems pretty obvious from the error. Try installing the missing lib > > packages. > > > > OSError: /usr/local/vxipnp/linux/bin/libvisa.so.7: cannot open shared > > object file: No such file or directory > > > > Sent from my iPho

RE: How to print python commands automatically?

2012-11-09 Thread Prasad, Ramit
Peng Yu wrote: > > > Is this what you want? > > http://docs.python.org/2/library/trace.html > > I'm not able to get the mixing of the python command screen output on > stdout. Is there a combination of options for this purpose? > > ~/linux/test/python/man/library/trace$ cat main1.py > #!/usr/bin

RE: Printing characters outside of the ASCII range

2012-11-09 Thread Prasad, Ramit
danielk wrote: > > The database I'm using stores information as a 3-dimensional array. The > delimiters between elements are > chr(252), chr(253) and chr(254). So a record can look like this (example only > uses one of the delimiters for > simplicity): > > name + chr(254) + address + chr(254) +

RE: xml data or other?

2012-11-19 Thread Prasad, Ramit
Artie Ziff wrote: > > On 11/9/12 5:50 AM, rusi wrote: > > On Nov 9, 5:54 pm, Artie Ziff wrote: > > # submit correctedinput to etree > I was very grateful to get the "leg up" on getting started down that > right path with my coding. Many thanks to you, rusi. I took your > excellent advices and hav

RE: Python Interview Questions

2012-11-19 Thread Prasad, Ramit
Roy Smith wrote: > > OK, I've just read back over the whole thread. I'm really struggling to > understand what point you're trying to make. I started out by saying: > > > Use a list when you need an ordered collection which is mutable (i.e. > > can be altered after being created). Use a tuple

RE: Index Error

2012-11-20 Thread Prasad, Ramit
Can you please post in plain text and stop top-posting? Thanks. inshu chauhan wrote: > > def distance(c, p): >     dist = sqrt( >     ((c[0]-p[0])**2) + >     ((c[1]-p[1])**2) + >     ((c[2]-p[2])**2) >     ) >     return dist > > > def GenerateRing(x,y, N): Gen

RE: Problem with list.remove() method

2012-11-20 Thread Prasad, Ramit
Alvaro Combo wrote: > > Hi All, > > I'm relatively new to Python... but I have found something I cannot > explain... and I'm sure you can help me. > > I have the following function that serves for removing the duplicates from a > list... It's a simple and (almost) > trivial task. > > I'm usi

RE: 10 sec poll - please reply!

2012-11-20 Thread Prasad, Ramit
Steven D'Aprano wrote: > > On Tue, 20 Nov 2012 07:18:42 -0800, Michael Herrmann wrote: > > > Thanks again for your further replies. So far, it's 4 votes for > > 'send_keys' and 1 vote for 'type'. > > > > Regarding 'send_keys': To me personally it makes sense to send keys _to_ > > something. Howev

RE: Choosing Source Address to Bind Socket to in IMAP Client

2012-11-20 Thread Prasad, Ramit
[email protected] wrote: > > Hello: > > I have a multihomed machine that I would like to run the Python imaplib's > IMAP4 client on. I would like to be > able to specify which interface the underlying socket will bind to as its > source address. How could I best do > this? One

RE: Choosing Source Address to Bind Socket to in IMAP Client

2012-11-20 Thread Prasad, Ramit
[email protected] wrote: > > > I have a multihomed machine that I would like to run the Python imaplib's > > > IMAP4 client on. I would like to be > > > able to specify which interface the underlying socket will bind to as its > > > source address. How could I best do > > > this?

RE: Choosing Source Address to Bind Socket to in IMAP Client

2012-11-20 Thread Prasad, Ramit
[email protected] wrote: > > On Tuesday, November 20, 2012 2:41:58 PM UTC-8, Prasad, Ramit wrote: > > brintoul at controlledthinking.com wrote: > > > > Apologies, I misread your question. > > > > According to the imaplib docs, you can subclass IM

RE: Getting a seeded value from a list

2012-11-23 Thread Prasad, Ramit
Steven D'Aprano wrote: > > On Wed, 21 Nov 2012 14:41:24 +1100, Chris Angelico wrote: > > > However, this still means that the player will see the exact same level > > regenerated every time, absolutely fresh. As previously stated in this > > thread, that's not usually a good thing for encounters,

RE: Problem with subprocess.call and windows schtasks

2012-11-23 Thread Prasad, Ramit
Dave Angel wrote: > > On 11/20/2012 06:41 PM, Tom Borkin wrote: > > (Please don't top-post. Now we lose all the context) > > Using shlex, I now have this: > > #!\Python27\python > > import os, subprocess > > path = os.path.join("C:\\", "Program Files", "Apache Group", "Apache2", > > "htdocs", "c

RE: Getting a seeded value from a list

2012-11-26 Thread Prasad, Ramit
Chris Angelico wrote: > > On Sat, Nov 24, 2012 at 3:27 AM, Prasad, Ramit > wrote: > > Steven D'Aprano wrote: > >> > >> On Wed, 21 Nov 2012 14:41:24 +1100, Chris Angelico wrote: > >> > >> > However, this still means that the player

RE: os.popen and the subprocess module

2012-11-27 Thread Prasad, Ramit
Andrew wrote: > > Hello world, > > I'm working on a script that will run an executable obtaine the output > from the executable > and do some analysis on the output. Essentially the script runs the > executable analyses > the data. > I'm looking into os.popen and the subprocess module, implement

RE: How to sort list of String without considering Special characters and with case insensitive

2012-11-27 Thread Prasad, Ramit
san wrote: > > Please let me know how to sort the list of String in either ascending / > descending order without considering > special characters and case. > ex: list1=['test1_two','testOne','testTwo','test_one'] > Applying the list.sort /sorted method results in sorted list ['test1_two', > 'te

RE: re.search when used within an if/else fails

2012-11-29 Thread Prasad, Ramit
Ramit Prasad wrote: > > Dennis Lee Bieber wrote: > > > > Unless there has been a major change in the parser... (I still don't > > have Python 3.x installed) > > > > I believe is expanded to 8-spaces -- NOT TO NEXT MULTIPLE OF > > 8... >

RE: Imaging libraries in active development?

2012-11-29 Thread Prasad, Ramit
Christian Heimes wrote: > > Am 28.11.2012 19:14, schrieb Michael Torrie: > > I'm curious. What features do you need that pil doesn't have? Other > > than updating pil to fix bugs, support new image types or new versions > > of Python, what kind of active development do you think it needs to > >

RE: re.search when used within an if/else fails

2012-11-29 Thread Prasad, Ramit
Dennis Lee Bieber wrote: > > Unless there has been a major change in the parser... (I still don't > have Python 3.x installed) > > I believe is expanded to 8-spaces -- NOT TO NEXT MULTIPLE OF > 8... A tab is *one* character. Your *editor* may show tabs visually "expanded" or conver

RE: Compare list entry from csv files

2012-11-29 Thread Prasad, Ramit
Anatoli Hristov wrote: > Hello, > > Tried to document a little bit the script, but I'm not that good in that too > :) > > The only problem I have is that I cant compare other field than the > first one in > for ex_phone in phones: > telstr = ex_phone[0].lower() > When I use telstr = ex_p

RE: amazing scope?

2012-11-30 Thread Prasad, Ramit
andrea crotti > > I wrote a script, refactored it and then introducing a bug as below: > > def record_things(): > out.write("Hello world") > > if __name__ == '__main__': > with open('output', 'w') as out: > record_things() > > > but the shocking thing is that it didn't actually

RE: pyHook and time libraries

2012-11-30 Thread Prasad, Ramit
Doron wrote: > > Hey, I'm tring to create a software that records the keyboard/mouse and sends > email of the log every > predetermined period. > > I've manage to make the recorder and the auto-email sender, but I still can't > make both of them work > simultaneously. > > Can someone help me w

RE: please help me to debud my local chat network program

2012-11-30 Thread Prasad, Ramit
Minh Dang wrote: > > can anyone help me? Chris Angelico has given you some good comments which should give you a direction to investigate. This list is a global list and you seem a tad impatient. It is normal to hear back from a few hours to a day or two. Even if I wanted to help, without cont

RE: contextlib.contextmanager and try/finally

2012-01-31 Thread Prasad, Ramit
ally block will execute in a timely fashion. Is that true even in the face of something like sys.exit()? What happens if 1) sys.exit is called while in the same thread 2) sys.exit is called from another thread but while this thread is in context manager? Ramit Ramit Prasad | JPMorgan Chase Investment Ba

RE: unzip function?

2012-02-02 Thread Prasad, Ramit
it is like..." VS. "You are a grade-A moron, it is like..." They both teach; one just does it less offensively. What is obvious to one person is not always obvious to everyone. :) Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main Street |

Python barcode scanner was RE:

2012-02-13 Thread Prasad, 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 conditions including on offers for the purchase or sale of securities, accuracy and complet

RE: name of a sorting algorithm

2012-02-14 Thread Prasad, Ramit
to selection sort is the end result, then every sort would be selection sort. If you meant "put the least element in [0] in the first pass" then that would indeed be selection sort, but that is not what the above code does. The above code is bubble sort. Ramit Ramit Prasad | JPM

RE: name of a sorting algorithm

2012-02-14 Thread Prasad, Ramit
Prasad, Ramit wrote: > My apologies, you are correct. It is a selection sort, just an inefficient > one. Hmm, I think I should say it is neither since it reminds me of a hybrid of both (bubble/selection). The swapping seems very bubble sort, but the looking for the min / max case

RE: name of a sorting algorithm

2012-02-14 Thread Prasad, Ramit
less extreme into the new end element. >It does extra swaps because it combines the swap operation with recording >the temporary extreme while it searches the subrange. My apologies, you are correct. It is a selection sort, just an inefficient one. Ramit Ramit Prasad | JPMorgan Cha

RE: Python to Combine Multiple Excel Worksheets into One Worksheet

2012-02-16 Thread Prasad, Ramit
ad the data from the different worksheets using xlrd and then use xlwt to write to a single worksheet in a new excel file. The csv option is probably not useful since it will just add an intermediary step unless you are converting outside of python (i.e. manually). Ramit Ramit Prasad | JPMorga

RE: TEST AN EXECUTABLE PYTHON SCRIPT SPEED UNDER A PYTHON SHELL

2012-02-16 Thread Prasad, Ramit
nerated - or maybe I'm underestimating the quality of AI. I was wondering the exact same thing. 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 im

RE: OT: Entitlements [was Re: Python usage numbers]

2012-02-17 Thread Prasad, Ramit
e for any necessary post-doctor work (drawing blood, shots, etc.). My total doctor talking time is really 5-10 minutes. Of course, if I was sick in an unusual way then the doctor would see me for longer, but the average doctor tends to see the same couple dozen things over and over. This is

RE: Pickle performing class instantiation ??

2012-02-28 Thread Prasad, Ramit
M3), f) >NameError: name 'self' is not defined You need to create an instance of Pickle first and then manipulate that instance. instance = Pickle( 'something', ['blah'], 5 ) print instance.PM1 Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies T

RE: alternative to with statement?

2012-02-28 Thread Prasad, Ramit
e cached resources here ># return cached resources Is this a common pattern? I thought the point of the context manager was to remove create and close the resources (like with file opening). Seems slightly odd to use just for creation...but maybe only because I have never used it like th

RE: alternative to with statement?

2012-02-28 Thread Prasad, Ramit
you atomically open, use, then close resources but you do NOT want to atomically open, use, then close resources... 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 subj

RE: Question about PyXML and python's stdlib xml

2012-02-29 Thread Prasad, Ramit
x27;s xml better, same or >>>worse then PyXML? Anyway, python's xml is newer - is PyXML deprecated? >Yes. It's a dead project. >> Please keep me in CC, I'm not subscribed to the list. >That may be the problem in the xml-sig case also. I believe a current equiv

RE: Listing children processes

2012-02-29 Thread Prasad, Ramit
n-ideas/14065/ Why the link? If that is supposed to show how you were told off, I do not see it. Even if it were, I still agree with Steven + Ben. Or maybe that's what I get for trying to RTFA. Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main Street | H

RE: HELP ! Popen.terminate() - WindowsError: [Error 5] Access is denied

2012-03-01 Thread Prasad, Ramit
could test by running your program and doing the taskkill in a separate command prompt. Hope that helps, 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 im

RE: What's the best way to write this regular expression?

2012-03-06 Thread Prasad, Ramit
ink the issue is > the new interface. > > Sorry. Oddly, I see no double posting for this thread on my end (email list). Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main Street | Houston, TX 77002 work phone: 713 - 216 - 5423 -- This email is confiden

RE: are int, float, long, double, side-effects of computer engineering?

2012-03-07 Thread Prasad, Ramit
speak for every other school. 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 conditions including on offers for the purchase or sa

RE: Project

2012-03-07 Thread Prasad, Ramit
actable... Or he could be wanting to know how to use something like Facebook API, but with such a vague description it is hard to say. Even harder to be interested in helping since that is such a broad scope. Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main

RE: What's the best way to write this regular expression?

2012-03-07 Thread Prasad, Ramit
;. Normally programs like WinZip / WinRar / 7-zip will do both in one step so you do not need to. Not sure what program you are using... Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main Street | Houston, TX 77002 work phone: 713 - 216 - 5423 -- This email is c

RE: Project

2012-03-07 Thread Prasad, Ramit
> > Pay a smart developer! > > What? For homework? Sure why not? Smart developers could use extra money ;) Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main Street | Houston, TX 77002 work phone: 713 - 216 - 5423 -- This email is confidential

RE: GUI components in python

2012-03-08 Thread Prasad, Ramit
a more useful answer? The TKinter library ships with Python. So I guess that would be the "built-in" classes. Usually though the UI is project dependent and there are several frameworks depending on the features you want. This may help list some of the frameworks and help you choose: htt

RE: "Decoding unicode is not supported" in unusual situation

2012-03-08 Thread Prasad, Ramit
t; id( str ) 505366496 >>> type( bytes ) >>> type( str ) >>> bytes == str True >>> bytes is str True And I do not think they were ever intended to be just ASCII because chr() takes 0 - 256 (non-inclusive) and returns a str. Ramit Ramit Prasad | JPMorga

RE: What's the best way to write this regular expression?

2012-03-08 Thread Prasad, Ramit
uick-edit mode (XP and higher) you just select with left click and then hit enter which copies it to the clipboard. If you also enable insert mode (not sure if this is Win7 specific) you can even right click to paste into the console, just like Linux. > Needless to say, the Linux console is much n

RE: Fast file data retrieval?

2012-03-12 Thread Prasad, Ramit
hat, given an ID, you can seek directly to that > file position. If you can grep for the header lines you can retrieve the headers and the line number for seeking. grep is (probably) faster than python so I would have it be 2 steps. 1. grep > temp.txt 2. python; check if ID is in temp.txt and

RE: Windows Contextmenu

2012-03-13 Thread Prasad, Ramit
r your question, you will not get more than one as an argument. That is expected behavior. 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 disclaime

RE: Is it technically possible to give Python option of naming process of running script?

2012-03-14 Thread Prasad, Ramit
or. I think this request was already denied: http://bugs.python.org/issue5672 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

RE: Is it technically possible to give Python option of naming process of running script?

2012-03-14 Thread Prasad, Ramit
ts an argument in favor. > > > I think this request was already denied: http://bugs.python.org/issue5672 Also take a look at: https://github.com/dvarrazzo/py-setproctitle Though since they just create a Named Object in Windows, I am not sure it would work for something like ki

RE: Style question (Poll)

2012-03-14 Thread Prasad, Ramit
t; c == d True >>> a = 10 >>> b = 10 >>> a is b False >>> a == b True >>> 10 is 10 True '10 is 10' works because the interpreter caches the number because it is on the same line. On

RE: Style question (Poll)

2012-03-14 Thread Prasad, Ramit
e or False. Although, I suppose you could always just use 'is None' instead. >>> 1 == True True >>> 1 is True False >>> 0 == False True >>> 0 is False False Granted, the above example is a pretty facetious case; not sure I can come up with a r

Context Manager getting str instead of AttributeError instance

2012-03-15 Thread Prasad, Ramit
better check I can use? 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 conditions including on offers for the purchase or sale of

RE: Python is readable

2012-03-15 Thread Prasad, Ramit
ode? Outlook showed the EN DASH but your MINUS SIGN and hyphen were the same for me. (UTF-8) 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 dis

RE: Context Manager getting str instead of AttributeError instance

2012-03-15 Thread Prasad, Ramit
> Prasad, Ramit wrote: > > > So I have a context manager used to catch errors > > > > def __exit__( self, exceptionClass, exception, tracebackObject ): > > if isinstance( exception, self.exceptionClasses ): > > #do something here > > >

RE: Context Manager getting str instead of AttributeError instance

2012-03-15 Thread Prasad, Ramit
a version difference. I don't have Python 2.6 handy to > test on, but I get a str in Python 2.5 and an AttributeError instance > in Python 2.7. Thanks Ian, that was the key! I guess I will just have to work around it. Any suggestions? I am thinking about just creating a blank instan

RE: Why not use juxtaposition to indicate function application

2012-03-16 Thread Prasad, Ramit
se I think I prefer the 'Explicit is better than implicit.' I would probably always forget if it should be f a b or f ( a b ) Not to mention the first line look like text rather than a function call because my mind tends to filter out whitespaces like that when reading. I blame variable

RE: Python is readable

2012-03-16 Thread Prasad, Ramit
work as expected, but now you are dealing with pointers / references. bash-3.2$ cat temp.pl my @arr = ( 'test', 'blah', '1234', 'boop', 'foo', 'bar' ); my @arr2 = ( 'adsf', 'qwerty' ); print "@arr\n"; m

RE: Python is readable

2012-03-16 Thread Prasad, Ramit
able way of trying to prove a point. If you don't like reference links, what would convince you that the point was correct? I have not seen any counter examples or counter references on your behalf... Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main Street | H

RE: Is it technically possible to give Python option of naming process of running script?

2012-03-16 Thread Prasad, Ramit
s name > still ends up as python2.6 (or whatever the real binary is called). Try a hardlink instead of symlink? It seems to work for me. Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main Street | Houston, TX 77002 work phone: 713 - 216 - 5423 -- This email is

RE: urllib.urlretrieve never returns???

2012-03-20 Thread Prasad, Ramit
ycurl, for example). But > the error itself is getting more interesting. This makes me think self does not have a .Log() or the traceback import is being overridden by something else that does not have .format_exc(). Or possibly this is in a function that does not have a self (maybe a ty

RE: urllib.urlretrieve never returns??? [SOLVED] - workaround

2012-03-20 Thread Prasad, Ramit
missing an import which I mentioned in another post. Fixing that should tell what the error you are getting is; you would not be getting the AttributeError without some other error first. Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main Street | Houston, TX 77002

RE: urllib.urlretrieve never returns??? [SOLVED] - workaround

2012-03-20 Thread Prasad, Ramit
And I have Windows 7 64 with Python 2.6.6 (32 bit) and wx installed. 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 conditions inc

RE: urllib.urlretrieve never returns???

2012-03-20 Thread Prasad, Ramit
gram and the original post. > > http://code.activestate.com/lists/python-list/617894/ I just looked at your source file on ActiveState and noticed that you do not import traceback. That is why you are getting the AttributeError. Now you should be getting a much better error once you import

RE: urllib.urlretrieve never returns???

2012-03-22 Thread Prasad, Ramit
le to start a blocked call for a system > library function. Your code works for me, so the problem should be your system and/or network. Try a different Python version? I tested using 2.6.6. Also, check your proxy or firewall. If you are using Python 2.x try using urllib2. Ramit Ramit Prasad | JP

RE: Odd strip behavior

2012-03-22 Thread Prasad, Ramit
l combinations of its values are stripped: >>> >>> ' spacious '.strip() 'spacious' >>> 'www.example.com'.strip('cmowz.') 'example' Changed in version 2.2.2: Support for the chars argument. Ramit

RE: Fetching data from a HTML file

2012-03-23 Thread Prasad, Ramit
formed HTML. http://www.crummy.com/software/BeautifulSoup/ 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 conditions including on of

RE: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-23 Thread Prasad, Ramit
> I confess--I've never learned LilyPond, Modula-2, or LPC! I mean, of > course they're on my resume, just to get by HR screening, but that's > just between you and me... You mean, you, him, this mailing list, and anyone that looks on the archives... Ramit Ramit

RE: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-23 Thread Prasad, Ramit
> Logo. It's turtles all the way down. I had forgotten all about that, I should add that to my resume! I wonder what kind of job I could get writing primarily in Logo? Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main Street | Houston, TX 77002 wo

RE: help needed to understand an error message.

2012-03-26 Thread Prasad, Ramit
be able to execute the > code. You should not worry about that too much. Often when I see errors the problem can be earlier in the line or a line or two before. Just look backwards from where the error says the problem was found. Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Curren

RE: Advise of programming one of my first programs

2012-03-26 Thread Prasad, Ramit
ice. This will also help you when you implement my next point. 3. You should also change the structure of your program to loop instead of calling listpb each time you want to restart. It is a much better practice and while it will not affect this program unless you do not exit for 10s or 100s of th

RE: perldoc: the key to perl

2012-03-26 Thread Prasad, Ramit
missed something, but what does this have to do with Python? 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 conditions includi

RE: Advise of programming one of my first programs

2012-03-27 Thread Prasad, Ramit
book = get_book_to_edit() details( tbook, book ) elif choice =='Q' or choice == 'q': break # end loop to exit program else: print 'Selection {0} not understood.'.format( choice ) Ramit Ram

RE: Advise of programming one of my first programs

2012-03-27 Thread Prasad, Ramit
ccurate than str here. 4. Function to print the entire book def listpb( tbook ): print '_' *45, ' Phonebook ', '_' *45,'\n\n\n' print 'Nick\t\tF.Name\t\tL.Name\t\tCity\t\t\tRegion\t\tTel' print '_' * 105,'\n','\t

RE: RE: Advise of programming one of my first programs

2012-03-28 Thread Prasad, Ramit
t;'\ntRtR.") It might be as dangerous, but which is more likely to cause problems in real world scenarios? 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

RE: "convert" string to bytes without changing data (encoding)

2012-03-28 Thread Prasad, Ramit
rating each element >>>print sentence Hi, how are you? You can use join on an empty string, but then they will not be separated by spaces. >>>sentence = ''.join( lst ) # empty string so no separation >>>print sentence Hi,howareyou? You can use any string as a separat

RE: "convert" string to bytes without changing data (encoding)

2012-03-28 Thread Prasad, Ramit
m the German Wikipedia on ASCII, in UTF-8. I see no non-ASCII characters, not sure if that is because the source has none or something else. From this example I would not say that the rest of the text is "unchanged". Decode converts to Unicode, did you mean encode? I think "igno

RE: "convert" string to bytes without changing data (encoding)

2012-03-28 Thread Prasad, Ramit
nowing the encoding, there is no way to be sure. If you just assume >it's ASCII and manipulate it as such, you could be messing up >non-ASCII characters. Technically, ASCII goes up to 256 but they are not A-z letters. Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Tec

RE: RE: Advise of programming one of my first programs

2012-03-29 Thread Prasad, Ramit
From: Anatoli Hristov [mailto:[email protected]] Sent: Wednesday, March 28, 2012 5:36 PM To: Prasad, Ramit Cc: [email protected] Subject: Re: RE: Advise of programming one of my first programs >>> > Um, at least by my understanding, the use of Pickle is also dangerous if >&g

RE: "convert" string to bytes without changing data (encoding)

2012-03-29 Thread Prasad, Ramit
finitions for 128 characters: 33 are non-printing > control characters (now mostly obsolete) that affect how text and > space is processed and 95 printable characters, including the space > (which is considered an invisible graphic). Doh! I was mistaking extended ASCII for ASCII. Tha

RE: Advise of programming one of my first programs

2012-03-29 Thread Prasad, Ramit
;E': edit( tbook, book ) # save tbook here elif choicem =='Q' or choicem == 'q': break # end loop to exit program Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main Street | Houston, TX 77002 work

RE: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-29 Thread Prasad, Ramit
n a program that could convert from one paradigm/language directly to another (and do it well/maintainable). > The debate keeps on coming up, but it's not just political decisions > that maintain language diversity. Not a bad thing in my opinion. A tool for each problem, but I can s

RE: Python is readable

2012-03-30 Thread Prasad, Ramit
r a living and producing tangible results to justify employment. It is only fair to talk about mathematics in the same context. Or vice-versa. Joining-the-trolling-bandwagon, Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main Street | Houston, TX 77002 work p

RE: Advise of programming one of my first programs

2012-04-16 Thread Prasad, Ramit
t;     print '\n\n(E)dit\n\n' >     print '(B)ack to phonebook list\n\n' > > ## Edit contact > > def edit(choicen, tbook): >     sb = tbook[choicen] >     fn = raw_input('New name for ' + sb[fname] + ' : ') >     if fn == '': &g

RE: Appending to []

2012-04-25 Thread Prasad, Ramit
erable inline) you can use extend a= [] a.extend( [ 'x, 'y, 'z' ] ) Or if creating a new list just populate it inline. a= [ 'x', 'y', 'z',] > > >> would be possible with a containing the resulting list > >> > >> [&#x

RE: Web Scraping - Output File

2012-04-26 Thread Prasad, Ramit
ould be > > highly appreciated. Code is included below. Thanks! > Your code is bound to break over and over (you should do some smarter > parsing), but here's a working version: Take a look at Beautiful Soup/lxml; considering the number of malformed web pages Beautiful Soup will p

RE: why () is () and [] is [] work in other way?

2012-04-27 Thread Prasad, Ramit
g > (c)Python. > > I've never ever thought about using this weird thing called "id" in my > code, (which comes later in all the responses) so why do some people > think it's so important? > Somewhere out there (possibly in an alternate universe) Bill Clinton

RE: HTML Code - Line Number

2012-04-27 Thread Prasad, Ramit
ontinue criteria1 = ' valign="top" class="body_cols_middle">' in line criteria2 = '' in previous_line if criteria1 and criteria2 : found = True < maybe add rest of line to results > Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Curr

RE: numpy (matrix solver) - python vs. matlab

2012-05-01 Thread Prasad, Ramit
>I'm making my first steps now with numpy, so there's a lot I don't know >and haven't tried with numpy... An excellent reason to subscribe to the numpy mailing list and talk on there :) Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712

RE: Converting a string to list for submission to easygui multenterb​ox

2012-05-01 Thread Prasad, Ramit
g. try doing `print(type(choice))`. On the assumption it is a tuple and not a string you can convert it by doing: choice = list(choice) If it actually is a string I would do: choice = list( ast.literal_eval( choice ) ) Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technol

RE: syntax for code blocks

2012-05-02 Thread Prasad, Ramit
blocks codeblocks.rewrite() def each(iterable, block): for e in iterable: block(e)# step into -> 6: with each(range(0, 10)) << 'x': print('element ' + str(x)) codeblocks.end_of_module() I have not tried this (or any) ex

RE: try/except in a loop

2012-05-02 Thread Prasad, Ramit
> for obj in [ 1,2,3,4 ]: ... try: ... print obj ... except Exception: ... print 'EXCEPTION' ... else: ... print 'NO EXCEPTION' ... else: ... print 'NO OBJECTS' ... 1 NO EXCEPTION 2 NO EXCEPTION 3 NO EXCEPTION 4 NO EXCEPT

RE: try/except in a loop

2012-05-02 Thread Prasad, Ramit
gt; You left out the break in the try clause's else that I had. That break > statement causes the for loop to exit early if there is no exception, > and thus the for loop's else clause does not run: > > >>> for obj in [ 1,2,3,4 ]: > ... try: > ... print

RE: Lack of whitespace between contain operator ("in") and other expression tokens doesn't result in SyntaxError: bug or feature?

2012-05-03 Thread Prasad, Ramit
} System.out. println( args [0] ); } } 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 conditions

RE: most efficient way of populating a combobox (in maya)

2012-05-04 Thread Prasad, Ramit
Tkinter with the contents of > os.listdir requires a large amount of effort. Just try it and see whether > it performs well enough. In my experience, a generic combobox with hundreds or thousands of elements is difficult and annoying to use. Not sure if the Tkinter version has scroll

RE: ./configure

2012-06-04 Thread Prasad, Ramit
ly mess up the system Python and it tends to work auto-magically. 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 conditions inc

RE: file pointer array

2012-06-06 Thread Prasad, Ramit
files unless you have very large files. data= [] for index in range(N, 1): # see Chris Rebert's comment with open('data%d.txt' % index,'r') as f: data.append( f.readlines() ) Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology

RE: file pointer array

2012-06-06 Thread Prasad, Ramit
Wouldn't that concatenate the data from each file rather than keeping each file's data separate? 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 imp

<    1   2   3   4   >