Fwd: Issues in python 3.11.0 (64-bit) installation
-- Forwarded message - From: Suresh Babu Date: Thu, 3 Nov 2022, 16:37 Subject: Issues in python 3.11.0 (64-bit) installation To: Sir/ Madam, I downloaded the latest version of python i.e. python 3.11.0 ( 64-bit) in my laptop recently. But the " py launcher " and " available for all users " option is not working in the customization menu of python 3.11.0 . Kindly help me in solving this issue. My operating system is Windows 11. Kindly guide me in this regard. Yours sincerely, Sureshbabu. -- https://mail.python.org/mailman/listinfo/python-list
[issue43175] filecmp is not working for UTF-8 BOM file.
suresh added the comment: I am getting same file size and are regular files (True) as below. Could you assist on filecmp any changes required in passing the inputs. Since it returns false. Code: >>> os.chdir(r'C:\Users\suresh.n\Files') >>> open('source.css', 'rb').read() == open('destination.css','rb').read() True >>> for f in ('source.css', 'destination.css'): ... print(f, os.path.isfile(f), os.path.getsize(f)) source.css True 37465 destination.css True 37465 -- ___ Python tracker <https://bugs.python.org/issue43175> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43175] filecmp is not working for UTF-8 BOM file.
suresh added the comment: Dear Team, Any more details are required. Kindly let me know. -- ___ Python tracker <https://bugs.python.org/issue43175> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43175] filecmp is not working for UTF-8 BOM file.
suresh added the comment: Please find the below Code and attached the files, expecting true as output and getting as false: "import filecmp filecmp.clear_cache() boolfile=filecmp.cmp(r'C:\destination.css',r'C:\source.css',shallow=False) print(boolfile)" -- hgrepos: +398 Added file: https://bugs.python.org/file49802/files.zip ___ Python tracker <https://bugs.python.org/issue43175> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43175] filecmp is not working for UTF-8 BOM file.
New submission from suresh : Python base package filecmp is not working properly for 'UTF-8 BOM' css files. I am using python version 3.6 and windows 10 OS. while running the below code getting as False always.However the file content are same. Code : import filecmp filecmp.clear_cache() boolfile=filecmp.cmp(r'C:\Users\suresh.n\python\RPA\Page\Sowmiya\downloads\destination.txt',r'C:\Users\suresh.n\python\RPA\Page\Sowmiya\source\source,r'C:\Users\suresh.n\python\RPA\Page\Sowmiya\downloads.txt',shallow=False) print(boolfile) -- components: Windows files: source.txt hgrepos: 397 messages: 386692 nosy: paul.moore, steve.dower, suresh, tim.golden, zach.ware priority: normal severity: normal status: open title: filecmp is not working for UTF-8 BOM file. type: behavior versions: Python 3.6 Added file: https://bugs.python.org/file49798/source.txt ___ Python tracker <https://bugs.python.org/issue43175> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Unable to install folium using python version 3.8.4.
Team, I use python version 3.8.4. I tried to import folium using IDLE but it was unsuccessful as it throws errors. After that, I tried to use pip install folium in the command prompt but it also throws an error. Kindly advise the steps to install folium. Regards, U.Suresh. -- https://mail.python.org/mailman/listinfo/python-list
[issue38745] pygame install error using python 3.8.0
New submission from Suresh Murugesan : I tried to install pygame, using pip install pygame, on my windows 10 running python 3.8.0. But it fails with the following error messages Can you please help. I read on the internet that 3.8 is not stable yet for pygame. Is it true? ERROR: Command errored out with exit status 1: command: 'c:\users\smuru02\appdata\local\programs\python\python38-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\smuru02\\AppData\\Local\\Temp\\pip-install-0yqtpy1n\\pygame\\setup.py'"'"'; __file__='"'"'C:\\Users\\smuru02\\AppData\\Local\\Temp\\pip-install-0yqtpy1n\\pygame\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\smuru02\AppData\Local\Temp\pip-install-0yqtpy1n\pygame\pip-egg-info' cwd: C:\Users\smuru02\AppData\Local\Temp\pip-install-0yqtpy1n\pygame\ Complete output (17 lines): WARNING, No "Setup" File Exists, Running "buildconfig/config.py" Using WINDOWS configuration... Download prebuilts to "prebuilt_downloads" and copy to "./prebuilt-x86"? [Y/n]Traceback (most recent call last): File "", line 1, in File "C:\Users\smuru02\AppData\Local\Temp\pip-install-0yqtpy1n\pygame\setup.py", line 194, in buildconfig.config.main(AUTO_CONFIG) File "C:\Users\smuru02\AppData\Local\Temp\pip-install-0yqtpy1n\pygame\buildconfig\config.py", line 210, in main deps = CFG.main(**kwds) File "C:\Users\smuru02\AppData\Local\Temp\pip-install-0yqtpy1n\pygame\buildconfig\config_win.py", line 576, in main and download_win_prebuilt.ask(**download_kwargs): File "C:\Users\smuru02\AppData\Local\Temp\pip-install-0yqtpy1n\pygame\buildconfig\download_win_prebuilt.py", line 302, in ask reply = raw_input( EOFError: EOF when reading a line ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. -- components: Windows messages: 356244 nosy: paul.moore, pysuresh, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: pygame install error using python 3.8.0 type: behavior versions: Python 3.8 ___ Python tracker <https://bugs.python.org/issue38745> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24428] Import sys,getopt is having issue while taking inputs
New submission from venkata suresh gummadillli: [@outsidetried ~]$ python validate_json_adj.py [@outsidetried ~]$ python validate_json_adj.py -h validate_json.py -i input_file [@outsidetried ~]$ python validate_json_adj.py -i hello.txt Input JSON file provided for verification: hello.txt [@outsidetried ~]$ python validate_json_adj.py -i firstfile Input JSON file provided for verification: firstfile [@outsidetried ~]$ python validate_json_adj.py -i hello.txt -bash: syntax error near unexpected token `newline' [sureshgv@outsidetried ~]$ python validate_json_adj.py -i ?? Input JSON file provided for verification: ci [@outsidetried ~]$ python validate_json_adj.py -i ??? Input JSON file provided for verification: bf1 [@outsidetried ~]$ python validate_json_adj.py -i $#@% Input JSON file provided for verification: 0@% [@outsidetried ~]$ cat validate_json_adj.py #!/usr/bin/python import sys,getopt def main(argv): inputfile = '' try: opts, args = getopt.getopt(argv,hi:,[input_file=]) except getopt.GetoptError: print 'validate_json.py -i input_file' sys.exit(2) for opt, arg in opts: if opt == '-h': print 'validate_json.py -i input_file' sys.exit() elif opt in (-i, --input_file): inputfile = arg print 'Input JSON file provided for verification:', inputfile if __name__ == __main__: main(sys.argv[1:]) -- components: Library (Lib) messages: 245142 nosy: venkata suresh gummadillli priority: normal severity: normal status: open title: Import sys,getopt is having issue while taking inputs type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24428 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
What are the minimum requirements to get a job in?
My aim is to get a job into google or cisco or facebok. I have basic knowledge in python,c,java and good in javascript,html,css, database concepts. If i learn django and python. Shall I get my dream job? Please suggest me -- http://mail.python.org/mailman/listinfo/python-list
SAP MM Cupertino, CA
Hi, This is Girish, - IT Recruiter from SancroSoft USA Inc. Please respond with updated resume in MS-Word .doc Format with the following details to gir...@sancrosoftusa.com Full Name : Location : Contact Number : Email : Availability : Visa Status : SAP MM Location : Cupertino, CA Duration: 3+ Months Job Description: • Candidate should possess excellent functional knowledge in SAP MM for about 4-5 yrs and have 2 years of implementation or Production support experience • Should be strong in Procure to pay cycle covering the critical aspects of Purchasing, Inventory Management Invoice Verification. • Should be able to understand the client business process so as to map the requirements in SAP using standard solution methodology. • Should be able to conduct Business workshops to drive the project implementation using SAP standard implementation methodologies. • Should be strong in Special processes which include Consignment process, Subcontracting process Batch Management. • Should be comfortable in handling and preparation of Functional Specifications and to work with developer to achieve RICEF objects. • Should have cross functional expertise and should be strong in integrating the system with other modules which includes SD, WM FI. • Should have worked and exposed to EDI Integration techniques along with Idoc monitoring process. • Should be an excellent team player good team builder. • Should demonstrate excellent communication skills. Thanks Regards, Girish IT Recruiter. The power of focus SancroSoft USA INC 4944 Sunrise Blvd, Suite B-4 || Fair Oaks, CA 95628 Phone : 916-671-5584|| Fax: 916-200-0305 E-Mail : gir...@sancrosoftusa.com|| www.sancrosoftusa.com Stay Connected: The information contained in this email message is intended only for the personal and confidential use of the recipient(s) named above. The message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by email and delete the original message. -- http://mail.python.org/mailman/listinfo/python-list
Fwd: class print method...
Pls help its really frustrating -- Forwarded message -- From: Suresh Sharma Date: Monday, December 5, 2011 Subject: class print method... To: d...@davea.name d...@davea.name Dave, Thanx for the quick response, i am sorry that i did not explain correctly look at the code below inspite of this i am just getting class object at memory location.I am sort i typed all this code on my android in a hurry so.indentation could.not.be.managed but this.similar code when i run all my objects created by class deck are not shown but stored in varioia meory locations. How can i display them. Please help Suit=[aces,clubs,diamonds,hearts] Rank=[2,3,4,5,6,7,8,9,j,Q,K,A] class Card: Def __init__(self,rannk,suiit): Self.suiit=suiit Self.rannk=rannk Def __str__(self): Return suit[suiit],rank[rannk] Class deck: Def __init__(cards): Self.cards=[ ] For suit in range(4): For rank in range(13): Self.cards.append(Card(suit,rank)) Def __str__(self): s = For card in self.cards: S = str(self.cards) Return s. On Monday, December 5, 2011, Dave Angel d...@davea.name wrote: On 12/05/2011 02:11 AM, Suresh Sharma wrote: Hello All, I am new to python and i have stuck up on a particular issue with classes, i understand this might be a very dumb question but please help me out. I have created two classes and whenever i try to print the objects i get this message but not the data, __main__.cards instance at (memory location) i even tried using __str__ but calling it also produces the same result. Can anyone please help me how to get my objects printed. I googled a lot but could not find anything relevant. thanks in advance regards suresh You were close, but you have it backward. You don't call __str__() to print an object, you implement __str__() in your object. If you write a class without also writing __str__(), then print won't know what to do with it. -- DaveA -- Suresh Sharma Regional Project Manager, O2F,Mumbai Maharashtra-400101. -- Suresh Sharma Regional Project Manager, O2F,Mumbai Maharashtra-400101. -- http://mail.python.org/mailman/listinfo/python-list
Re: Fwd: class print method...
Dave / Ryan Thanks i have got it and it worked after using repr statement. Thanks everyone for their valuable feedback. On Mon, Dec 5, 2011 at 6:11 PM, Lie Ryan lie.1...@gmail.com wrote: On 12/05/2011 10:18 PM, Suresh Sharma wrote: Pls help its really frustrating -- Forwarded message -- From: Suresh Sharma Date: Monday, December 5, 2011 Subject: class print method... To: d...@davea.name mailto:d...@davea.name d...@davea.name mailto:d...@davea.name Dave, Thanx for the quick response, i am sorry that i did not explain correctly look at the code below inspite of this i am just getting class object at memory location.I am sort i typed all this code on my android in a hurry so.indentation could.not.be.managed but this.similar code when i run all my objects created by class deck are not shown but stored in varioia meory locations. How can i display them. I think you're in the right track, however I suspect you're running the code in the shell instead of as a script. The shell uses __repr__() to print objects instead of __str__(), so you either need to use 'print' or you need to call str(), note the following: Python 2.7.2+ (default, Oct 4 2011, 20:06:09) [GCC 4.6.1] on linux2 Type help, copyright, credits or license for more information. suits = ['spades', 'clubs', 'diamonds', 'hearts'] ranks = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K'] class Card: ... def __init__(self, rank, suit): ... self.suit = suit ... self.rank = rank ... def __str__(self): ... return suits[self.suit] + ' ' + ranks[self.rank] ... Card(2, 3) #1 __main__.Card instance at 0x7f719c3a20e0 str(Card(2, 3)) #2 of your 'hearts 3' print Card(2, 3) #3 hearts 3 In #1, the output is the __repr__() of your Card class; you can modify this output by overriding the __repr__() on your Card class. In #2, the output is the __repr__() of a string, the string is the return value from __str__() of your Card class. The repr of a string is the string enclosed in quotes, which is why there is an extra pair of quotes. In #3, you're 'print'-ing a string, the string is the return value from __str__() of your Card class. There's no extra quotes, since 'print' prints the string itself, not the repr of the string. -- http://mail.python.org/**mailman/listinfo/python-listhttp://mail.python.org/mailman/listinfo/python-list -- Suresh Sharma Regional Project Manager, O2F,Mumbai Maharashtra-400101. -- http://mail.python.org/mailman/listinfo/python-list
class print method...
Hello All, I am new to python and i have stuck up on a particular issue with classes, i understand this might be a very dumb question but please help me out. I have created two classes and whenever i try to print the objects i get this message but not the data, __main__.cards instance at (memory location) i even tried using __str__ but calling it also produces the same result. Can anyone please help me how to get my objects printed. I googled a lot but could not find anything relevant. thanks in advance regards suresh -- http://mail.python.org/mailman/listinfo/python-list
Re: No matter what I do, IDLE will not work...
Hello all, I need to know how to connect python 3.2 with mysql db i am newbie and appreciate your help to enhance my skills. I googled a lot but nothing came up Ned Deily n...@acm.org wrote: In article 415ed0ec-65a5-41df-b81e-d74786c74...@s5g2000vbe.googlegroups.com, CAMERON ALLEY cra5...@g.rit.edu wrote: IT WORKS I didn't change my activestate, but I downloaded python 3.2.2 with the 32 bit installer and it works! Perfectally!! Sir you're my savior, thank you so much. I don't know how you did it but you just made my day :) The 32-bit-installer links to the older Carbon-based Tcl/Tk 8.4 which is very different under the covers from the Tcl/Tk 8.5 used by the Apple-supplied Pythons and the python.org 64-bit installer. So there's *something* on your system that interferes with the Cocoa Tcl/Tk 8.5. If you want to pursue it, you might ask on the OS X Tcl mailing list. Good luck! http://dir.gmane.org/gmane.comp.lang.tcl.mac -- Ned Deily, n...@acm.org -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
packaging a python application
Hi I created a python application which consists of multiple python files and a configuration file. I am not sure, how can I distribute it. I read distutils2 documentation and a few blogs on python packaging. But I still have the following questions. 1. My package has a configuration file which has to be edited by the user. How do we achieve that? 2. Should the user directly edit the configuration file, or there would be an interface for doing it...?(I remember my sendmail installations in Debian/Ubuntu. It would ask a bunch of questions and the cfg file would be ready) I am just confused how to go about... thanks suresh -- http://mail.python.org/mailman/listinfo/python-list
changing current dir and executing a shell script
Hi, I want to execute the following command line stuff from inside python. $cd directory $./executable I tried the following but I get errors import subprocess subprocess.check_call('cd dir_name;./executable') Due to filename path issues, I cannot try this version. subprocess.check_call('./dir_name/executable') Any suggestions? thanks suresh -- http://mail.python.org/mailman/listinfo/python-list
Re: changing current dir and executing a shell script
On Friday, May 27, 2011 3:19:22 PM UTC-7, Albert Hopkins wrote: On Fri, 2011-05-27 at 14:25 -0700, suresh wrote: Hi, I want to execute the following command line stuff from inside python. $cd directory $./executable I tried the following but I get errors import subprocess subprocess.check_call('cd dir_name;./executable') Due to filename path issues, I cannot try this version. subprocess.check_call('./dir_name/executable') You don't want to do this because cd is a built-in shell command, and subprocess does not execute within a shell (by default). The proper way to do this is to use the cwd keyword argument to subprocess calls, i.e.: subprocess.check_call(('/path/to/exec',), cwd=/path/to/dir) -a It works. thank you very much. I have been struggling with this for a very long time. suresh -- http://mail.python.org/mailman/listinfo/python-list
[issue11252] Handling statement OR assignment continuation '\' on Win32 platform
Suresh Kalkunte sskalku...@gmail.com added the comment: Thanks for the education (hopefully a slight detour for you 8-). I included '/' to convey uniform behavior across platforms. I will take it that the difference in what os.path.split() returns on Win32 vs. Linux is not a bug in Python since its Win32 users have come to expect the response it gives ? if yes, please point me to a resource (i.e, if you are aware, else do not bother 8-) that identifies such other conundrums. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11252 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11252] Handling statement OR assignment continuation '\' on Win32 platform
Suresh Kalkunte sskalku...@gmail.com added the comment: lukasz.langa, confirming the difference in return values for glob.glob() on Win32/Cygwin vs. Linux as the following results show: F1() ret_val1 F2(ret_val1) ret_val2 -- \\\ Cygwin /// -- string.split() / glob.glob('/') ['/'] string.split() \ glob.glob('\') ['\\'] -- \\\ Win32 /// -- string.split() / glob.glob('/') ['/'] string.split() \ glob.glob('\') ['\\'] -- \\\ Linux /// -- string.split() / glob.glob('/') ['/'] string.split() \ glob.glob('\') [] For my education, is there a reason why glob.glob('\') on Win32/Cygwin returns ['\\'] instead of [] in Linux ? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11252 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11252] Handling statement OR assignment continuation '\' on Win32 platform
Suresh Kalkunte sskalku...@gmail.com added the comment: If the defect was with the script, the failure to bypass the '\' notation would have to be true on Redhat Linux. Since build.conf with '\' notation gets parsed without errors on Redhat Linux, I am under the impression the parsing performed by Python on Win32 recognizes '\' as a legitimate file token resulting in the script to fail. In summary, I view semantics of '\' being different in Win32 vs. Linux as an inconsistency and hence thought it to be a possible defect in Python. However, if Python scripts do not guarantee platform independence, i.e, one's scripts need to be cognizant of platform idiosyncrasy, then, I believe it is not a bug in Python. -- status: pending - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11252 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11252] Handling statement OR assignment continuation '\' on Win32 platform
New submission from Suresh Kalkunte sskalku...@gmail.com: Referring to URL for files used to build the Apache Portable Runtime Utilities library using Python 2.7.1(AMD64) or 2.6.5(Cygwin) on a Win32 system (Windows 7), when apr/build/gen-build.py (http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/build/gen-build.py?revision=886996view=markup) parses '\' on line 96 and 97 in apr-util/build.conf (http://svn.apache.org/viewvc/apr/apr-util/branches/1.4.x/build.conf?revision=886996view=markup), it recognizes them as separate tokens causing the script to fail on line 168 assert file[-2:] == '.c'. If the line continuation notation ('\') is removed from build.conf, gen-build.py performs without errors. On a Redhat Linux, I have verified Python 2.5.5 (and trust 2.7.1 to provide the same behavior on Linux) handles '\' without errors leading me to believe that if this is a bug, it is only on Win32 platform (and instances where '\' is used for directory path separation). I am new to Python, from searching the python bug database, I have not been able to find the above condition covered. If this bug has already been identified, please disregard. -- components: Interpreter Core, Windows messages: 128890 nosy: Suresh.Kalkunte priority: normal severity: normal status: open title: Handling statement OR assignment continuation '\' on Win32 platform type: behavior versions: Python 2.6, Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11252 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Wouldn't it be nice if this worked?
class A: def add(self, x, y): return x+y class B: pass B.add = A.add print B().add(1, 2) - gives TypeError: unbound method add() must be called with A instance as first argument -- http://mail.python.org/mailman/listinfo/python-list
Re: Execution speed question
On Mon, 28 Jul 2008 16:48:28 +0200, Suresh Pillai wrote: Okay, please consider this my one absolutely stupid post for the year. I'd like to pretend it never happened but unfortunately the web doesn't allow that. Having never used sets, I unfort read something that lead to it, but ... Okay, got some sleep and what I meant to ask, although equally basic, but not silly: For sets, I presume they are built on top of or like dicts, and there is nothing crazy in the low level implementation so that I can be guaranteed that if I don't alter the set, then the order, although arbitrary, will be maintained in successive iterations over the contents? -- http://mail.python.org/mailman/listinfo/python-list
Re: Execution speed question
On Fri, 25 Jul 2008 08:08:57 -0700, Iain King wrote: On Jul 25, 3:39 pm, Suresh Pillai [EMAIL PROTECTED] wrote: That's a good comparison for the general question I posed. Thanks. Although I do believe lists are less than ideal here and a different data structure should be used. To be more specific to my case: As mentioned in my original post, I also have the specific condition that one does not know which nodes to turn ON until after all the probabilities are calculated (lets say we take the top m for example). In this case, the second and third will perform worse as the second one will require a remove from the list after the fact and the third will require another loop through the nodes to build the new list. So you need to loops through twice regardless? i.e. loop once to gather data on off nodes, do some calculation to work out what to turn on, then loop again to turn on the relevant nodes? If so, then I think the functions above remain the same, becoming the 2nd loop. Every iteration you do a first loop over the off_nodes (or them all for (1)) to gather the data on them, perform your calculation, and then perform one of the above functions (minus the setup code at the begining; basically starting at the 'for') as a second loop, with the goes_on function now returning a value based on the calculation (rather than the calculation itself as I had it). Performance should be similar. Iain If do I settle on an explicit loop to remove the nodes turned ON, then I realised this weekend that I could do this in the next iteration of the simulation (first loop above) and save some iteration overhead (the if checking will still be there of course). And thanks for pointing out that constructing a new list, for long lists, is faster than simple removal. It's obvious but I never really thought of it; good tip. -- http://mail.python.org/mailman/listinfo/python-list
Re: Execution speed question
On Fri, 25 Jul 2008 05:46:56 -0700, Iain King wrote: or 3. build a new list every iteration intead of deleting from the old one: while processing: new_off_list = [] for x in off_list: if goes_on(x): on_list.append(x) else: new_off_list.append(x) off_list = new_off_list generation += 1 Iain Or 4, since the order of my nodes doesn't matter: swap the node to be deleted with the last node in the list and then remove the last node of the list. This is the fastest to date, if using native structures, for low number nodes being deleted per cycle (def if only deleting one). -- http://mail.python.org/mailman/listinfo/python-list
Re: Execution speed question
On Mon, 28 Jul 2008 10:44:18 +0200, Suresh Pillai wrote: Since I am doing A LOT of loops over the nodes and the number of nodes is also huge, my concern using sets is that in order to iterate over the set in each step of my simulation, the set items need to be converted to a list every time. So while removal from a set is much cheaper than say from a list, what about this conversion overhead in order to iterate over the items. I could of course use the old trick of using a dictionary with 'None' values and then using iterkeys(). But I thought sets were supposed to replace this. So maybe I should be asking a more basic question: is there any way to iterate over the items in a set other than converting to a list or using the pop() method. -- http://mail.python.org/mailman/listinfo/python-list
Re: Execution speed question
On Mon, 28 Jul 2008 15:04:43 +0200, Suresh Pillai wrote: On Mon, 28 Jul 2008 10:44:18 +0200, Suresh Pillai wrote: Since I am doing A LOT of loops over the nodes and the number of nodes is also huge, my concern using sets is that in order to iterate over the set in each step of my simulation, the set items need to be converted to a list every time. So while removal from a set is much cheaper than say from a list, what about this conversion overhead in order to iterate over the items. I could of course use the old trick of using a dictionary with 'None' values and then using iterkeys(). But I thought sets were supposed to replace this. So maybe I should be asking a more basic question: is there any way to iterate over the items in a set other than converting to a list or using the pop() method. Okay, please consider this my one absolutely stupid post for the year. I'd like to pretend it never happened but unfortunately the web doesn't allow that. Having never used sets, I unfort read something that lead to it, but ... -- http://mail.python.org/mailman/listinfo/python-list
Execution speed question
I am performing simulations on networks (graphs). I have a question on speed of execution (assuming very ample memory for now). I simplify the details of my simulation below, as the question I ask applies more generally than my specific case. I would greatly appreciate general feedback in terms of computing and of course considerations specific to implementation in Python. The nodes in my network may be ON or OFF. The network starts off with all nodes in the OFF state. I loop through the nodes. For each node that is OFF, I consider some probability of it turning ON based on the states of its neighbours. I MUST GO THROUGH ALL NODES BEFORE DECIDING WHICH ONES TO TURN ON. So my question is whether it is faster to 1. loop through a list of ALL nodes and check for OFF nodes using ifs or to 2. loop through a container of OFF nodes and remove from this when they turn ON The second would result in looping through less nodes, especially as the simulation progresses, but how does the cost of removal compare with cheap ifs and would the extra memory usage affect performance. I an appreciate that the cost of the if check, the number of nodes, and the type of container I use will come into the answer. In my case, the ifs are cheap boolean queries (whether the node is ON or OFF). The number of nodes is very large: millions for sure, maybe tens of millions. If considering (2), take note of my BOLD text above, which means I can't remove nodes as I iterate through them in the main loop. I naturally started coding with (2), but couldn't decide on the best data structure for python. A set seemed ideal for speedy removal, but then I can't iterate through them with out popping. An ordered list? Some creative solution with numpy arrays? There is also the complication that since we are in interpreted python, what is theoretically the best data structure may not in reality be optimal unless it is a default system object or coded externally in a compiled module. Of course, I will start experimenting to see what the execution difference is, but I would appreciate some suggestions from others re which is best and also on best data structure for (2). I'm not a newbie, so you can get technical with me python-wise and algorithm wise. I realise it is a 'basic' question, but it is something that I have always wondered about (cheap ifs versus extra structure) and with the number of nodes I am considering, it actually becomes an issue. Many Thanks, Suresh -- http://mail.python.org/mailman/listinfo/python-list
Re: Execution speed question
That's a good comparison for the general question I posed. Thanks. Although I do believe lists are less than ideal here and a different data structure should be used. To be more specific to my case: As mentioned in my original post, I also have the specific condition that one does not know which nodes to turn ON until after all the probabilities are calculated (lets say we take the top m for example). In this case, the second and third will perform worse as the second one will require a remove from the list after the fact and the third will require another loop through the nodes to build the new list. -- http://mail.python.org/mailman/listinfo/python-list
Re: Execution speed question
On Fri, 25 Jul 2008 16:51:42 +0200, Fredrik Lundh wrote: Unless I'm missing something, your example keeps going until it's flagged *all* nodes as on, which, obviously, kills performance for the first version as the probability goes down. The OP's question was about a single pass (but he did mention as the simulation progresses, so I guess it's fair to test a complete simulation.) I was referring to multiple passes as in Iain' test cases. Although not necessarily till all nodes are ON, let's say to to a large proportion at least. -- http://mail.python.org/mailman/listinfo/python-list
sexe day
u want the all sexye flimes ues this u want me see this *** *** http;//lesbiangroupsexy.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: subprocess -popen - reading stdout from child - hangs
[EMAIL PROTECTED] wrote: Let's say I have this Python file called loop.py: import sys print 'hi' sys.stdout.flush() while 1: pass And I want to call it from another Python process and read the value 'hi'. How would I do it? So far I have tried this: proc = subprocess.Popen('python /home/chiefinnovator/loop.py',shell=True,stdin=subprocess.PIPE,stdout=subprocess.PIPE) proc.stdout.read() From python documentation `read([size])' Read at most SIZE bytes from the file (less if the read hits `EOF' before obtaining SIZE bytes). If the SIZE argument is negative or omitted, read all data until `EOF' is reached. The bytes are returned as a string object. An empty string is returned when `EOF' is encountered immediately. (For certain files, like ttys, it makes sense to continue reading after an `EOF' is hit.) Note that this method may call the underlying C function `fread()' more than once in an effort to acquire as close to SIZE bytes as possible. Also note that when in non-blocking mode, less data than what was requested may be returned, even if no SIZE parameter was given. read call in your code is waiting for EOF, since the script never exits EOF is not reached. Change read code to proc.stdout.readline() or remove while 1 loop from loop.py. HTH Kolla -- http://mail.python.org/mailman/listinfo/python-list
Re: module: zipfile.writestr - line endings issue
Paul Carter wrote: On Aug 14, 1:32 pm, towers [EMAIL PROTECTED] wrote: Thanks - your code works for me also. But I still get the issue when I read the file directly and add it to the archive. Say if I: 1. Use the test.csv file created with your code - currently the line endings look good (viewed in notepad on Win XP) 2. Run the following code: # begin code import zipfile import os.path # Now, create the zipfile dfile = open('test.csv', 'r') zip_file = zipfile.ZipFile(r'C:\temp\ice\line endings\test.zip', 'w', zipfile.ZIP_DEFLATED) zip_file.writestr('test.csv',dfile.read()) dfile.close() zip_file.close() 3. Then extract the file and the file endings have been corrupted. Now one long line in notepad. (Other programs interpret correctly though.) Maybe the issue lies with this way (i.e. dfile.read()) of writing the file to the archive...possibly. Damon Please don't top post. The problem is with how you are opening the file. You need to open in binary mode if you wish to read your file unaltered. Also, file() is preferred over open() these days I think. Use: dfile = file('test.csv', 'rb') From Python 2.5 library documentation. quote When opening a file, it's preferable to use `open()' instead of invoking this constructor directly. `file' is more suited to type testing (for example, writing `isinstance(f, file)'). /quote Python documentation seem to recommend using open(). I personally prefer to use open, just because python open has same signature as POSIX open, even beginner programmers can understand the intent of the code clearly. Kolla -- http://mail.python.org/mailman/listinfo/python-list
Memory Leak in Python 2.5.1?
Hi, I am currently investigating what seems to be a memory leak in python. (version 2.5.1). I have made python work with a custom memory sub-allocator (pool). The idea is to preallocate a pool of memory during initialization of my application and ensure that Python doesn't make any system mallocs (similar to max heap setting in java VM). With this arrangement, python seems to run out of preallocated memory after few iterations of the following code: int main(int argc, char *argv[]){ int i; mem_init(300);//Initialize the memory pool with 3M for (i=0;i2000,i++){ Py_Initialize(); Sleep(1000); Py_Finalize(); } } The above code runs out of memory after 1000 + iterations. To me this looks like a memory leak, Does anyone out there have any idea whats happening here? Regards, Suresh -- Everything of value that people get from religion can be had more honestly, without presuming anything on insufficient evidence. The rest is self-deception, set to music. -- http://mail.python.org/mailman/listinfo/python-list
Multiple assignment and the expression on the right side
Dear all, I read in Python in a Nutshell that when we have multiple assignments made on a single line, it is equivalent to have those many simple assignments and that the right side is evaluated once for each assignment. [The wordings are mine. I am not sure if this is what he intended]. So, In the following code snippet I expected the values of c, d, e to be different. But they are not? I am missing something... What is it? a = 12 def x(): global a; a+=1; return(a) ... x() 13 a 13 c = d = e = x() c 14 d 14 e 14 Thanks. regards, Suresh -- http://mail.python.org/mailman/listinfo/python-list
Augmented assignment
Hi, Is there any gain in performance because of augmented assignments. x += 1 vs x = x+1 Or are both of them the same. regards, Suresh -- http://mail.python.org/mailman/listinfo/python-list
Re: Augmented assignment
Thanks Alex. I was not aware of mtimeit. regards, Suresh Alex Martelli wrote: Suresh Jeevanandam [EMAIL PROTECTED] wrote: Hi, Is there any gain in performance because of augmented assignments. x += 1 vs x = x+1 Or are both of them the same. Just *MEASURE*, man! helen:~/apy alex$ python -mtimeit -s'x=0.0' 'x=x+1' 100 loops, best of 3: 0.507 usec per loop helen:~/apy alex$ python -mtimeit -s'x=0.0' 'x+=1' 100 loops, best of 3: 0.504 usec per loop Basically a dead draw, so use what's clearest to you. And learn to use -mtimeit to satisfy most such curiosities much more effectively. Alex -- http://mail.python.org/mailman/listinfo/python-list
Mutable numbers
# I am new to python. In python all numbers are immutable. This means there is one object ( a region in the memory ) created every time we do an numeric operation. I hope there should have been some good reasons why it was designed this way. But why not have mutable numbers also in the language. A type which would behave as follows: a = MutableInt(12) b = a Now both a and b should refer to the same memory location. Any change in the object should get reflected in all the references. a.assign(13) # Same memory location should be updated with value 13, b is also 13 now. Now we can further optimize: a.incrementOne() # equivalent to a++ in C++ a.decrementOne() and the augmented assignment operation also could be made optimized. In any application most of the operation is numerical. So, i think, we should get a good speed advantage with the availability of mutable numbers. What do you think ? regards, Suresh -- http://mail.python.org/mailman/listinfo/python-list
Re: Multiple assignment and the expression on the right side
Alex Martelli wrote: Suresh Jeevanandam [EMAIL PROTECTED] wrote: Dear all, I read in Python in a Nutshell that when we have multiple assignments made on a single line, it is equivalent to have those many simple assignments and that the right side is evaluated once for each assignment. [The wordings are mine. I am not sure if this is what he intended]. Since the original text is: Each time the statement executes, the right-hand side expression is evaluated once. Each target gets bound to the single object returned by the expression. Alex, I should have read carefully. I think I got confused because of Each time in the sentence which gives a feeling that it gets executed several times. Maybe, It could have been just written, When the statement gets executed, the right hand side is evaluated once, and the result is assigned to each of the target. Thanks a lot. regards, Suresh it might be interesting to understand how you managed to translate ONCE into ONCE PER ASSIGNMENT TARGET. I can most earnestly assure you that when I wrote ONCE I meant ONCE. If ONCE meant TWICE (or more), how could there be a guaranteed SINGLE OBJECT to which each target gets bound? So, In the following code snippet I expected the values of c, d, e to be different. But they are not? I am missing something... What is it? A good command of English, maybe? With that ONCE and SINGLE in there, no matter how much I try to, I just cannot see ambiguity in the words I had written. Nevertheless, in your honor, I guess I will redundantly change the ONCE into JUST ONCE in the second edition (I do strive for maximum conciseness in the Nutshell, but I guess I can spare one extra four-letter word, even though this is the only time I ever heard anybody express any doubt or misunderstanding about this paragraph). Alex -- http://mail.python.org/mailman/listinfo/python-list
mapping functions and lambda
Given a string s = 'a=1,b=2' I want to create a dictionary {'a': '1', 'b': '2'} I did, dict(map(lambda k: k.split('='), s.split(','))) Is it possible to get rid of the lambda here, without having to define another function just for this. Is this the easiest/straight-forward way to do this? regards, Suresh -- http://mail.python.org/mailman/listinfo/python-list
Re: mapping functions and lambda
I got it: dict([k.split('=') for k in s.split(',')]) regards, Suresh Suresh Jeevanandam wrote: Given a string s = 'a=1,b=2' I want to create a dictionary {'a': '1', 'b': '2'} I did, dict(map(lambda k: k.split('='), s.split(','))) Is it possible to get rid of the lambda here, without having to define another function just for this. Is this the easiest/straight-forward way to do this? regards, Suresh -- http://mail.python.org/mailman/listinfo/python-list
finding the intersection of a list of Sets
I have a list of sets in variable lsets . Now I want to find the intersection of all the sets. r = lsets[0] for s in r[0:]: r = r s Is there any other shorter way? Thanks in advance, Suresh -- http://mail.python.org/mailman/listinfo/python-list
Finding the relative path of a file from a dir
Hi, a = '/home/suresh/doc/html/a1/' b = '/home/suresh/doc/' I am looking for a standard function which will return the location of b relative to a i.e. '../..' I have gone through the os and os.path modules, but could not find any function of use. Should I write my own? Thanks in advance, Suresh -- http://mail.python.org/mailman/listinfo/python-list
Re: parsing engineering symbols
Exactly what I wanted. It would be nice if the standard float function takes care of these. regards, Suresh how about: SI_prefixes = { 'Y':24, 'Z':21, 'E':18, 'P':15, 'T':12, 'G':9, 'M':6, 'k':3, 'h':2, 'd':-1, 'c':-2, 'm':-3, u'\xb5':-6, 'u':-6, 'n':-9, 'p':-12, 'f':-15, 'a':-18, 'z':-21, 'y':-24 } def myfloat(str): try: exp = SI_prefixes[str[-1]] return float(str[:-1]) * 10**exp except KeyError: return float(str) ? /F -- http://mail.python.org/mailman/listinfo/python-list
parsing engineering symbols
Hi, I want to convert a string to float value. The string contains engineering symbols. For example, s = '12k' I want some function which would return 12000 function(s) = 12000.0 I searched the web, but could not find any function. regards, Suresh -- http://mail.python.org/mailman/listinfo/python-list
checking if a string contains a number
Hi, I have a string like, s1 = '12e3' s2 = 'junk' Now before converting these values to float, I want to check if they are valid numbers. s1.isdigit returns False. Is there any other function which would return True for s1 and False for s2. Thanks -- Suresh -- http://mail.python.org/mailman/listinfo/python-list
numarray :: multiplying all the elements in 1d array
Hi all, Lets say I have an array: from numarray import * a = array([ 6, 7, 8, 9, 10, 11, 12]) I want to multiply out all the elements and get the result. r = 1.0 for i in a: r = r*i Is there any faster, efficient way of doing this. Thanks, regards, Suresh -- http://mail.python.org/mailman/listinfo/python-list
openings on java with japanese language
send your profile to [EMAIL PROTECTED] Job Code: JJ1 Job Description: Skills: Experience in Java, J2EE, Struts and servlets. This is for onsite (Japan) and should be proficient at Japanese Knowledge (Level 3/4). Number of positions : 6 Experience: 3-5 years on Real time experience on Struts and servlets. -- http://mail.python.org/mailman/listinfo/python-list