Just compilation
Hi, ALL, I'm trying to incorporate the path in http://sourceforge.net/p/mysql-python/bugs/325/. I already modified the source code and now what I need is to produce the pyc code. Running python --help I don't see an option to just compile the source into the bytecode. So how do I produce the compiled version of the changed source? What I'm thinking is to compile the file update the archive and reinstall. Please help. Thank you. -- https://mail.python.org/mailman/listinfo/python-list
Re: [newbie] copying identical list for a function argument
Op maandag 3 februari 2014 23:19:39 UTC+1 schreef Steven D'Aprano: On Mon, 03 Feb 2014 13:36:24 -0800, Jean Dupont wrote: I have a list like this: [1,2,3] The argument of my function should be a repeated version e.g. [1,2,3],[1,2,3],[1,2,3],[1,2,3] (could be a different number of times repeated also) what is the prefered method to realize this in Python? I don't really understand your question. It could mean any of various things, so I'm going to try to guess what you mean. If my guesses are wrong, please ask again, giving more detail, and possibly an example of what you want to do and the result you expect. I think you mean that you have some function that needs to take (say) five arguments, and you want to avoid writing: result = function([1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 23], [1, 2, 3]) because it's too easy to make a mistake (as I did, deliberately, above -- can you see it?). If my guess is correct, try this: mylist = [1, 2, 3] result = function(mylist, mylist, mylist, mylist, mylist) That's perfectly reasonable for two or three arguments, but not so much for five. Instead, here's a trick: first we make five identical references to the same list: [mylist]*5 # same as [mylist, mylist, mylist, mylist, mylist] then expand them as arguments to the function: mylist = [1, 2, 3] list_of_lists = [mylist]*5 result = function(*list_of_lists) (The * operator means multiplication when used between two arguments, and inside a function call a leading * also does argument expansion.) But wait... there's something slightly weird here. Even though there are five distinct references to mylist, they're all the same list! Change one, change all. This may be what you want, or it may be a problem. Hard to tell from your question. Think about references as being a little bit like names. A *single* person could be known as son, Dad, Mr Obama, Barack, Mr President, POTUS, and more. In this case, we have a single list, [1, 2, 3], which is known by six references: the name mylist, and five additional references list_of_lists index 0, list_of_lists index 1, and so on up to list_of_lists index 4. We can prove that they all refer to the same list by running a bit of code in the interactive interpreter: py mylist = [1, 2, 3] py list_of_lists = [mylist]*5 py list_of_lists [[1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3]] py mylist.append(99) py list_of_lists [[1, 2, 3, 99], [1, 2, 3, 99], [1, 2, 3, 99], [1, 2, 3, 99], [1, 2, 3, 99]] So rather than having five references to the same, identical, list, you might want five *copies*. You can copy a list using slicing: mylist = [1, 2, 3] copy = mylist[:] Instead of using list multiplication to repeat five identical lists, we make five copies using a list comprehension: list_of_lists = [mylist[:] for i in range(5)] then expand it in the function call as before: result = function(*list_of_lists) Hope this helps, Yes it does, thanks a lot to you and all the others who responded, the missing link which until now I wasn't aware of but which was essential for the solution was the * in result = function(*list_of_lists) kind regards, jean -- https://mail.python.org/mailman/listinfo/python-list
Re: [newbie] making rows of table with discrete values for different number systems
Op maandag 3 februari 2014 20:50:04 UTC+1 schreef Asaf Las: On Monday, February 3, 2014 9:37:36 PM UTC+2, Jean Dupont wrote: Op maandag 3 februari 2014 16:34:18 UTC+1 schreef Asaf Las: Of course you don't have to, but I'm curious and learn well by examples :-( Hi Jean Don't get me wrong i did not mean to be rude (was joking) - i think if you will do it yourself that will be very good for you - you can learn a lot from that as i did not very long time ago. My apologies for inconvenience. no hard feelings, anyway I am programming it myself using normal functions, when I have finished it I'll post it, then maybe you can do it with lamba-notation, it could be interesting to compare execution times for the two approaches kind regards, jean -- https://mail.python.org/mailman/listinfo/python-list
Re: Just compilation
On 04Feb2014 00:58, Igor Korot ikoro...@gmail.com wrote: I'm trying to incorporate the path in http://sourceforge.net/p/mysql-python/bugs/325/. I already modified the source code and now what I need is to produce the pyc code. Running python --help I don't see an option to just compile the source into the bytecode. So how do I produce the compiled version of the changed source? What I'm thinking is to compile the file update the archive and reinstall. You want the py_compile module, parse of the stdlib. Example: python -m py_compile path/to/foo.py I use this in my personal test suite as a syntax check. See the python docs for this module for further details. Cheers, -- Cameron Simpson c...@zip.com.au A friend of mine in a compiler writing class produced a compiler with one error message you lied to me when you told me this was a program. - Pete Fenelon p...@minster.york.ac.uk -- https://mail.python.org/mailman/listinfo/python-list
Re: Postfix conditionals
GöktuğKayaalp s...@gkayaalp.com wrote in message news:mailman.6377.1391490975.18130.python-l...@python.org... BartC b...@freeuk.com writes: Göktuğ Kayaalp s...@gkayaalp.com wrote in message news:mailman.4966.1388953508.18130.python-l...@python.org... AFAIK, we do not have postfix conditionals in Python, i.e. a condition appended to a statement, which determines whether the statement runs or not: py for i in [False]: ... break if not i What are your thoughts on this? I develop my own language (not Python, but also dynamic and interpreted). (First, some apologies; I thought the OP was dated February not January!) Would love to see that, if possible! (If you're into Python, then I doubt it because I don't have classes or any of those other Pythonic things that people like. However my language is a lot less dynamic and therefore can be much faster. I have a few interesting variations on statements as well; syntax is cheap and I don't know why many languages, Python included, have such a paucity of control and selection statements. I also have a project that translates my syntax into Python; the intention there was to be able to make use of some of its libraries because I don't have many of my own!) I have this feature, and it's OK, but not indispensible. I varied it a bit by allowing 'if', 'when' and 'unless' as the conditionals, just to break it up a little. However, it just maps internally to a regular if-statement. In Python though, the normal way of writing 'break if not i' is about the same length (in my language it's somewhat longer), so I can't see it getting much support. I do not really think that string length is not of much significance. The actual fact that disallows my proposal from being favoured/implemented is that in Python, `break', `return' and `continue' are statements and the community encourages having one statement per line, so that the source code is easily understandable. With my proposal implemented, the language would would be encouraging having multiple statements in one line, that looks like a single statement, but is indeed a composition of two. But, Python already allows you to combine two statements on a line, as in: if a: s while b: t So your: s if a is little different (although s will need to be restricted; 'if b if a' will look a bit odd). And someone mentioned the ternary expression which looks similar to your proposal. I suppose you can also argue that the if-part is not a statement at all, just an expression that is part of the statement (you'd have to redefine break and other statements to have an optional condition). If written as: break(not i) then it certainly won't look like two statements! Your proposal has the advantage in that it gives more dominance to the statement, making the code somewhat clearer, comparing with burying it inside an if-statement. I rather dislike the statement-orientedness of Python, but still, it is a good device of easening for the language developers and beginners when the fact that we use indentation to denote blocks is considered. (I used to have a syntax where statements and expressions were interchangeable. Now I have them distinct, which makes many things much easier, it picks up more errors (and makes it simpler to translate to translate into languages which aren't quite as expressive!)) -- Bartc -- https://mail.python.org/mailman/listinfo/python-list
Finding size of Variable
Hello, I have 10 files and I need to merge them (using K way merging). The size of each file is around 200 MB. Now suppose I am keeping the merged data in a variable named mergedData, I had thought of checking the size of mergedData using sys.getsizeof() but it somehow doesn't gives the actual value of the memory occupied. For example, if a file in my file system occupies 4 KB of data, if I read all the lines in a list, the size of the list is around 2100 bytes only. Where am I going wrong? What are the alternatives I can try? -- https://mail.python.org/mailman/listinfo/python-list
Re: Finding size of Variable
Ayushi Dalmia wrote: I have 10 files and I need to merge them (using K way merging). The size of each file is around 200 MB. Now suppose I am keeping the merged data in a variable named mergedData, I had thought of checking the size of mergedData using sys.getsizeof() but it somehow doesn't gives the actual value of the memory occupied. For example, if a file in my file system occupies 4 KB of data, if I read all the lines in a list, the size of the list is around 2100 bytes only. Where am I going wrong? What are the alternatives I can try? getsizeof() gives you the size of the list only; to complete the picture you have to add the sizes of the lines. However, why do you want to keep track of the actual memory used by variables in your script? You should instead concentrate on the algorithm, and as long as either the size of the dataset is manageable or you can limit the amount of data accessed at a given time you are golden. -- https://mail.python.org/mailman/listinfo/python-list
Re: fseek In Compressed Files
On Tuesday, February 4, 2014 2:27:38 AM UTC+5:30, Dave Angel wrote: Ayushi Dalmia ayushidalmia2...@gmail.com Wrote in message: On Thursday, January 30, 2014 4:20:26 PM UTC+5:30, Ayushi Dalmia wrote: Hello, I need to randomly access a bzip2 or gzip file. How can I set the offset for a line and later retreive the line from the file using the offset. Pointers in this direction will help. This is what I have done: import bz2 import sys from random import randint index={} data=[] f=open('temp.txt','r') for line in f: data.append(line) filename='temp1.txt.bz2' with bz2.BZ2File(filename, 'wb', compresslevel=9) as f: f.writelines(data) prevsize=0 list1=[] offset={} with bz2.BZ2File(filename, 'rb') as f: for line in f: words=line.strip().split(' ') list1.append(words[0]) offset[words[0]]= prevsize prevsize = sys.getsizeof(line)+prevsize sys.getsizeof looks at internal size of a python object, and is totally unrelated to a size on disk of a text line. len () might come closer, unless you're on Windows. You really should be using tell to define the offsets for later seek. In text mode any other calculation is not legal, ie undefined. data=[] count=0 with bz2.BZ2File(filename, 'rb') as f: while count20: y=randint(1,25) print y print offset[str(y)] count+=1 f.seek(int(offset[str(y)])) x= f.readline() data.append(x) f=open('b.txt','w') f.write(''.join(data)) f.close() where temp.txt is the posting list file which is first written in a compressed format and then read later. I thought you were starting with a compressed file. If you're being given an uncompressed file, just deal with it directly. I am trying to build the index for the entire wikipedia dump which needs to be done in a space and time optimised way. The temp.txt is as follows: 1 456 t0b3c0i0e0:784 t0b2c0i0e0:801 t0b2c0i0e0 2 221 t0b1c0i0e0:774 t0b1c0i0e0:801 t0b2c0i0e0 3 455 t0b7c0i0e0:456 t0b1c0i0e0:459 t0b2c0i0e0:669 t0b10c11i3e0:673 t0b1c0i0e0:678 t0b2c0i1e0:854 t0b1c0i0e0 4 410 t0b4c0i0e0:553 t0b1c0i0e0:609 t0b1c0i0e0 5 90 t0b1c0i0e0 So every line begins with its line number in ascii form? If true, the dict above called offsets should just be a list. Maybe you should just quote the entire assignment. You're probably adding way too much complication to it. -- DaveA Hey! I am new here. Sorry about the incorrect posts. Didn't understand the protocol then. Although, I have the uncompressed text, I cannot start right away with them -- https://mail.python.org/mailman/listinfo/python-list
Re: Finding size of Variable
On Tuesday, February 4, 2014 5:10:25 PM UTC+5:30, Peter Otten wrote: Ayushi Dalmia wrote: I have 10 files and I need to merge them (using K way merging). The size of each file is around 200 MB. Now suppose I am keeping the merged data in a variable named mergedData, I had thought of checking the size of mergedData using sys.getsizeof() but it somehow doesn't gives the actual value of the memory occupied. For example, if a file in my file system occupies 4 KB of data, if I read all the lines in a list, the size of the list is around 2100 bytes only. Where am I going wrong? What are the alternatives I can try? getsizeof() gives you the size of the list only; to complete the picture you have to add the sizes of the lines. However, why do you want to keep track of the actual memory used by variables in your script? You should instead concentrate on the algorithm, and as long as either the size of the dataset is manageable or you can limit the amount of data accessed at a given time you are golden. As I said, I need to merge large files and I cannot afford more I/O operations. So in order to minimise the I/O operation I am writing in chunks. Also, I need to use the merged files as indexes later which should be loaded in the memory for fast access. Hence the concern. Can you please elaborate on the point of taking lines into consideration? -- https://mail.python.org/mailman/listinfo/python-list
Re: Finding size of Variable
On Tuesday, February 4, 2014 2:43:21 PM UTC+2, Ayushi Dalmia wrote: As I said, I need to merge large files and I cannot afford more I/O operations. So in order to minimise the I/O operation I am writing in chunks. Also, I need to use the merged files as indexes later which should be loaded in the memory for fast access. Hence the concern. Can you please elaborate on the point of taking lines into consideration? have you tried os.sendfile()? http://docs.python.org/dev/library/os.html#os.sendfile -- https://mail.python.org/mailman/listinfo/python-list
Re: Finding size of Variable
Ayushi Dalmia ayushidalmia2...@gmail.com Wrote in message: getsizeof() gives you the size of the list only; to complete the picture you have to add the sizes of the lines. However, why do you want to keep track of the actual memory used by variables in your script? You should instead concentrate on the algorithm, and as long as either the size of the dataset is manageable or you can limit the amount of data accessed at a given time you are golden. As I said, I need to merge large files and I cannot afford more I/O operations. So in order to minimise the I/O operation I am writing in chunks. Also, I need to use the merged files as indexes later which should be loaded in the memory for fast access. Hence the concern. Can you please elaborate on the point of taking lines into consideration? Please don't doublespace your quotes. If you must use googlegroups, fix its bugs before posting. There's usually no net gain in trying to 'chunk' your output to a text file. The python file system already knows how to do that for a sequential file. For list of strings just add the getsizeof for the list to the sum of the getsizeof of all the list items. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list
Re: Finding size of Variable
On Tuesday, February 4, 2014 6:39:00 PM UTC+5:30, Dave Angel wrote: Ayushi Dalmia ayushidalmia2...@gmail.com Wrote in message: getsizeof() gives you the size of the list only; to complete the picture you have to add the sizes of the lines. However, why do you want to keep track of the actual memory used by variables in your script? You should instead concentrate on the algorithm, and as long as either the size of the dataset is manageable or you can limit the amount of data accessed at a given time you are golden. As I said, I need to merge large files and I cannot afford more I/O operations. So in order to minimise the I/O operation I am writing in chunks. Also, I need to use the merged files as indexes later which should be loaded in the memory for fast access. Hence the concern. Can you please elaborate on the point of taking lines into consideration? Please don't doublespace your quotes. If you must use googlegroups, fix its bugs before posting. There's usually no net gain in trying to 'chunk' your output to a text file. The python file system already knows how to do that for a sequential file. For list of strings just add the getsizeof for the list to the sum of the getsizeof of all the list items. -- DaveA Hey! I need to chunk out the outputs otherwise it will give Memory Error. I need to do some postprocessing on the data read from the file too. If I donot stop before memory error, I won't be able to perform any more operations on it. -- https://mail.python.org/mailman/listinfo/python-list
Re: Finding size of Variable
On Tuesday, February 4, 2014 6:23:19 PM UTC+5:30, Asaf Las wrote: On Tuesday, February 4, 2014 2:43:21 PM UTC+2, Ayushi Dalmia wrote: As I said, I need to merge large files and I cannot afford more I/O operations. So in order to minimise the I/O operation I am writing in chunks. Also, I need to use the merged files as indexes later which should be loaded in the memory for fast access. Hence the concern. Can you please elaborate on the point of taking lines into consideration? have you tried os.sendfile()? http://docs.python.org/dev/library/os.html#os.sendfile os.sendfile will not serve my purpose. I not only need to merge files, but do it in a sorted way. Thus some postprocessing is needed. -- https://mail.python.org/mailman/listinfo/python-list
RapydBox
Hello, For those of you who are interested by tools like NodeBox or Processing. you can give a try to RapydScript here : https://github.com/artyprog/RapydBox Regards -- https://mail.python.org/mailman/listinfo/python-list
Re: Logging data from Arduino using PySerial
On 2014-02-04 04:07, Thomas wrote: I've written a script to log data from my Arduino to a csv file. The script works well enough but it's very, very slow. I'm quite new to Python and I just wanted to put this out there to see if any Python experts could help optimise my code. Here it is: [snip] # Cleaning the data_log and storing it in data.csv with open('data.csv','wb') as csvfile: for line in data_log: line_data = re.findall('\d*\.\d*',line) # Find all digits line_data = filter(None,line_data)# Filter out empty strings line_data = [float(x) for x in line_data] # Convert Strings to float for i in range(1,len(line_data)): line_data[i]=map(line_data[i],0,1023,0,5) You're doing this for every in line the log: csvwrite = csv.writer(csvfile) [snip] Try moving before the 'for' loop so it's done only once. -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] Usage of U+00B6 PILCROW SIGN (was: generator slides review and Python doc (+/- text bug))
On Tue, Feb 4, 2014 at 1:51 AM, wxjmfa...@gmail.com wrote: I got it. If I'm visiting a page like this: http://docs.python.org/3/tutorial/index.html#the-python-tutorial 1) To read the page, I'm scrolling down. 2) When I have finished to read the page, I scroll up (or scroll back/up) to the top of the page until I see this feature and the title. 3) I click on this feature. 4) The title, already visible, moves, let's say, 2cm higher. ...? Those links aren't for navigation. They're so you can discover anchor links in the page and pass them to someone else. For instance, if I want to point someone to the section of the tutorial that talks about reading and writing files, I could just give them this link: http://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files, instead of pointing them to the main page and instructing them to scroll down until they see Section 7.2 I was able to discover that link by opening the page, highlighting the section header with my mouse, then clicking the pilcrow. That gives me the anchor link to that section header. -- https://mail.python.org/mailman/listinfo/python-list
Re: Advice needed for Python packaging - can't find required library during installation
Thank you very much! :-) On Monday, February 3, 2014 11:30:00 PM UTC-8, dieter wrote: thebiggestbangthe...@gmail.com writes: I am trying to package up a very simple python app. In my setup.py file I have a couple of lines that include the following: from setuptools import setup setup( name='ban', version='0.1', packages=['ban',], description='Python Distribution Utilities', author='Ban', author_email='b...@tbbt.com', package_data={'ban': ['data/*.dat']}, long_description=open('README.txt').read(), install_requires=['Google-Safe-Browsing-v2-Lookup'], ) ... Processing dependencies for ban==0.1 Searching for Google-Safe-Browsing-v2-Lookup Reading http://pypi.python.org/simple/Google-Safe-Browsing-v2-Lookup/ No local packages or download links found for Google-Safe-Browsing-v2-Lookup error: Could not find suitable distribution for Requirement.parse('Google-Safe-Browsing-v2-Lookup') ** Issue #1 Apparently the setup script cannot find the package - Google-Safe-Browsing-v2-Lookup . However, I can install this package via pip. What should I specify in the setup.py file instead of install_requires=['Google-Safe-Browsing-v2-Lookup'] so that the library is properly installed ? I suppose that setuptools is confused by the - in the package names together with these - being omitted in the uploaded file (https://pypi.python.org/packages/source/G/Google-Safe-Browsing-v2-Lookup/Google%20Safe%20Browsing%20v2%20Lookup-0.1.0.tar.gz5;). If this supposition is correct, then you would either need to contact the setuptools author (to get setuptools handle this case) or the Google Safe Browsing author to get a filename more in line with the package name. -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] Usage of U+00B6 PILCROW SIGN (was: generator slides review and Python doc (+/- text bug))
Le mardi 4 février 2014 15:39:54 UTC+1, Jerry Hill a écrit : On Tue, Feb 4, 2014 at 1:51 AM, wxjmfa...@gmail.com wrote: I got it. If I'm visiting a page like this: http://docs.python.org/3/tutorial/index.html#the-python-tutorial 1) To read the page, I'm scrolling down. 2) When I have finished to read the page, I scroll up (or scroll back/up) to the top of the page until I see this feature and the title. 3) I click on this feature. 4) The title, already visible, moves, let's say, 2cm higher. ...? Those links aren't for navigation. They're so you can discover anchor links in the page and pass them to someone else. For instance, if I want to point someone to the section of the tutorial that talks about reading and writing files, I could just give them this link: http://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files, instead of pointing them to the main page and instructing them to scroll down until they see Section 7.2 I was able to discover that link by opening the page, highlighting the section header with my mouse, then clicking the pilcrow. That gives me the anchor link to that section header. Useless and really ugly. -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] Usage of U+00B6 PILCROW SIGN
On 02/04/2014 08:21 AM, wxjmfa...@gmail.com wrote: Useless and really ugly. How do you recommend we discover the anchor links for linking to? -- https://mail.python.org/mailman/listinfo/python-list
Re: Calculator Problem
On Sunday, February 2, 2014 4:16:44 PM UTC-5, Charlie Winn wrote: Hey Guys i Need Help , When i run this program i get the 'None' Under the program, see what i mean by just running it , can someone help me fix this def Addition(): print('Addition: What are two your numbers?') 1 = float(input('First Number:')) 2 = float(input('Second Number:')) print('Your Final Result is:', 1 + 2) def Subtraction(): print('Subtraction: What are two your numbers?') 3 = float(input('First Number:')) 4 = float(input('Second Number:')) print('Your Final Result is:', 3 - 4) def Multiplication(): print('Multiplication: What are two your numbers?') 5 = float(input('First Number:')) 6 = float(input('Second Number:')) print('Your Final Result is:', 5 * 6) def Division(): print('Division: What are your two numbers?') 7 = float(input('First Number:')) 8 = float(input('Second Number:')) print('Your Final Result is:', 7 / 8) print('What type of calculation would you like to do?') Question = input('(Add, Subtract, Divide or Multiply)') if Question.lower().startswith('a'): print(Addition()) elif Question.lower().startswith('s'): print(Subtraction()) elif Question.lower().startswith('d'): print(Division()) elif Question.lower().startswith('m'): print(Multiplication()) else: print('Please Enter The First Letter Of The Type Of Calculation You Would Like To Use') while Question == 'test': Question() Can anyone point out how using an int as a var is possible, unless it's something I miss that changed in 3.3 from 3.2: david@david:~$ python3.2 Python 3.2.3 (default, Sep 25 2013, 18:25:56) [GCC 4.6.3] on linux2 Type help, copyright, credits or license for more information. 7 = float(input('First Number:')) File stdin, line 1 SyntaxError: can't assign to literal david@david:~$ python Python 2.7.3 (default, Sep 26 2013, 20:08:41) [GCC 4.6.3] on linux2 Type help, copyright, credits or license for more information. 7 = float(input('First Number:')) File stdin, line 1 SyntaxError: can't assign to literal -- https://mail.python.org/mailman/listinfo/python-list
Re: Calculator Problem
Missed that it's already pointed out, was looking at the google groups combined email. On Tue, Feb 4, 2014 at 10:43 AM, David Hutto dwightdhu...@gmail.com wrote: On Sunday, February 2, 2014 4:16:44 PM UTC-5, Charlie Winn wrote: Hey Guys i Need Help , When i run this program i get the 'None' Under the program, see what i mean by just running it , can someone help me fix this def Addition(): print('Addition: What are two your numbers?') 1 = float(input('First Number:')) 2 = float(input('Second Number:')) print('Your Final Result is:', 1 + 2) def Subtraction(): print('Subtraction: What are two your numbers?') 3 = float(input('First Number:')) 4 = float(input('Second Number:')) print('Your Final Result is:', 3 - 4) def Multiplication(): print('Multiplication: What are two your numbers?') 5 = float(input('First Number:')) 6 = float(input('Second Number:')) print('Your Final Result is:', 5 * 6) def Division(): print('Division: What are your two numbers?') 7 = float(input('First Number:')) 8 = float(input('Second Number:')) print('Your Final Result is:', 7 / 8) print('What type of calculation would you like to do?') Question = input('(Add, Subtract, Divide or Multiply)') if Question.lower().startswith('a'): print(Addition()) elif Question.lower().startswith('s'): print(Subtraction()) elif Question.lower().startswith('d'): print(Division()) elif Question.lower().startswith('m'): print(Multiplication()) else: print('Please Enter The First Letter Of The Type Of Calculation You Would Like To Use') while Question == 'test': Question() Can anyone point out how using an int as a var is possible, unless it's something I miss that changed in 3.3 from 3.2: david@david:~$ python3.2 Python 3.2.3 (default, Sep 25 2013, 18:25:56) [GCC 4.6.3] on linux2 Type help, copyright, credits or license for more information. 7 = float(input('First Number:')) File stdin, line 1 SyntaxError: can't assign to literal david@david:~$ python Python 2.7.3 (default, Sep 26 2013, 20:08:41) [GCC 4.6.3] on linux2 Type help, copyright, credits or license for more information. 7 = float(input('First Number:')) File stdin, line 1 SyntaxError: can't assign to literal -- https://mail.python.org/mailman/listinfo/python-list -- Best Regards, David Hutto *CEO:* *http://www.hitwebdevelopment.com http://www.hitwebdevelopment.com* -- https://mail.python.org/mailman/listinfo/python-list
Latest Python 3.4 in the source repo is broken?
Before I bother Python-Dev with this, can anyone else confirm that building Python 3.4 from source using the latest version in the source repository fails? # Get the source code hg clone http://hg.python.org/cpython # Build Python (on Unix, sorry Windows and Mac people, you're on your own) ./configure --with-pydebug make -j2 I get the following errors: libpython3.4dm.a(pythonrun.o): In function `_Py_InitializeEx_Private': /home/steve/python/cpython/Python/pythonrun.c:459: undefined reference to `_PyTraceMalloc_Init' libpython3.4dm.a(pythonrun.o): In function `Py_Finalize': /home/steve/python/cpython/Python/pythonrun.c:648: undefined reference to `_PyTraceMalloc_Fini' collect2: ld returned 1 exit status make: *** [Modules/_testembed] Error 1 Thanks in advance, -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Latest Python 3.4 in the source repo is broken?
On Tue, Feb 4, 2014 at 9:45 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Before I bother Python-Dev with this, can anyone else confirm that building Python 3.4 from source using the latest version in the source repository fails? # Get the source code hg clone http://hg.python.org/cpython # Build Python (on Unix, sorry Windows and Mac people, you're on your own) ./configure --with-pydebug make -j2 I get the following errors: libpython3.4dm.a(pythonrun.o): In function `_Py_InitializeEx_Private': /home/steve/python/cpython/Python/pythonrun.c:459: undefined reference to `_PyTraceMalloc_Init' libpython3.4dm.a(pythonrun.o): In function `Py_Finalize': /home/steve/python/cpython/Python/pythonrun.c:648: undefined reference to `_PyTraceMalloc_Fini' collect2: ld returned 1 exit status make: *** [Modules/_testembed] Error 1 The buildbots[1] don't seem to agree, and it builds fine for me on Windows. In order of destructiveness, try these: make Without -j2, see if there's a race somewhere. make distclean Clear out nearly all generated files. hg purge --all Clear out everything that's not checked in (this includes untracked and ignored files). You may need to enable the purge extension, `hg --config extensions.purge= purge --all` And I would suggest checking the output of `hg purge --all -p` before you do it to make sure you're not obliterating anything you want to keep. hg up null hg purge --all hg up default Rebuild the repository from scratch (without a full clone). [1] http://buildbot.python.org/all/waterfall?category=3.x.stable -- Zach -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] Usage of U+00B6 PILCROW SIGN
On Wed, Feb 5, 2014 at 2:31 AM, Michael Torrie torr...@gmail.com wrote: On 02/04/2014 08:21 AM, wxjmfa...@gmail.com wrote: Useless and really ugly. How do you recommend we discover the anchor links for linking to? Same way you usually do! By right clicking, hitting View Source, and poking around until you find the right place! I've done exactly that with innumerable web sites. It's a massive luxury to have them explicitly published like that; as well as the convenience, it gives an impression (whether that's true or false) that the hash links are deemed important and will therefore be maintained in the future (unlike, say, a system that has http:///#s4; for the fourth (or fifth) section - inserting a section above this one will break my link) ChrisA . -- https://mail.python.org/mailman/listinfo/python-list
Re: Latest Python 3.4 in the source repo is broken?
On 04 Feb 2014 15:45:46 GMT Steven D'Aprano wrote: Before I bother Python-Dev with this, can anyone else confirm that building Python 3.4 from source using the latest version in the source repository fails? I can not confirm an error. I checked out the latest sources and ./configure and make executed without any error using exactly your parameters. snip Thanks in advance, You are welcome... ;) Regards, Johannes -- https://mail.python.org/mailman/listinfo/python-list
Re: Latest Python 3.4 in the source repo is broken?
On Wed, Feb 5, 2014 at 3:02 AM, Zachary Ware zachary.ware+pyl...@gmail.com wrote: On Tue, Feb 4, 2014 at 9:45 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Before I bother Python-Dev with this, can anyone else confirm that building Python 3.4 from source using the latest version in the source repository fails? # Build Python (on Unix, sorry Windows and Mac people, you're on your own) ./configure --with-pydebug make -j2 The buildbots[1] don't seem to agree, and it builds fine for me on Windows. In order of destructiveness, try these: [1] http://buildbot.python.org/all/waterfall?category=3.x.stable Are there any buildbots that configure --with-pydebug? This could be a debug-only issue. That said, though, I just did a build without -j2 (on Linux - Debian Wheezy amd64) and it worked fine. Doing another one with -j2 didn't show up any errors either, but if it is a -j problem, then as Zachary says, it could be a race. What commit hash were you building from? It might have been broken and then fixed shortly, and you got into that tiny window. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Latest Python 3.4 in the source repo is broken?
On Tue, Feb 4, 2014 at 10:49 AM, Chris Angelico ros...@gmail.com wrote: Are there any buildbots that configure --with-pydebug? This could be a debug-only issue. Only all of them :). As far as I know, the only 'bot that does a non-debug build is the x86 Gentoo Non-Debug bot. That said, though, I just did a build without -j2 (on Linux - Debian Wheezy amd64) and it worked fine. Doing another one with -j2 didn't show up any errors either, but if it is a -j problem, then as Zachary says, it could be a race. What commit hash were you building from? It might have been broken and then fixed shortly, and you got into that tiny window. There was a brief issue this morning, but it was in typeobject.c, not _testembed. See http://hg.python.org/cpython/rev/655d7a55c165 -- Zach -- https://mail.python.org/mailman/listinfo/python-list
Re: Latest Python 3.4 in the source repo is broken?
On Wed, Feb 5, 2014 at 3:58 AM, Zachary Ware zachary.ware+pyl...@gmail.com wrote: On Tue, Feb 4, 2014 at 10:49 AM, Chris Angelico ros...@gmail.com wrote: Are there any buildbots that configure --with-pydebug? This could be a debug-only issue. Only all of them :). As far as I know, the only 'bot that does a non-debug build is the x86 Gentoo Non-Debug bot. LOL! Okay. Yeah, I think that settles that part of the question! ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Latest Python 3.4 in the source repo is broken?
On 02/04/2014 07:45 AM, Steven D'Aprano wrote: Before I bother Python-Dev with this, can anyone else confirm that building Python 3.4 from source using the latest version in the source repository fails? This is the check-out I'm using: ethan@media:~/source/python/cpython$ hg parent rev:88961:7d0a4f89c6ce branch: default tag:tip user: Vinay Sajip vinay_sa...@yahoo.co.uk date: 2014-02-04 16:42 + desc: Closes #20509: Merged documentation update from 3.3. These are the settings I always use to make sure I have no weird problems between check-outs: ethan@media:~/source/python/cpython$ make distclean ./configure --with-pydebug make -j3 .. .. .. Python build finished successfully! The necessary bits to build these optional modules were not found: _gdbm _lzma To find the necessary bits, look in setup.py in detect_modules() for the module's name. running build_scripts creating build/scripts-3.4 copying and adjusting /home/ethan/source/python/cpython/Tools/scripts/pydoc3 - build/scripts-3.4 copying and adjusting /home/ethan/source/python/cpython/Tools/scripts/idle3 - build/scripts-3.4 copying and adjusting /home/ethan/source/python/cpython/Tools/scripts/2to3 - build/scripts-3.4 copying and adjusting /home/ethan/source/python/cpython/Tools/scripts/pyvenv - build/scripts-3.4 changing mode of build/scripts-3.4/pydoc3 from 664 to 775 changing mode of build/scripts-3.4/idle3 from 664 to 775 changing mode of build/scripts-3.4/2to3 from 664 to 775 changing mode of build/scripts-3.4/pyvenv from 664 to 775 renaming build/scripts-3.4/pydoc3 to build/scripts-3.4/pydoc3.4 renaming build/scripts-3.4/idle3 to build/scripts-3.4/idle3.4 renaming build/scripts-3.4/2to3 to build/scripts-3.4/2to3-3.4 renaming build/scripts-3.4/pyvenv to build/scripts-3.4/pyvenv-3.4 Hope this helps. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] Usage of U+00B6 PILCROW SIGN
On 2/4/14 10:21 AM, wxjmfa...@gmail.com wrote: I was able to discover that link by opening the page, highlighting the section header with my mouse, then clicking the pilcrow. That gives me the anchor link to that section header. Useless and really ugly. I'm not sure why you would describe it as useless? It's incredibly useful to have a way to link to a particular section. And ugly? It's a UI that is invisible and unobtrusive, but then elegant once you hover over the element you are interested in. I guess tastes differ... Lots of sites use this technique, it is not particular to the Python docs. -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] Usage of U+00B6 PILCROW SIGN
In article mailman.6391.1391527903.18130.python-l...@python.org, Michael Torrie torr...@gmail.com wrote: On 02/04/2014 08:21 AM, wxjmfa...@gmail.com wrote: Useless and really ugly. How do you recommend we discover the anchor links for linking to? Use the Table Of Contents panel on the left? -- Jim Gibson -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] Usage of U+00B6 PILCROW SIGN
Michael Torrie wrote: On 02/04/2014 08:21 AM, wxjmfa...@gmail.com wrote: Useless and really ugly. How do you recommend we discover the anchor links for linking to? Why not the whole header? Click anywhere on 7.2.1. Regular Expression Syntax instead of the tiny ¶ symbol beside it. -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] Usage of U+00B6 PILCROW SIGN (was: generator slides review and Python doc (+/- text bug))
2014-02-04 wxjmfa...@gmail.com: Le mardi 4 février 2014 15:39:54 UTC+1, Jerry Hill a écrit : Useless and really ugly. I think this whole discussion is rather useless instead, why do you care since you're not going to use this tool anyway? -- https://mail.python.org/mailman/listinfo/python-list
Re:Finding size of Variable
Ayushi Dalmia ayushidalmia2...@gmail.com Wrote in message: Where am I going wrong? What are the alternatives I can try? You've rejected all the alternatives so far without showing your code, or even properly specifying your problem. To get the total size of a list of strings, try (untested): a = sys.getsizeof (mylist ) for item in mylist: a += sys.getsizeof (item) This can be high if some of the strings are interned and get counted twice. But you're not likely to get closer without some knowledge of the data objects and where they come from. -- DaveA -- https://mail.python.org/mailman/listinfo/python-list
Re: Finding size of Variable
On 2014-02-04 14:21, Dave Angel wrote: To get the total size of a list of strings, try (untested): a = sys.getsizeof (mylist ) for item in mylist: a += sys.getsizeof (item) I always find this sort of accumulation weird (well, at least in Python; it's the *only* way in many other languages) and would write it as a = getsizeof(mylist) + sum(getsizeof(item) for item in mylist) -tkc -- https://mail.python.org/mailman/listinfo/python-list
Re: Finding size of Variable
On 04/02/2014 19:21, Dave Angel wrote: Ayushi Dalmia ayushidalmia2...@gmail.com Wrote in message: Where am I going wrong? What are the alternatives I can try? You've rejected all the alternatives so far without showing your code, or even properly specifying your problem. To get the total size of a list of strings, try (untested): a = sys.getsizeof (mylist ) for item in mylist: a += sys.getsizeof (item) The documentation for sys.getsizeof: http://docs.python.org/dev/library/sys#sys.getsizeof warns about the limitations of this function when applied to a container, and even points to a recipe by Raymond Hettinger which attempts to do a more complete job. TJG -- https://mail.python.org/mailman/listinfo/python-list
kivy
i installed python 2.7 before and installed suitable kivy.. i have also included the .bat file in the send to option.. but my programs are not at all runnning and giving me error when i run it normally or with the .bat file.. it says that there's no module named kivy when i import it.. please help im just frustrated after writing a long code and seeing that it isn't working.. if anyone has suggestions on how to develop android 2d games with python their reply would be greatly appreciated. thank you -- https://mail.python.org/mailman/listinfo/python-list
Re: kivy
On 2014-02-04 19:55, bharath wrote: i installed python 2.7 before and installed suitable kivy.. i have also included the .bat file in the send to option.. but my programs are not at all runnning and giving me error when i run it normally or with the .bat file.. it says that there's no module named kivy when i import it.. please help im just frustrated after writing a long code and seeing that it isn't working.. if anyone has suggestions on how to develop android 2d games with python their reply would be greatly appreciated. thank you Is kivy listed in the Python search paths (sys.path)? -- https://mail.python.org/mailman/listinfo/python-list
Re: kivy
On Wednesday, February 5, 2014 1:51:31 AM UTC+5:30, MRAB wrote: On 2014-02-04 19:55, bharath wrote: i installed python 2.7 before and installed suitable kivy.. i have also included the .bat file in the send to option.. but my programs are not at all runnning and giving me error when i run it normally or with the .bat file.. it says that there's no module named kivy when i import it.. please help im just frustrated after writing a long code and seeing that it isn't working.. if anyone has suggestions on how to develop android 2d games with python their reply would be greatly appreciated. thank you Is kivy listed in the Python search paths (sys.path)? -- https://mail.python.org/mailman/listinfo/python-list
Re: kivy
On Wednesday, February 5, 2014 1:51:31 AM UTC+5:30, MRAB wrote: On 2014-02-04 19:55, bharath wrote: i installed python 2.7 before and installed suitable kivy.. i have also included the .bat file in the send to option.. but my programs are not at all runnning and giving me error when i run it normally or with the .bat file.. it says that there's no module named kivy when i import it.. please help im just frustrated after writing a long code and seeing that it isn't working.. if anyone has suggestions on how to develop android 2d games with python their reply would be greatly appreciated. thank you Is kivy listed in the Python search paths (sys.path)? yes -- https://mail.python.org/mailman/listinfo/python-list
Re: kivy
On 02/04/2014 11:55 AM, bharath wrote: i installed python 2.7 before and installed suitable kivy.. i have also included the .bat file in the send to option.. but my programs are not at all runnning and giving me error when i run it normally or with the .bat file.. it says that there's no module named kivy when i import it.. please help im just frustrated after writing a long code and seeing that it isn't working.. if anyone has suggestions on how to develop android 2d games with python their reply would be greatly appreciated. thank you This is a Python newsgroup. You might find an answer here, but I think you'd have much better luck if you found a kivy specific newsgroup. Good luck, Gary Herron -- https://mail.python.org/mailman/listinfo/python-list
RE: kivy
Is kivy listed in the Python search paths (sys.path)? yes To be extra sure, you can start a python interpreter with the commandline argument -vv, and when you try to import kivy (or any module) it will show you every file/path it checks when trying to find it. This might help you narrow down where the problem lies. -Nick Cash -- https://mail.python.org/mailman/listinfo/python-list
Re: kivy
On Wednesday, February 5, 2014 2:03:58 AM UTC+5:30, Nick Cash wrote: Is kivy listed in the Python search paths (sys.path)? yes To be extra sure, you can start a python interpreter with the commandline argument -vv, and when you try to import kivy (or any module) it will show you every file/path it checks when trying to find it. This might help you narrow down where the problem lies. -Nick Cash thanks nick that helped. i actually cant express this feeling of gratitude.. thank you very much.this is a wonderful group.. -- https://mail.python.org/mailman/listinfo/python-list
Re: Calculator Problem
On Sunday, February 2, 2014 4:16:44 PM UTC-5, Charlie Winn wrote: Hey Guys i Need Help , When i run this program i get the 'None' Under the program, see what i mean by just running it , can someone help me fix this def Addition(): print('Addition: What are two your numbers?') 1 = float(input('First Number:')) 2 = float(input('Second Number:')) print('Your Final Result is:', 1 + 2) def Subtraction(): print('Subtraction: What are two your numbers?') 3 = float(input('First Number:')) 4 = float(input('Second Number:')) print('Your Final Result is:', 3 - 4) def Multiplication(): print('Multiplication: What are two your numbers?') 5 = float(input('First Number:')) 6 = float(input('Second Number:')) print('Your Final Result is:', 5 * 6) def Division(): print('Division: What are your two numbers?') 7 = float(input('First Number:')) 8 = float(input('Second Number:')) print('Your Final Result is:', 7 / 8) print('What type of calculation would you like to do?') Question = input('(Add, Subtract, Divide or Multiply)') if Question.lower().startswith('a'): print(Addition()) elif Question.lower().startswith('s'): print(Subtraction()) elif Question.lower().startswith('d'): print(Division()) elif Question.lower().startswith('m'): print(Multiplication()) else: print('Please Enter The First Letter Of The Type Of Calculation You Would Like To Use') while Question == 'test': Question() I don't know why people bother trying to help you, when it is YOU that has a *** rude attitude. You are asking the wrong question to begin with because the posted code could have NEVER given you the stated output. Most of us here are noobs and those that are not, were noobs once; so we all can deal with noobs, but none should have to deal with a***holes. -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] Usage of U+00B6 PILCROW SIGN
On 2/4/2014 1:20 PM, Ned Batchelder wrote: On 2/4/14 10:21 AM, wxjmfa...@gmail.com wrote: I was able to discover that link by opening the page, highlighting the section header with my mouse, then clicking the pilcrow. That gives me the anchor link to that section header. Useless and really ugly. I'm not sure why you would describe it as useless? Because, as we should all know by now, when Jim says 'useless', he means 'useless to me, according to my unusual notions of personal usefulness'. He, apparently, does not intend to ever use the pilcrow to get a section link, nor does he care about being able to click on such links presented by others. It's incredibly useful to have a way to link to a particular section. For many people, but not for Jim. Either he does not care about usefulness to others, or he is completely oblivious to how idiosyncratic his personal idea of usefulness is. In either case, it is useless to argue against his personal opinion. He should, however, add 'to me' since most people take 'useless' in the collective sense. And ugly? It's a UI that is invisible and unobtrusive, but then elegant once you hover over the element you are interested in. Having it pop up and disappear when one does not want it and will not use it is not pretty. When scrolling with a mouse wheel, that does happen. I guess tastes differ... Lots of sites use this technique, it is not particular to the Python docs. Irrelevant to Jim. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] Usage of U+00B6 PILCROW SIGN
On 2/4/2014 10:21 AM, wxjmfa...@gmail.com wrote: I was able to discover that link by opening the page, highlighting the section header with my mouse, then clicking the pilcrow. That gives me the anchor link to that section header. Useless and really ugly. Jim, when you say 'useless', please qualify as 'useless to me'. Otherwise, people may think that you mean 'useless to eveyone', and it is disrespectful to mislead people that way. I hope you are aware that your personal ideas of usefulness to yourself are quite different from other peoples' ideas of usefulness to themselves. I now understand that you consider the FSR useless *to you* because you do not care about the bugginess of narrow builds or about the spacious of wide builds. You do care about uniformity of character size across all strings, and FSR lacks that. You are entitled to make that judgment for yourself. You are not entitled to sabotage others by projecting you personal judgments onto others. The FSR and pilcrow are definitely useful to other people as they judge personal usefulness for themselves. PS. I agree that the pilcrow appearing and disappearing is not pretty when I am not looking to use it. I happen to think that is it tolerable because it is sometimes useful. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] Usage of U+00B6 PILCROW SIGN
On 2/4/2014 2:19 PM, andrea crotti wrote: 2014-02-04 wxjmfa...@gmail.com: Useless and really ugly. I think this whole discussion is rather useless. I agree that responding to Jim's generalized statements such as 'useless' are either sincere personal opinions that are true with respect to himself, delusional statements that are false with respect to the community at large, or intentionally false trolls. I really cannot tell. In any case, I agree that response is pretty useless. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] Usage of U+00B6 PILCROW SIGN
On 2/4/2014 6:24 PM, Terry Reedy wrote: On 2/4/2014 2:19 PM, andrea crotti wrote: 2014-02-04 wxjmfa...@gmail.com: Useless and really ugly. I think this whole discussion is rather useless. I agree that responding to Jim's generalized statements such as 'useless' are either sincere personal opinions that are true with respect to himself, delusional statements that are false with respect to the community at large, or intentionally false trolls. I really cannot tell. In any case, I agree that response is pretty useless. Please ignore garbled post as I hit send in mid composition while revising. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] Usage of U+00B6 PILCROW SIGN
On Wed, Feb 5, 2014 at 10:18 AM, Terry Reedy tjre...@udel.edu wrote: PS. I agree that the pilcrow appearing and disappearing is not pretty when I am not looking to use it. I happen to think that is it tolerable because it is sometimes useful. Yes, it's not perfect. But neither are the obvious alternatives: * Keeping the symbol there permanently looks weird, and also raises the question of whether or not it should be copied to the clipboard if you select a whole pile of content. (If it is, you get an ugly bit of junk in your text, something that now (being unclickable) has no meaning. If it isn't, why isn't it? It's clearly part of the text!) * Making the whole heading clickable is a bit weird in terms of UI. It makes this text a link to itself, where it looks like it could be a link to somewhere else. I've seen other sites where headings are all links back to their ToC entries (ie the top of the page, or close to), which is also weird, and the fact that it could be either means that people won't know they can click on the heading to get a link to that section. * Having nothing on the section itself does work, but it means that finding a section link requires you to go back up to the top of the page, figure out which Contents entry is the section you want, and click on it. That's how I get section links from a MediaWiki site (eg Wikipedia); yes, it's workable, but it would be nicer to have the link down at the section I'm reading. * Putting a fixed-position piece of text showing the current section is way too intrusive. I've seen sites with that, and I'm sure it's useful, but I'd really prefer something a lot more subtle. All of the above are plausible, but none is perfect. So what do you do? You go with something imperfect and cope with a few issues. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Concepts and Applications of Finite Element Analysis (4th Ed., Cook, Malkus, Plesha Witt)
On 2/4/14 6:24 PM, yamas wrote: On Sun, 02 Feb 2014 17:59:29 -0600, kalvinmanual3 wrote: I have solutions manuals to all problems and exercises in these textbooks. To get one in an electronic format contact me at fuck off retard No matter what you think of the inappropriate post about manuals, this kind of response is completely unacceptable. Please don't do it again. Please read this: http://www.python.org/psf/codeofconduct -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Calculator Problem
In article ed1c2ddd-f704-4d58-a5a4-aef13de88...@googlegroups.com, David Hutto dwightdhu...@gmail.com wrote: Can anyone point out how using an int as a var is possible one = 42 (ducking and running) -- https://mail.python.org/mailman/listinfo/python-list
Re: Calculator Problem
On Wed, Feb 5, 2014 at 11:53 AM, Roy Smith r...@panix.com wrote: In article ed1c2ddd-f704-4d58-a5a4-aef13de88...@googlegroups.com, David Hutto dwightdhu...@gmail.com wrote: Can anyone point out how using an int as a var is possible one = 42 (ducking and running) In theory, there might be a Unicode character that's valid as an identifier, but gets converted into U+0031 for ASCIIfication prior to being sent by email. However, I can't find one :) And of course, that assumes that the OP's mail client mangles its input in that way. ASCIIfication shouldn't be necessary. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Concepts and Applications of Finite Element Analysis (4th Ed., Cook, Malkus, Plesha Witt)
On 2/4/2014 6:36 PM, Ned Batchelder wrote: On 2/4/14 6:24 PM, yamas wrote: On Sun, 02 Feb 2014 17:59:29 -0600, kalvinmanual3 wrote: commercial spam Python-list (and gmane) readers do not see and hence never notice the spam that gets blocked -- about 90%. Since essentially identical messages have appeared before, probably from the same sender, I tweaked the settings a bit. obscenity deleted slur deleted The few spam messages that do make it to the list should almost always be ignored and not kept alive by responses. One would have to be ignorant and/or foolish to think that spammers read responses on any of the many lists they spam. So any response is directed at the non-spammer readers. Obnoxious responses like that above constitute trolling. No matter what you think of the inappropriate post about manuals, this kind of response is completely unacceptable. Please don't do it again. Please read this: http://www.python.org/psf/codeofconduct Please do, and follow it. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Calculator Problem
On Tue, 04 Feb 2014 19:53:52 -0500, Roy Smith wrote: In article ed1c2ddd-f704-4d58-a5a4-aef13de88...@googlegroups.com, David Hutto dwightdhu...@gmail.com wrote: Can anyone point out how using an int as a var is possible one = 42 (ducking and running) int = 42 (ducking lower and running faster) -- https://mail.python.org/mailman/listinfo/python-list
Re: kivy
On Wednesday, February 5, 2014 1:25:43 AM UTC+5:30, bharath wrote: please help im just frustrated after writing a long code and seeing that it isn't working.. Prior to Kernighan and Ritchie people did tend to write 'a long code' and then check that its working (or not). After 'The C programming language' -- which is about 40 years -- starting any programming enterprise without writing AND CHECKING the equivalent of Hello World is just never done. IOW you underestimate how many niggling details both of the system and of your understanding are checked by that approach -- https://mail.python.org/mailman/listinfo/python-list
Re: Finding size of Variable
On Tuesday, February 4, 2014 7:36:48 PM UTC+5:30, Dennis Lee Bieber wrote: On Tue, 4 Feb 2014 05:19:48 -0800 (PST), Ayushi Dalmia ayushidalmia2...@gmail.com declaimed the following: I need to chunk out the outputs otherwise it will give Memory Error. I need to do some postprocessing on the data read from the file too. If I donot stop before memory error, I won't be able to perform any more operations on it. 10 200MB files is only 2GB... Most any 64-bit processor these days can handle that. Even some 32-bit systems could handle it (WinXP booted with the server option gives 3GB to user processes -- if the 4GB was installed in the machine). However, you speak of an n-way merge. The traditional merge operation only reads one record from each file at a time, examines them for first, writes that first, reads next record from the file first came from, and then reassesses the set. You mention needed to chunk the data -- that implies performing a merge sort in which you read a few records from each file into memory, sort them, and right them out to newFile1; then read the same number of records from each file, sort, and write them to newFile2, up to however many files you intend to work with -- at that point you go back and append the next chunk to newFile1. When done, each file contains chunks of n*r records. You now make newFilex the inputs, read/merge the records from those chunks outputting to another file1, when you reach the end of the first chunk in the files you then read/merge the second chunk into another file2. You repeat this process until you end up with only one chunk in one file. -- Wulfraed Dennis Lee Bieber AF6VN wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/ The way you mentioned for merging the file is an option but that will involve a lot of I/O operation. Also, I do not want the size of the file to increase beyond a certain point. When I reach the file size upto a certain limit, I want to start writing in a new file. This is because I want to store them in memory again later. -- https://mail.python.org/mailman/listinfo/python-list
Re: Finding size of Variable
On Wednesday, February 5, 2014 12:51:31 AM UTC+5:30, Dave Angel wrote: Ayushi Dalmia ayushidalmia2...@gmail.com Wrote in message: Where am I going wrong? What are the alternatives I can try? You've rejected all the alternatives so far without showing your code, or even properly specifying your problem. To get the total size of a list of strings, try (untested): a = sys.getsizeof (mylist ) for item in mylist: a += sys.getsizeof (item) This can be high if some of the strings are interned and get counted twice. But you're not likely to get closer without some knowledge of the data objects and where they come from. -- DaveA Hello Dave, I just thought that saving others time is better and hence I explained only the subset of my problem. Here is what I am trying to do: I am trying to index the current wikipedia dump without using databases and create a search engine for Wikipedia documents. Note, I CANNOT USE DATABASES. My approach: I am parsing the wikipedia pages using SAX Parser, and then, I am dumping the words along with the posting list (a list of doc ids in which the word is present) into different files after reading 'X' number of pages. Now these files may have the same word and hence I need to merge them and write the final index again. Now these final indexes must be of limited size as I need to be of limited size. This is where I am stuck. I need to know how to determine the size of content in a variable before I write into the file. Here is the code for my merging: def mergeFiles(pathOfFolder, countFile): listOfWords={} indexFile={} topOfFile={} flag=[0]*countFile data=defaultdict(list) heap=[] countFinalFile=0 for i in xrange(countFile): fileName = pathOfFolder+'\index'+str(i)+'.txt.bz2' indexFile[i]= bz2.BZ2File(fileName, 'rb') flag[i]=1 topOfFile[i]=indexFile[i].readline().strip() listOfWords[i] = topOfFile[i].split(' ') if listOfWords[i][0] not in heap: heapq.heappush(heap, listOfWords[i][0]) while any(flag)==1: temp = heapq.heappop(heap) for i in xrange(countFile): if flag[i]==1: if listOfWords[i][0]==temp: //This is where I am stuck. I cannot wait until memory //error, as I need to do some postprocessing too. try: data[temp].extend(listOfWords[i][1:]) except MemoryError: writeFinalIndex(data, countFinalFile, pathOfFolder) data=defaultdict(list) countFinalFile+=1 topOfFile[i]=indexFile[i].readline().strip() if topOfFile[i]=='': flag[i]=0 indexFile[i].close() os.remove(pathOfFolder+'\index'+str(i)+'.txt.bz2') else: listOfWords[i] = topOfFile[i].split(' ') if listOfWords[i][0] not in heap: heapq.heappush(heap, listOfWords[i][0]) writeFinalIndex(data, countFinalFile, pathOfFolder) countFile is the number of files and writeFileIndex method writes into the file. -- https://mail.python.org/mailman/listinfo/python-list
Re: Finding size of Variable
On Wednesday, February 5, 2014 12:59:46 AM UTC+5:30, Tim Chase wrote: On 2014-02-04 14:21, Dave Angel wrote: To get the total size of a list of strings, try (untested): a = sys.getsizeof (mylist ) for item in mylist: a += sys.getsizeof (item) I always find this sort of accumulation weird (well, at least in Python; it's the *only* way in many other languages) and would write it as a = getsizeof(mylist) + sum(getsizeof(item) for item in mylist) -tkc This also doesn't gives the true size. I did the following: import sys data=[] f=open('stopWords.txt','r') for line in f: line=line.split() data.extend(line) print sys.getsizeof(data) where stopWords.txt is a file of size 4KB -- https://mail.python.org/mailman/listinfo/python-list
Re: Finding size of Variable
On Wednesday, February 5, 2014 11:05:05 AM UTC+5:30, Ayushi Dalmia wrote: This also doesn't gives the true size. I did the following: import sys data=[] f=open('stopWords.txt','r') for line in f: line=line.split() data.extend(line) print sys.getsizeof(data) where stopWords.txt is a file of size 4KB Try getsizeof(.join(data)) General advice: - You have been recommended (by Chris??) that you should use a database - You say you cant use a database (for whatever reason) Now the fact is you NEED database (functionality) How to escape this catch-22 situation? In computer science its called somewhat sardonically Greenspun's 10th rule And the best way out is to 1 isolate those aspects of database functionality you need 2 temporarily forget about your original problem and implement the dbms (subset of) DBMS functionality you need 3 Use 2 above to implement 1 -- https://mail.python.org/mailman/listinfo/python-list
Re: Finding size of Variable
On Wednesday, February 5, 2014 11:15:09 AM UTC+5:30, Rustom Mody wrote: On Wednesday, February 5, 2014 11:05:05 AM UTC+5:30, Ayushi Dalmia wrote: This also doesn't gives the true size. I did the following: import sys data=[] f=open('stopWords.txt','r') for line in f: line=line.split() data.extend(line) print sys.getsizeof(data) where stopWords.txt is a file of size 4KB Try getsizeof(.join(data)) General advice: - You have been recommended (by Chris??) that you should use a database - You say you cant use a database (for whatever reason) Now the fact is you NEED database (functionality) How to escape this catch-22 situation? In computer science its called somewhat sardonically Greenspun's 10th rule And the best way out is to 1 isolate those aspects of database functionality you need 2 temporarily forget about your original problem and implement the dbms (subset of) DBMS functionality you need 3 Use 2 above to implement 1 Hello Rustum, Thanks for the enlightenment. I did not know about the Greenspun's Tenth rule. It is interesting to know that. However, it is an academic project and not a research one. Hence I donot have the liberty to choose what to work with. Life is easier with databases though, but I am not allowed to use them. Thanks for the tip. I will try to replicate those functionality. -- https://mail.python.org/mailman/listinfo/python-list
[issue16296] Patch to fix building on Win32/64 under VS 2010
Paul Moore added the comment: Is there any chance this can be included in Python 3.4? It would apparently allow numpy to be built with stock tools on Windows Python. -- nosy: +pmoore ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16296 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17162] Py_LIMITED_API needs a PyType_GenericDealloc
Roundup Robot added the comment: New changeset 655d7a55c165 by Martin v. Löwis in branch 'default': Issue #17162: Add PyType_GetSlot. http://hg.python.org/cpython/rev/655d7a55c165 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17162 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17162] Py_LIMITED_API needs a PyType_GenericDealloc
Martin v. Löwis added the comment: Thanks for the reviews; this is now committed. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17162 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17162] Py_LIMITED_API needs a PyType_GenericDealloc
Roundup Robot added the comment: New changeset eaae4008327d by Victor Stinner in branch 'default': Issue #17162: Fix compilation, replace non-breaking space with an ASCII space http://hg.python.org/cpython/rev/eaae4008327d -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17162 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20173] Derby #4: Convert 53 sites to Argument Clinic across 5 files
Vajrasky Kok added the comment: Here is the updated patch after Larry's commit to clinic. Everything is included except codecsmodule. -- Added file: http://bugs.python.org/file33895/issue20173_conglomerate.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20173 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20505] Remove resolution from selectors and granularity from asyncio
STINNER Victor added the comment: Here is a script to measure the accuracy of asyncio: min/max difference between the scheduled time and the real elapsed time. It's not directly related to the attached patch, but it can help if you want to implement a different option like Results on my Fedora 20 (Linux kernel 3.12) with Python compiled in debug mode. Results with the original code: --- [ asyncio accuracy ] call_later(0.0001 us): difference in [59.4839 us; 101.6307 us], [+59483938.5%, +101630708.8%] call_later(0.0005 us): difference in [59.1285 us; 129.9486 us], [+11825694.4%, +25989713.7%] call_later(0.0010 us): difference in [58.9950 us; 102.4589 us], [+5899502.5%, +10245891.9%] call_later(0.0015 us): difference in [59.0737 us; 100.6987 us], [+3938245.9%, +6713245.6%] call_later(0.0020 us): difference in [58.6790 us; 112.8620 us], [+2933950.3%, +5643097.8%] call_later(0.0030 us): difference in [58.9260 us; 118.2042 us], [+1964199.0%, +3940139.5%] call_later(0.0040 us): difference in [59.3839 us; 117.6248 us], [+1484597.0%, +2940620.9%] call_later(0.0050 us): difference in [58.9361 us; 115.3991 us], [+1178721.5%, +2307982.8%] call_later(0.1 us): difference in [61.1 us; 133.5 us], [+61131.0%, +133512.9%] call_later(0.5 us): difference in [59.0 us; 124.8 us], [+11793.8%, +24953.6%] call_later(1.0 us): difference in [57.7 us; 113.7 us], [+5770.7%, +11372.1%] call_later(1.5 us): difference in [57.2 us; 113.5 us], [+3816.0%, +7563.7%] call_later(2.0 us): difference in [56.4 us; 130.1 us], [+2822.0%, +6506.8%] call_later(3.0 us): difference in [55.1 us; 99.7 us], [+1836.5%, +3324.5%] call_later(4.0 us): difference in [53.8 us; 98.5 us], [+1345.3%, +2462.4%] call_later(5.0 us): difference in [54.6 us; 97.0 us], [+1091.2%, +1939.9%] call_later(10.0 us): difference in [76.8 us; 114.3 us], [+767.6%, +1142.5%] call_later(50.0 us): difference in [44.5 us; 1154.6 us], [+88.9%, +2309.3%] call_later(0.1 ms): difference in [1.1 ms; 1.2 ms], [+1061.3%, +1153.8%] call_later(100.0 us): difference in [1066.1 us; 1134.3 us], [+1066.1%, +1134.3%] call_later(150.0 us): difference in [1005.0 us; 1104.6 us], [+670.0%, +736.4%] call_later(200.0 us): difference in [940.3 us; 1024.9 us], [+470.2%, +512.4%] call_later(300.0 us): difference in [854.2 us; 942.4 us], [+284.7%, +314.1%] call_later(400.0 us): difference in [756.3 us; 841.4 us], [+189.1%, +210.3%] call_later(0.5 ms): difference in [0.6 ms; 0.8 ms], [+129.2%, +151.6%] call_later(500.0 us): difference in [648.7 us; 734.8 us], [+129.7%, +147.0%] call_later(1.0 ms): difference in [0.1 ms; 0.3 ms], [+14.7%, +26.0%] call_later(1.5 ms): difference in [0.7 ms; 0.8 ms], [+43.5%, +51.3%] call_later(2.0 ms): difference in [0.2 ms; 0.2 ms], [+7.7%, +10.6%] call_later(3.0 ms): difference in [0.2 ms; 0.2 ms], [+6.2%, +8.1%] call_later(4.0 ms): difference in [0.2 ms; 0.2 ms], [+4.1%, +6.0%] call_later(5.0 ms): difference in [0.2 ms; 0.3 ms], [+3.0%, +5.6%] call_later(10.0 ms): difference in [0.1 ms; 0.3 ms], [+1.3%, +2.6%] call_later(10.0 ms): difference in [0.2 ms; 0.3 ms], [+2.0%, +2.8%] call_later(15.0 ms): difference in [0.2 ms; 0.3 ms], [+1.2%, +1.7%] call_later(20.0 ms): difference in [0.2 ms; 1.9 ms], [+1.1%, +9.3%] call_later(30.0 ms): difference in [0.2 ms; 0.3 ms], [+0.7%, +1.0%] call_later(40.0 ms): difference in [0.2 ms; 0.3 ms], [+0.5%, +0.8%] call_later(50.0 ms): difference in [0.2 ms; 0.3 ms], [+0.4%, +0.5%] call_later(100.0 ms): difference in [0.3 ms; 0.4 ms], [+0.3%, +0.4%] call_later(100.000 ms): difference in [0.254 ms; 0.384 ms], [+0.3%, +0.4%] call_later(150.0 ms): difference in [0.3 ms; 0.4 ms], [+0.2%, +0.3%] call_later(200.0 ms): difference in [0.2 ms; 0.4 ms], [+0.1%, +0.2%] call_later(300.0 ms): difference in [0.5 ms; 0.5 ms], [+0.2%, +0.2%] call_later(400.0 ms): difference in [0.5 ms; 0.7 ms], [+0.1%, +0.2%] call_later(500.0 ms): difference in [0.7 ms; 0.8 ms], [+0.1%, +0.2%] call_later(500.000 ms): difference in [0.297 ms; 0.786 ms], [+0.1%, +0.2%] call_later(1000.000 ms): difference in [0.439 ms; 1.285 ms], [+0.0%, +0.1%] call_later(1500.000 ms): difference in [0.916 ms; 1.759 ms], [+0.1%, +0.1%] call_later(2000.000 ms): difference in [0.678 ms; 2.297 ms], [+0.0%, +0.1%] call_later(3000.000 ms): difference in [0.444 ms; 3.275 ms], [+0.0%, +0.1%] call_later(4000.000 ms): difference in [0.516 ms; 4.255 ms], [+0.0%, +0.1%] call_later(5000.000 ms): difference in [1.051 ms; 5.242 ms], [+0.0%, +0.1%] Global accuracy in [44.5 us; 5.2 ms] Loop granularity: 1.0 ms Selector resolution: 1.0 ms Event loop: _UnixSelectorEventLoop Selector: EpollSelector --- IMO a maximum difference of 5.2 ms with a granularity of 1 ms is very good. For a call scheduled in 1 ms, the difference is in range [0.1 ms; 0.3 ms] which is also very good. Results with remove_granularity.patch: --- [ asyncio accuracy ] call_later(0.0001 us): difference in [65.1941 us; 95.9378 us], [+65194110.0%, +95937766.7%] call_later(0.0005 us): difference in [64.9974 us; 109.2616 us],
[issue20505] Remove resolution from selectors and granularity from asyncio
Changes by STINNER Victor victor.stin...@gmail.com: Added file: http://bugs.python.org/file33897/add_granularity.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20505 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20491] textwrap: Non-breaking space not honored
Serhiy Storchaka added the comment: It looks to me that code can be a little more clear if use C-style formatting. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20491 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14911] generator.throw() documentation inaccurate
Kristján Valur Jónsson added the comment: Note that the docstring does not match the doc: PyDoc_STRVAR(throw_doc, throw(typ[,val[,tb]]) - raise exception in generator,\n\ return next yielded value or raise StopIteration.); Should I change the docstring too? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14911 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16296] Patch to fix building on Win32/64 under VS 2010
Tim Golden added the comment: Larry Hastings would have to rule on whether it could get into 3.4 at this stage. Paul: are you in a position to apply / test the patch? I've done no more than glance at it but it looks, from the comments, as though it doesn't apply cleanly. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16296 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6299] pyexpat build failure on Solaris 10 for 2.6.1/2.6.2
koobs added the comment: The issue applies and is reproducible for all versions 2.6 through 3.5. This is the changeset we applied to all FreeBSD Ports to fix the issue: https://svnweb.freebsd.org/ports?view=revisionrevision=326729 One specific example (Python 3.3): 1) Use CPPFLAGS over CFLAGS (See before *and* after comments): https://svnweb.freebsd.org/ports/head/lang/python33/Makefile?r1=326729r2=326728pathrev=326729 2) Revert the absolutely crazy complexity in Makefile.pre.in by stripping out CONFIGURE_*, allowing once again ./configure to substitute the right variables based on what has been passed to it: https://svnweb.freebsd.org/ports/head/lang/python33/files/patch-Makefile.pre.in?r1=326729r2=326728pathrev=326729 This results in: Makefile.pre.in: CPPFLAGS= @CPPFLAGS@ -- YAY! PY_CPPFLAGS=$(BASECPPFLAGS) -I. -IInclude -I$(srcdir)/Include $(CPPFLAGS) -- YAY Makefile: CPPFLAGS= -I/usr/local/include - YAY! PY_CPPFLAGS=$(BASECPPFLAGS) -I. -IInclude -I$(srcdir)/Include $(CPPFLAGS) -- YAY! The root cause *requiring* the use of CPPFLAGS, is PY_CFLAGS before PY_CPPFLAGS here: PY_CORE_CFLAGS= $(PY_CFLAGS) $(PY_CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE As per https://www.gnu.org/prep/standards/html_node/Command-Variables.html Put CFLAGS last in the compilation command, after other variables containing compiler options, so the user can use CFLAGS to override the others. We must use CPPFLAGS, because CFLAGS has been broken in one way or another for a long time. The target state is *both* must just work. This can only happen if the standard user-serviceable autoconf and Makefile variables are left alone, not extended or overridden, and behave in exactly the same way whether provided in the environment for *either* ./configure, make, or *both*. For the most recent chapter in the C[PP|LD]FLAGS/Makefile book, see: 92a9dc668c95 from #9189 which was sound in intent, but in execution left us deeper down the rabbit-hole. Moving forward and as a first step, what does everyone think of switching the order of $(PY_CFLAGS) $(PY_CPPFLAGS) in PY_CORE_CFLAGS= ? I hope (but I'm not holding my breath) that nothing relies on the current ordering. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6299 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16296] Patch to fix building on Win32/64 under VS 2010
Paul Moore added the comment: Unfortunately not really - it's the numpy guys that need this, so hopefully the original poster can comment. I'll see if I can hand-patch the relevant files and do a pip install numpy to see if it fixes that specific scenario. I'll report back. I've added Larry Hastings to the nosy list for his comments. -- nosy: +larry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16296 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16296] Patch to fix building on Win32/64 under VS 2010
Paul Moore added the comment: Sigh. Looks like it doesn't fix the issue of building numpy - plus it doesn't apply cleanly. My apologies for the noise, I'll report the issues with the patch back on the numpy issue where I was told about this patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16296 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16296] Patch to fix building on Win32/64 under VS 2010
Larry Hastings added the comment: I'm not sure I need to be on this issue. As a rule, Windows build concerns for 3.4 are delegated to Martin von Lowis. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16296 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20218] Add `pathlib.Path.write` and `pathlib.Path.read`
Ram Rachum added the comment: Hi everyone, I'm waiting for someone to review my patch. I believe it includes everything that's needed to merge. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20218 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16296] Patch to fix building on Win32/64 under VS 2010
Tim Golden added the comment: Thanks, Larry. Martin's already nosy this issue, but really we need to see if we have a viable patch before making decisions about 3.4. I'll take you off the nosy list. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16296 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16296] Patch to fix building on Win32/64 under VS 2010
Changes by Tim Golden m...@timgolden.me.uk: -- nosy: -larry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16296 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17925] asynchat.async_chat.initiate_send : del deque[0] is not safe
Pierrick Koch added the comment: Fix patch from Xavier's comment, sorry for the delay. Lib/test/test_asynchat.py passes (Ran 27 tests in 1.431s) -- Added file: http://bugs.python.org/file33898/cpython.asyncore_4.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17925 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20404] Delayed exception using non-text encodings with TextIOWrapper
Nick Coghlan added the comment: v3: - prefix for internal helper APIs is now _PyCodecInfo_ to better distinguish them from the ones that take an encoding name - error check is now just for is not a text encoding - tweaked the name and comment in the error test to be clear that it is codecs that are not marked as text encodings that are rejected, not just binary transforms - fixed indentation of multi-line expression in _pyio.py -- Added file: http://bugs.python.org/file33899/issue20404_check_valid_textio_codec_v3.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20404 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20502] Context.create_decimal_from_float() inconsistent precision for zeros after decimal mark
Mark Dickinson added the comment: The output is correct, though the tiny precision makes it look strange. The decimal module is following the usual rules for 'ideal' exponents: - For *exactly representable* results, the ideal exponent is 0, and the output will be chosen to have exponent as close to that as possible (while not altering the value of the result). - Where the result isn't exactly representable, full precision is used. Those two rules together explain all of the output you showed: 100.0, 10.0 and 1.0 are exactly representable, so we aim for an exponent of 0. But 100.0 can't be expressed in only 2 digits with an exponent of 0, so it ends up with an exponent of 1, hence the `1.0E+2` output. 460.0 and 46.0 are similarly exactly representable. 4.6 and 0.46 are not exactly representable, so the output is given to full precision. -- resolution: - invalid status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20502 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20404] Delayed exception using non-text encodings with TextIOWrapper
Serhiy Storchaka added the comment: LGTM. -- stage: test needed - commit review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20404 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20507] TypeError from str.join has no message
New submission from Gareth Rees: If you pass an object of the wrong type to str.join, Python raises a TypeError with no error message: Python 3.4.0b3 (default, Jan 27 2014, 02:26:41) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin Type help, copyright, credits or license for more information. ''.join(1) Traceback (most recent call last): File stdin, line 1, in module TypeError It is unnecessarily hard to understand from this error what the problem actually was. Which object had the wrong type? What type should it have been? Normally a TypeError is associated with a message explaining which type was wrong, and what it should have been. For example: b''.join(1) Traceback (most recent call last): File stdin, line 1, in module TypeError: can only join an iterable It would be nice if the TypeError from ''.join(1) included a message like this. The reason for the lack of message is that PyUnicode_Join starts out by calling PySequence_Fast(seq, ) which suppresses the error message from PyObject_GetIter. This commit by Tim Peters is responsible: http://hg.python.org/cpython/rev/8579859f198c. The commit message doesn't mention the suppression of the message so I can assume that it was an oversight. I suggest replacing the line: fseq = PySequence_Fast(seq, ); in PyUnicode_Join in unicodeobject.c with: fseq = PySequence_Fast(seq, can only join an iterable); for consistency with bytes_join in stringlib/join.h. Patch attached. -- components: Interpreter Core files: join.patch keywords: patch messages: 210200 nosy: Gareth.Rees priority: normal severity: normal status: open title: TypeError from str.join has no message type: behavior versions: Python 3.4 Added file: http://bugs.python.org/file33900/join.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20507 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6299] pyexpat build failure on Solaris 10 for 2.6.1/2.6.2
koobs added the comment: Setting versions to correctly reflect those affected. -- versions: +Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6299 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20481] Clarify type coercion rules in statistics module
Nick Coghlan added the comment: I think it's also acceptable at this point for the module docs to just say that handling of mixed type input is undefined and implementation dependent, and recommend doing map(int, input_data), map(float, input_data), map(Decimal, input_data) or map(Fraction, input_data) to ensure getting a consistent answer for mixed type input. I believe it would also be acceptable for the module to just fail immediately as soon as it detects an input type that differs from the type of the first value rather than attempting to guess the most appropriate behaviour. This close to 3.4rc1 (Sunday 9th February), I don't think we want to be committing to *any* particular implementation of type coercion. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20481 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20489] help() fails for zlib Compress and Decompress objects
Nick Coghlan added the comment: For 3.4, I'd prefer to just not convert these functions. The right fix is to figure out how to get __name__ set appropriately, and that's something the C extension module improvements in 3.5 should be able to help with. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20489 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20489] help() fails for zlib Compress and Decompress objects
Nick Coghlan added the comment: For example, see the builtins patch on issue 20184 where I initially converted sorted() to AC, but then found that making it *work* as an AC function was actually quite difficult due to the PyList implementation expecting to be given a arg tuple and kwds dict. Something like that seems appropriate here as well - break the magic formatting of the clinic input, add a reference to this bug and then tweak the signature line manually to not be a valid AC signature line. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20489 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15216] Support setting the encoding on a text stream after creation
Nick Coghlan added the comment: If operating systems always exposed accurate metadata and configuration settings, I'd agree with you. They don't though, so sometimes developers need to be able to override whatever the interpreter figured out automatically. In addition, needing to cope with badly designed APIs is an unfortunate fact of life - that's why monkeypatching is only *discouraged*, rather than disallowed :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15216 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20502] Context.create_decimal_from_float() inconsistent precision for zeros after decimal mark
Mauricio de Alencar added the comment: According to the docs (http://docs.python.org/3/library/decimal.html): The decimal module incorporates a notion of significant places so that 1.30 + 1.20 is 2.50. The trailing zero is kept to indicate significance. This is the customary presentation for monetary applications. For multiplication, the “schoolbook” approach uses all the figures in the multiplicands. For instance, 1.3 * 1.2 gives 1.56 while 1.30 * 1.20 gives 1.5600. Therefore, if I request 2 digits of precision, I expect 2 digits in the output. In addition, the docs assert that Decimal numbers can be represented exactly, which leaves me lost about you argument on whether some number is *exactly representable* or not. -- resolution: invalid - status: pending - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20502 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20507] TypeError from str.join has no message
Srinivas Reddy T added the comment: The exact behavior is present in 2.7 version too. So tagging 2.7 to 3.4 -- nosy: +thatiparthy versions: +Python 2.7, Python 3.1, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20507 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20485] Enable 'import Non-ASCII.pyd'
Nick Coghlan added the comment: import-...@python.org would be the appropriate list for this one. However, we can't do anything about it until Python 3.5 next year at the earliest, and I'm already planning to write a follow-up to http://www.python.org/dev/peps/pep-0451/ that adapts the extension module import mechanism to support those APIs (addressing a number of longstanding feature requests from the Cython developers). That said, this is an independent proposal, so if you were willing to write it up as a separate PEP, that would be probably be a good idea. Our two choices to consider would be: 1. Using a custom 7-bit ASCII compatible encoding to support this on arbitrary C compilers (at the cost of making the identifiers unintuitive). (i.e. the approach in your patch) 2. Using the Universal Character Name support originally specified in C99, but retained in C11 (these are the \U and \u escapes familiar from Python text literals). Note that *CPython* still won't need to be compiled with a compiler that supports UCN for this to work - we'll just need the dynamic linking API to support us looking for a symbol containing such a name. Option 2 is what I think we *should* do, but there will be some research involved in figuring out how good the current support for UCN C identifiers is in at least gcc, clang and Visual Studio 2013, as well as what the dynamic linker APIs support in terms of passing identifiers containing Unicode escapes to be looked up in the exported symbols. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20485 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20489] help() fails for zlib Compress and Decompress objects
Serhiy Storchaka added the comment: Expressly writing the name of the module in the expression solves this issue. -- stage: - patch review Added file: http://bugs.python.org/file33901/zlib_parameters_defaults.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20489 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20507] TypeError from str.join has no message
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +pitrou stage: - patch review versions: -Python 3.1, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20507 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20502] Context.create_decimal_from_float() inconsistent precision for zeros after decimal mark
Mark Dickinson added the comment: Therefore, if I request 2 digits of precision, I expect 2 digits in the output. The `prec` attribute in the context refers to the total number of *significant digits* that are storable, and not to the number of digits after the decimal point. `Decimal` is at heart a floating-point type, not a fixed-point one (though the handling of significant zeros that you note means that it's useful in fixed-point contexts too). For typical uses you'll want `prec` to be much bigger than 2. So the number of trailing zeros is typically determined not by `prec` but by the exponents of the operands to any given operation. In the example you cite, the output is `2.50` because the inputs both had two digits after the point. the docs assert that Decimal numbers can be represented exactly Sure, but for example the 0.1 in your code is not a Decimal: it's a Python float, represented under the hood in binary. Its exact value is 0.155511151231257827021181583404541015625, and that can't be stored exactly in a Decimal object with only two digits of precision. So the behaviour you identify isn't a bug: the module is following a deliberate design choice here. -- resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20502 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6299] pyexpat build failure on Solaris 10 for 2.6.1/2.6.2
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6299 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5680] Command-line arguments when running in IDLE
Changes by Tal Einat talei...@gmail.com: -- nosy: -taleinat ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5680 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1528593] Printing: No print dialog or page setup
Changes by Tal Einat talei...@gmail.com: -- nosy: -taleinat ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1528593 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20485] Enable 'import Non-ASCII.pyd'
STINNER Victor added the comment: we *should* do, but there will be some research involved in figuring out how good the current support for UCN C identifiers is in at least gcc, clang and Visual Studio 2013 Python 3.4 uses Visual Studio 2010. I'm not sure that you can build an extension with VS 2013 if Python was build with VS 2010. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20485 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1253] IDLE - Percolator overhaul
Changes by Tal Einat talei...@gmail.com: -- nosy: -taleinat ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1253 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4832] IDLE does not supply a default ext of .py on Windows or OS X for new file saves
Changes by Tal Einat talei...@gmail.com: -- nosy: -taleinat ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4832 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2704] IDLE: Patch to make PyShell behave more like a Terminal interface
Changes by Tal Einat talei...@gmail.com: -- nosy: -taleinat ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2704 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com