Re: Multi-dimensional list initialization

2012-11-07 Thread Andrew Robinson
On 11/07/2012 05:39 AM, Joshua Landau wrote: On 7 November 2012 11:11, Oscar Benjamin wrote: On Nov 7, 2012 5:41 AM, "Gregory Ewing" wrote: > > If anything is to be done in this area, it would be better > as an extension of list comprehensions, e.g. > > [[None times

Re: Multi-dimensional list initialization

2012-11-07 Thread Andrew Robinson
On 11/07/2012 01:01 PM, Ian Kelly wrote: On Wed, Nov 7, 2012 at 12:51 PM, Andrew Robinson wrote: Interesting, you avoided the main point "lists are copied with list multiplication". It seems that each post is longer than the last. If we each responded to every point made, this th

Re: Multi-dimensional list initialization

2012-11-07 Thread Andrew Robinson
On 11/07/2012 03:39 PM, Ian Kelly wrote: Why? Just to get rid of an FAQ? :-) Here's one of the more interesting uses from my own code: OK, and is this a main use case? (I'm not saying it isn't I'm asking.) Replacing the list multiplication in that function with a list comprehension would b

Re: Multi-dimensional list initialization

2012-11-07 Thread Andrew Robinson
On 11/07/2012 04:00 PM, Steven D'Aprano wrote: Andrew, it appears that your posts are being eaten or rejected by my ISP's news server, because they aren't showing up for me. Possibly a side- effect of your dates being in the distant past? Date has been corrected since two day

Re: Multi-dimensional list initialization

2012-11-08 Thread Andrew Robinson
On 11/07/2012 11:09 PM, Ian Kelly wrote: On Wed, Nov 7, 2012 at 8:13 PM, Andrew Robinson wrote: OK, and is this a main use case? (I'm not saying it isn't I'm asking.) I have no idea what is a "main" use case. Well, then we can't evaluate if it's worth k

Re: Right solution to unicode error?

2012-11-08 Thread Andrew Berg
On 2012.11.08 08:06, Oscar Benjamin wrote: > It would be a lot better though if it just worked straight away > without me needing to set the code page (like the terminal in every > other OS I use). The crude equivalent of .bashrc/.zshrc/whatever shell startup script for cmd is setting a string valu

Re: Printing characters outside of the ASCII range

2012-11-09 Thread Andrew Berg
On 2012.11.09 11:17, danielk wrote: > I'm converting an application to Python 3. The app works fine on Python 2. > > Simply put, this simple one-liner: > > print(chr(254)) > > errors out with: > > Traceback (most recent call last): > File "D:\home\python\tst.py", line 1, in > print(chr(2

Re: Printing characters outside of the ASCII range

2012-11-09 Thread Andrew Berg
On 2012.11.09 15:17, danielk wrote: > I guess the question I have is: How do you tell Python to use a specific > encoding for 'print' statements when I know there will be characters outside > of the ASCII range of 0-127? You don't. It's raising that exception because the terminal cannot display t

Re: 10 sec poll - please reply!

2012-11-21 Thread Andrew Cooper
and useful APIs and veritable piles of excrement. > > > "There are only two hard problems in Computer Science: cache invalidation > and naming things." -- Phil Karlton > "counting" is missing from that list of two hard problems. ~Andrew -- http://mail.python.org/mailman/listinfo/python-list

noob: print and file.read()

2012-12-03 Thread Andrew Z
Hello, why the following code doesn't print the content of the file: #!/usr/bin/python from_file ="file.txt" in_file = open(from_file) str = in_file.read() print "Here should be the output from the file - ", in_file.read() print "Here should be the output from the STR- ", str in_file.close() Th

Re: noob: print and file.read()

2012-12-03 Thread Andrew Z
Mrab, you nailed it. thank you very much! AZ -- http://mail.python.org/mailman/listinfo/python-list

Re: Preventing tread collisions

2012-12-13 Thread Andrew Robinson
On 12/12/2012 12:29 PM, Dave Angel wrote: On 12/12/2012 03:11 PM, Wanderer wrote: I have a program that has a main GUI and a camera. In the main GUI, you can manipulate the images taken by the camera. You can also use the menu to check the camera's settings. Images are taken by the camera in a s

Re: Running a python script under Linux

2012-12-13 Thread Andrew Robinson
On 12/13/2012 06:45 PM, Steven D'Aprano wrote: I understand this is not exactly a Python question, but it may be of interest to other Python programmers, so I'm asking it here instead of a more generic Linux group. I have a Centos system which uses Python 2.4 as the system Python, so I set an al

Re: Running a python script under Linux

2012-12-13 Thread Andrew Robinson
On 12/13/2012 06:45 PM, Steven D'Aprano wrote: What am I doing wrong? By the way, I didn't include command line parameters as part of the function definition, so you might want to add them to insure it acts like a generic alias. Also, (alternately), you could define a generic python shell

Re: where to view open() function's C implementation source code ?

2012-12-18 Thread Andrew Robinson
0 -- the built in open() appears in Python-3.3.0/Modules/_io/_iomodule.c; There is another module defined in an object in Python-3.3.0/Modules/_io/fileio.c; but I don't think that the one called when a lone x=open(...) is done. Cheers. --Andrew. -- http://mail.python.org/mailman/listinfo/python-list

Re: EOFError why print(e) cannot print out any information ?

2012-12-25 Thread Andrew Berg
On 2012.12.25 23:26, iMath wrote: > why print(e) cannot print out any information ? If you want to manipulate tracebacks, use sys.exc_info() and the traceback module from the standard library. The logging module also comes with an exception() function and an exception() method for Logger objects th

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-28 Thread Andrew Berg
On 2012.12.28 00:51, Jamie Paul Griffin wrote: > The benefit of the tmux client (terminal multiplexer) is that I can see > all the screens at the same time and quickly switch between them. I > believe Linux has screen(1) which does the same thing. tmux is generally easily available for Linux, and

Re: Source code of Windows installer for Python interactive interpreter

2012-12-28 Thread Andrew Berg
On 2012.12.28 09:30, [email protected] wrote: > Is the Python directory (i.e. "C:\Python33") assigned to the PATH variable > using the Batch PATH built-in command? If so, where? As of Python 3.3, there is a py.exe in the system32 directory that launches the appropriate version of Python fo

Confused about logger config from within Python (3)

2012-12-28 Thread andrew cooke
r to delegate to root, which has the DEBUG level set. from logging import DEBUG, root, getLogger from unittest import TestCase class LoggingTest(TestCase): def test_direct(self): root.setLevel(DEBUG) getLogger(__name__).debug("hello world")

Re: Confused about logger config from within Python (3)

2012-12-28 Thread andrew cooke
similarly, if i run the following, i see only "done": from logging import DEBUG, root, getLogger if __name__ == '__main__': root.setLevel(DEBUG) getLogger(__name__).debug("hello world") print('done') -- http://mail.python.org/mailman/listinfo/python-list

Re: Confused about logger config from within Python (3)

2012-12-28 Thread andrew cooke
cending asshole? anyway, thanks for the help. andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: father class name

2012-12-30 Thread Andrew Berg
On 2012.12.30 22:18, contro opinion wrote: > here is my haha class > class haha(object): > def theprint(self): > print "i am here" > haha().theprint() > i am here haha(object).theprint() > Traceback (most recent call last): > File "", line 1, in > TypeError: object.__new__()

Re: pygame - importing GL - very bad...

2013-01-02 Thread Andrew Berg
On 2013.01.02 15:57, Michael Torrie wrote: > Why is this solution not to your liking? Python has namespaces for a > reason. They both keep code separated and modular. Use them. At most > you should import the most commonly-used symbols only, and refer to the > rest through their respective name

Important questions about __future__

2013-01-03 Thread Andrew Berg
Does 'from __future__ import barry_as_FLUFL' do anything? Despite PEP 401, using print as a statement still raises a SyntaxError. Where is 'from __future__ import braces' implemented in CPython (it's not in __future__.py)? -- CPython 3.3.0 | Windows NT 6.2.9200.16461 -- http://mail.python.org/mai

Re: python wiki gone?

2013-01-05 Thread Andrew Berg
On 2013.01.05 13:07, Lee Harr wrote: > When I go to wiki.python.org I get redirected to > http://wiki.python.org/moin/ > which is 404 Not Found. There's a security issue with moinmoin. The Python wiki is not the only wiki offline for this reason. -- CPython 3.3.0 | Windows NT 6.2.9200.16461 / Free

Vote tallying...

2013-01-18 Thread Andrew Robinson
Hi, I have a problem which may fit in a mysql database, but which I only have python as an alternate tool to solve... so I'd like to hear some opinions... I'm building a experimental content management program on a standard Linux Web server. And I'm needing to keep track of archived votes an

Re: Vote tallying...

2013-01-18 Thread Andrew Robinson
On 01/18/2013 08:47 AM, Stefan Behnel wrote: Andrew Robinson, 18.01.2013 00:59: I have a problem which may fit in a mysql database Everything fits in a MySQL database - not a reason to use it, though. Py2.5 and later ship with sqlite3 and if you go for an external database, why use MySQL if

XML/XHTML/HTML differences, bugs... and howto

2013-01-23 Thread Andrew Robinson
Good day :), I've been exploring XML parsers in python; particularly: xml.etree.cElementTree; and I'm trying to figure out how to do it incrementally, for very large XML files -- although I don't think the problems are restricted to incremental parsing. First problem: I've come across an iss

Re: XML/XHTML/HTML differences, bugs... and howto

2013-01-23 Thread Andrew Robinson
On 01/24/2013 06:42 AM, Stefan Behnel wrote: Andrew Robinson, 23.01.2013 16:22: Good day :), Nope, you should read the manual on this. Here's a tutorial: http://lxml.de/tutorial.html#elements-contain-text I see, so it should be under the "tail" attribute, not the "text&

XML validation / exception.

2013-01-24 Thread Andrew Robinson
row a software/content specific error on valid XML files; I don't see which attribute of an element, or method, allows me to find out the line number and column number that an element I am examining is found at. ? How do I get it ? Cheers, --Andrew. -- http://mail.python.org/mailman/listi

Re: The best, friendly and easy use Python Editor.

2013-01-24 Thread Andrew Gudovich
I think PyCharm is ideal for you. http://www.jetbrains.com/pycharm/ -- http://mail.python.org/mailman/listinfo/python-list

Re: environment fingerprint

2013-01-29 Thread Andrew Berg
On 2013.01.29 07:18, Jabba Laci wrote: > Hi, > > I have a script that I want to run in different environments: on > Linux, on Windows, on my home machine, at my workplace, in virtualbox, > etc. In each environment I want to use different configurations. For > instance the temp. directory on Linux

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-23 Thread Andrew Berg
You're right, but it's pretty hard for some people to do what they're supposed to when it isn't what they're used to. -- CPython 3.2.2 | Windows NT 6.1.7601.17640 -- http://mail.python.org/mailman/listinfo/python-list

Re: PyPI - how do you pronounce it?

2012-01-28 Thread Andrew Berg
On 1/28/2012 1:48 AM, Chris Angelico wrote: > How do you pronounce PyPI? > * Pie-Pea-Eye? This, primarily because it represents 3 words, and secondarily to eliminate confusion with PyPy. -- CPython 3.2.2 | Windows NT 6.1.7601.17640 -- http://mail.python.org/mailman/listinfo/python-list

Script randomly exits for seemingly no reason with strange traceback

2012-02-03 Thread Andrew Berg
It's a rare occurrence, but sometimes my script will terminate and I get this: Traceback (most recent call last): File "C:\path\to\script\script.py", line 992, in That's it. And the line number is always the last line of the file (which in my case is a blank line). I have not seen this on Linu

Re: Script randomly exits for seemingly no reason with strange traceback

2012-02-04 Thread Andrew Berg
On 2/3/2012 5:25 PM, Steven D'Aprano wrote: > Which version of Python, which version of Windows? I keep that information in my signature for every post I make to this list. CPython 3.2.2 | Windows NT 6.1.7601.17640 > If you upgrade Python, does the problem go away? I use the most recent stable ver

Re: Script randomly exits for seemingly no reason with strange traceback

2012-02-04 Thread Andrew Berg
On 2/4/2012 11:06 AM, Steven D'Aprano wrote: > I suggest you raise an issue on the bug tracker. If you can't reproduce > the bug, it's unlikely to be fixed, but you might get lucky. Since I can't narrow it down to any specific circumstance or code, I'll gather information from a build of the inter

Re: Help about dictionary append

2012-02-05 Thread Andrew Berg
On 2/5/2012 9:13 AM, Anatoli Hristov wrote: > and I get and error that TUPLE object has no attribute Append !!! You defined mydict['name'] as a tuple, and tuples are immutable. Using a tuple means that you don't ever want the values to change. > But how to add new Values to a dictionary then ? Thi

Re: unicode printing on Windows

2012-02-09 Thread Andrew Berg
On 2/9/2012 4:46 AM, BlueBird wrote: > Does anybody know how to fix problem 1 ? That way, I could at least > deal with programs that print UTF8 on stdout. I'm pretty sure there isn't a way. cp65001 is supposed to be UTF-8, but it doesn't work in my experience (I fed it some UTF-8 demo text and I go

Building a debug version of Python 3.2.2 under Windows

2012-02-11 Thread Andrew Berg
I tried to build Python 3.2.2 with VS 2008, but it seems I'm missing some header files (e.g. sqlite3, openssl). Is there a nice little package with all the dependencies, or do I need to grab source code packages for each program from their respective websites, or something else entirely? -- CPyth

Re: Building a debug version of Python 3.2.2 under Windows

2012-02-11 Thread Andrew Berg
On 2/11/2012 3:01 PM, Terry Reedy wrote: > The readme file in PCBuild supposedly has all the info needed, though I > know one thing out of date. Trying to follow the instructions is on my > todo list ;-). > I didn't notice the readme in there. I was following instructions from here: http://docs.

Re: Python usage numbers

2012-02-11 Thread Andrew Berg
On 2/11/2012 3:02 PM, Eric Snow wrote: > I'm thinking about this partly because of the discussion on > python-ideas about the perceived challenges of Unicode in Python 3. > For instance, if frameworks (like django and numpy) could completely > hide the arguable challenges of Unicode in Python 3--a

Re: Python usage numbers

2012-02-11 Thread Andrew Berg
On 2/12/2012 12:10 AM, Steven D'Aprano wrote: > It's not just UTF8 either, but nearly all encodings. You can't even > expect to avoid problems if you stick to nothing but Windows, because > Windows' default encoding is localised: a file generated in (say) Israel > or Japan or Germany will use a

Re: Python usage numbers

2012-02-12 Thread Andrew Berg
On 2/12/2012 3:12 AM, Steven D'Aprano wrote: > NTFS by default uses the UTF-16 encoding, which means the actual bytes > written to disk are \x1d\x040\x04\xe5\x042\x04 (possibly with a leading > byte-order mark \xff\xfe). That's what I meant. Those bytes will be interpreted consistently across all

Re: Python usage numbers

2012-02-13 Thread Andrew Berg
On 2/12/2012 10:19 PM, Ben Finney wrote: > If it helps, ASCII art *is* UTF-8 art. So it will be the same in UTF-8. As will non-ASCII text art:   /l、 ゙(゚、 。 7  l、゙ ~ヽ   じしf_, )ノ -- CPython 3.2.2 | Windows NT 6.1.7601.17640 -- http://mail.python.org/mailman/listinfo/python-list

Re: Change os.makedirs to handle existing directory

2012-02-13 Thread Andrew Berg
On 2/13/2012 4:59 PM, Wanderer wrote: > I think wanting to create a directory if one doesn't exist or do > nothing if it does exist and just use the existing directory is a > fairly normal programming need. Apparently this is somewhat > complicated in Python. There are new exceptions in 3.3, one o

Re: Interactive keyword help

2012-02-15 Thread Andrew Berg
On 2/15/2012 10:04 AM, Mark Lawrence wrote: > I didn't realise that this was available until today. It doesn't appear > to be prominent in the official docs or have I missed something? > Certainly I'd have thought a couple of sentences here > http://www.python.org/about/help/ would be justified

Re: Script randomly exits for seemingly no reason with strange traceback

2012-02-15 Thread Andrew Berg
On 2/15/2012 3:28 PM, John Nagle wrote: > Are you doing a conditional import, one that takes place after load > time? If you do an import within a function or class, it is executed > when the code around it executes. If you import a file with a > syntax error during execution, you could get the e

Re: Is this the right list?

2012-02-16 Thread Andrew Berg
On 2/16/2012 9:33 AM, Chris Angelico wrote: > On Fri, Feb 17, 2012 at 1:43 AM, Rick Johnson > wrote: >> On Feb 15, 4:04 pm, Terry Reedy wrote: >>> On 2/15/2012 4:51 PM, Alan McKay wrote: >>> >>> > Is this the right list? >> >> This is neither the "right" or "left" list, however, it may be either

Re: [OT]: Smartphones and Python?

2012-02-17 Thread Andrew Berg
On 2/17/2012 10:51 PM, 8 Dihedral wrote: > 在 2012年2月18日星期六UTC+8上午9时51分13秒,Michael Torrie写道: >> On 02/16/2012 10:25 PM, 8 Dihedral wrote: >> > Android is a customized linux OS used in mobile phones. I don't think >> > any linux systm has to be locked by JAVA or any JVM to run >> > applicatio

Re: Please verify!!

2012-02-23 Thread Andrew Berg
On 2/23/2012 4:43 PM, Dave Angel wrote: > First thing I'd do is to disable tab logic in the editor. When you > press the tab key, there's no excuse for an editor to actually put a tab > in the file. It should adjust the column by adding the appropriate > number of spaces. Unless, of course, yo

Re: Please verify!!

2012-02-23 Thread Andrew Berg
On 2/24/2012 1:11 AM, Manish Sharma wrote: > Still my question is what if I open the file and dont make any changes > to it and close it again? Can it be possible just by doing these steps > add indentation to lines? I am not changing the file prefrences to open > it always with notepad++. Opening

Re: Please verify!!

2012-02-24 Thread Andrew Berg
On 2/24/2012 2:32 AM, Ben Finney wrote: > Are you referring to novice programmers – who, by any reasonable > definition of “novice”, don't have an opinion on the tabs-versus-spaces > indentation debate? > > Or are you talking about people who are experienced enough to have an > opinion and expect

Re: Please verify!!

2012-02-24 Thread Andrew Berg
On 2/24/2012 5:21 AM, Duncan Booth wrote: > The original question was about Notepad++ which is nothing at all like > Notepad. And I did give the OP an answer about Notepad++ specifically in another message. -- CPython 3.2.2 | Windows NT 6.1.7601.17640 -- http://mail.python.org/mailman/listinfo/

Re: Please verify!!

2012-02-24 Thread Andrew Berg
On 2/24/2012 6:20 AM, Steven D'Aprano wrote: > Opinions need to be informed to be better than useless. By definition > newbies don't have the experience to have informed opinions. I thought I had implied that I meant informed opinions, but apparently not. > There are many times that we can't affo

Re: Pickle performing class instantiation ??

2012-02-28 Thread Andrew Berg
On 2/28/2012 9:54 AM, Smiley 4321 wrote: > NameError: name 'self' is not defined self is meaningless outside a class definition. You should refactor your dump, load and print code as methods inside the class definition, create an instance and call the methods on that instance. -- CPython 3.2.2 |

Re: Invalid syntax error

2012-03-10 Thread Andrew Berg
On 3/10/2012 6:34 AM, sl33k wrote: > I'm trying project euler problem 3 and I've hit the wall with this > error. What could be the problem here? > > l=[] num=600851475143 i=1 while i<=num: > ... if num%i==0: > ... l.append(i) > ... i+=1 > ... print max(l) > File "

Re: [RELEASED] Python 3.3.0 alpha 2

2012-04-01 Thread Andrew Berg
> To download Python 3.3.0 visit: > > http://www.python.org/download/releases/3.3.0/ The Windows links point to 3.3a1 installers, even though the links say 3.3a2. -- CPython 3.2.2 | Windows NT 6.1.7601.17640 -- http://mail.python.org/mailman/listinfo/python-list

Re: What is the best way to freeze a Python 3 app (Windows)?

2012-04-03 Thread Andrew Berg
cx_Freeze is the only program that can freeze py3k code that I know of. I didn't have any major issues with it, but I've only played with it. In any case, if you're going to roll your own, I'd be happy to help test it. -- CPython 3.2.2 | Windows NT 6.1.7601.17640 -- http://mail.python.org/mailma

ordering with duck typing in 3.1

2012-04-07 Thread andrew cooke
sh(self.value) class DynamicTest(TestCase): def test_lt(self): three = IntVar(3) assert three < 4 assert 2 < three assert 3 == three so what am i missing? thanks, andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Distribute app without source?

2012-04-07 Thread Andrew Berg
On 4/7/2012 8:07 AM, Bill Felton wrote: > We are using Python 3.2 and tkinter. It appears, and limited testing bears > out, that py2app, and presumably py2exe, are not options given lack of 3.x > support. cx_Freeze supports Python 3.2. It works fine for my purposes, but I have not done any serio

Re: Python Script Works Locally But Not Remotely with SSH

2012-04-07 Thread Andrew Berg
On 4/7/2012 11:59 AM, goldtech wrote: I thought if I SSH > even from a Linux to a Windows machine whatever I say on the SSH > client command line would be the same as me doing a command on the > "DOS" command-line in Windows. I incorrectly thought SSH is just a > tunnel for text... It gives you wh

Re: f python?

2012-04-09 Thread Andrew Berg
On 4/9/2012 1:52 AM, Chris Angelico wrote: > I think this will be a real winner, and you > should team up with Ranting Rick to produce a new operating system and > Python with this new specification and RULE THE WORLD! But only after going back to the cage to plan for tomorrow night. -- CPython 3

Re: Python randomly exits with Linux OS error -9 or -15

2012-04-09 Thread Andrew Berg
On 4/9/2012 5:01 AM, Janis wrote: > I have this problem with my script exiting randomly with Linux OS > status code -9 (most often) or -15 (also sometimes, but much more > rarely). As far as I understand -9 corresponds to Bad file descriptor > and -15 Block device required. > > 1) Is there a way h

Re: Newbie python questions...

2012-04-14 Thread Andrew Berg
On 4/14/2012 1:25 PM, vmars316 wrote: > I installed portablePython(pP) here: > C:\Users\vmars\Python3 > ?Does that look ok? I would suggest including the minor version number (i.e. Python32 instead of Python3) because not all 3.x code is compatible with all versions of Python 3.x - all code that w

Re: Python Gotcha's?

2012-04-15 Thread Andrew Berg
On 4/15/2012 3:01 PM, Bryan wrote: > I'd like to encourage my users to check out > Python 3, but installing it on Windows will take over the '.py' > extension and break stuff that currently works. Have you tried telling your users to tell the installer not to do that? IIRC, it's a simple checkbox o

Re: How to execute/run a *.py file, win7, py3.2..?

2012-04-15 Thread Andrew Berg
On 4/15/2012 11:30 PM, vmars316 wrote: > Isn't there a way just to doubleClick on myProg.py, to get it into the > interpret/RUN? Use the standard installer from python.org if you want to do things with the registry. The standard installer sets up the registry for you so that the interpreter will be

Re: Upgrading from 2.7 to 3.x

2012-04-26 Thread Andrew Berg
On 4/26/2012 6:37 AM, Kiuhnm wrote: > Python has been "forked" into 2.x and 3.x because some breaking changes > ought to be made to the language in order to improve it and clean it up. That's not really a good way to put it. 2.6 and 2.7 will get security fixes, but there won't be a 2.8 unless some

Re: Upgrading from 2.7 to 3.x

2012-04-26 Thread Andrew Berg
On 4/26/2012 8:02 AM, deuteros wrote: > So how do I tell my IDE (Eclipse with PyDev) which version of Python I > want to use? When you start a new PyDev project, it will ask. -- CPython 3.2.3/3.3.0a2 | Windows NT 6.1.7601.17790 -- http://mail.python.org/mailman/listinfo/python-list

Re: Learn Technical Writing from Unix Man in 10 Days

2012-04-28 Thread Andrew Berg
On 4/28/2012 6:45 PM, Temia Eszteri wrote: > Professional? He's boring! I agree. Ranting Rick is much more entertaining (usually). -- CPython 3.2.3/3.3.0a2 | Windows NT 6.1.7601.17790 -- http://mail.python.org/mailman/listinfo/python-list

Re: try/except in a loop

2012-05-02 Thread Andrew Berg
Why wouldn't a for loop work? If something works, you can break out, otherwise continue. working_obj = None for obj in iterable: try: obj.do_something() working_obj = obj break except: continue -- CPython 3.3.0a3 | W

Re: try/except in a loop

2012-05-02 Thread Andrew Berg
Forgot to add that all this is covered in the tutorial in the official docs: http://docs.python.org/tutorial/controlflow.html#for-statements -- CPython 3.3.0a3 | Windows NT 6.1.7601.17790 -- http://mail.python.org/mailman/listinfo/python-list

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-03 Thread Andrew Berg
On 5/3/2012 7:36 PM, Peng Yu wrote: > When convert two sets with the same elements to two lists, are the > lists always going to be the same (i.e., the elements in each list are > ordered the same)? Is it documented anywhere? Sets are by definition unordered, so depending on their order would not b

Re: Pydev configuration

2012-05-10 Thread Andrew Berg
On 5/9/2012 4:25 PM, Alan Ristow wrote: > Select the code block you want to indent and hit Tab. To do the reverse, > hit Shift-Tab. You can also select a code block and choose "Shift Right" or "Shift Left" from the context menu. -- CPython 3.3.0a3 | Windows NT 6.1.7601.17790 -- http://mail.pyth

Re: Python and Tkinter by John E Grayson

2012-05-17 Thread Andrew Berg
On 5/17/2012 6:48 AM, Mark R Rivet wrote: > I am in the process of learning python, and want to learn tkinter for > GUI stuff. Is tkinter what people are using for GUI? tkinter is one of several GUI toolkits that can be used with Python. IIRC, most people use PyGTK or PyQt for serious projects. ht

Re: Install python 2.6 and python 2.7 on Windows

2012-05-22 Thread Andrew Berg
On 5/22/2012 6:44 PM, Gelonida N wrote: > I'd like to install python 2.6 and 2.7 on Windows? > > > In fact I have already 2.6 installed and would like to additionally > install 2.7 > > > > When clicking on .py file I'd like to execute it with python 2.6 There is an checkbox for an option to

Re: Install python 2.6 and python 2.7 on Windows

2012-05-23 Thread Andrew Berg
On 5/23/2012 3:25 PM, Gelonida N wrote: > So I just install 2.7 and uncheck this box and I'll keep 2.6 right? Different versions are installed in different locations by default, and if you uncheck that box, the installer will leave file associations alone. -- CPython 3.3.0a3 | Windows NT 6.1.7601

Re: Scoping Issues

2012-05-24 Thread Andrew Berg
On 5/24/2012 8:59 PM, Dave Angel wrote: > so I fixed that, and got > inconsistent use of tabs and spaces in indentation > > because you mistakenly used tabs for indentation. Not to start another tabs-vs.-spaces discussion, but tabs are perfectly legal indentation in Python. That exception is

Re: python3 raw strings and \u escapes

2012-05-30 Thread Andrew Berg
On 5/30/2012 1:52 AM, [email protected] wrote: > Was there a reason for dropping the lexical processing of > \u escapes in strings in python3 (other than to add another > annoyance in a long list of python3 annoyances?) To me, this would be a Python 2 annoyance since I would expect r'\u3000' to be li

Re: ./configure

2012-06-03 Thread Andrew Berg
On 6/3/2012 5:01 PM, Janet Heath wrote: > Thanks Alain. I should have a compiler on my Mac OS X Lion. I am thinking > that it isn't set in my $PATH variable. I don't know where the $PATH is set > at. I will check to see if their is a binary. There are always Windows and OS X binary installers

Re: English version for Mémento Python 3 (draft, readers needed)

2012-06-06 Thread Andrew Berg
On 6/6/2012 1:45 PM, MRAB wrote: > On 06/06/2012 18:23, Jugurtha Hadjar wrote: > [snip] >> "range returns a « generator », convert it to list to see.." --> >> "converts" instead of "convert". >> > No, "convert" is correct here; it's the imperative, i.e. "convert it to > a list if you want to see.

Re: PyDoc - Python Documentation Plugin for Eclipse

2012-06-10 Thread Andrew Berg
On 6/10/2012 4:22 AM, Alexey Gaidamaka wrote: > Practically the plugin is a simple html archive from python > documentation website running > inside Eclipse so you can call it using Eclipse help system. > As for now it is pretty large (~7 mb), but i'm planning to optimize it > in near future. Rath

Re: Internationalized domain names not working with URLopen

2012-06-12 Thread Andrew Berg
On 6/13/2012 1:17 AM, John Nagle wrote: > What does "urllib2" want? Percent escapes? Punycode? Looks like Punycode is the correct answer: https://en.wikipedia.org/wiki/Internationalized_domain_name#ToASCII_and_ToUnicode I haven't tried it, though. -- CPython 3.3.0a3 | Windows NT 6.1.7601.17790

Re: is the same betweent python3 and python3.2?

2012-06-16 Thread Andrew Berg
On 6/15/2012 11:31 PM, contro opinion wrote: > is the /usr/lib/python-3.2.3/bin/python3 same as > /usr/lib/python-3.2.3/bin/python3.2? It should be. IIRC, ls -l will tell you if something is a link. You could also run python3 and it will tell you the version. -- CPython 3.3.0a4 | Windows NT 6.1.

Re: Is that safe to use ramdom.random() for key to encrypt?

2012-06-17 Thread Andrew Berg
On 6/17/2012 7:07 PM, Jon Clements wrote: > I'm reminded of: > > http://xkcd.com/936/ > http://xkcd.com/792/ > > There's also one where it's pointed out it's easier to brute force a > person who has the code, than brute force the computer. [but can't find > that one at the moment] http://xkcd.

Re: Py3.3 unicode literal and input()

2012-06-18 Thread Andrew Berg
Perhaps this will clear things up: Python 3.3.0a4 (v3.3.0a4:7c51388a3aa7, May 31 2012, 20:17:41) [MSC v.1600 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> ua = u'a' >>> literal_ua = "u'a'" >>> ua == literal_ua False >>> input_ua = input() u'a'

Re: Py3.3 unicode literal and input()

2012-06-18 Thread Andrew Berg
On 6/18/2012 11:32 AM, Jussi Piitulainen wrote: > jmfauth writes: > >> Thinks are very clear to me. I wrote enough interactive >> interpreters with all available toolkits for Windows > r = input() > u'a > Traceback (most recent call last): > File "", line 1, in > SyntaxError: u'a > > Er,

Re: Py3.3 unicode literal and input()

2012-06-18 Thread Andrew Berg
On 6/18/2012 12:03 PM, Dave Angel wrote: > And you're missing the context. jmfauth thinks we should re-introduce > the input/raw-input distinction so he could parse literal strings. So > Jussi demonstrated that the 2.x input did NOT satisfy fmfauth's dreams. You're right. I missed that part of jm

Checking compatibility of a script across Python versions automatically

2012-06-18 Thread Andrew Berg
Are there any tools out there that will parse a script and tell me if it is compatible with an arbitrary version of Python and highlight any incompatibilities? I need to check a few of my scripts that target 3.2 to see if I can make them compatible with 3.0 and 3.1 if they aren't already. I found p

Re: Newby Python help needed with functions

2011-06-03 Thread Andrew Berg
On 2011.06.03 09:42 AM, Cathy James wrote: > I need a jolt here with my python excercise, please somebody!! How can > I make my functions work correctly? I tried below but I get the > following error: > > if f_dict[capitalize]: > > KeyError: > ... > > def capitalize (s): > """capitalize accep

Eigensolver for Large Sparse Matrices in Python

2011-06-08 Thread Andrew MacLean
lts of lobpcg, or has experience with an alternate solver (such as JDSYM from Pysparse or eigsh in newer versions of Scipy) with matrices of this size, any recommendations would be grealty appreciated. Thanks, Andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.6 OR 3.2

2011-06-09 Thread Andrew Berg
On 2011.06.09 12:18 PM, hisan wrote: > Hi All, > > Please let me know which one is GOOD whether Python 2.6 OR 3.2. > Please let me know the difference between them. > Please give some refernce site or books to know the difference I'm just a beginner, but AFAICT, there are three reasons to learn Pyt

Re: PyQt

2011-06-10 Thread Andrew Berg
On 2011.06.10 08:09 AM, KK wrote: > I have python 3.2 installed m not able to install PyQt. > i have downloaded and configured sip but how to build it??? The pages are misleading. You only need the SIP source if you want to build everything from source. Since you don't seem to be familiar with

Re: Square bracket and dot notations?

2011-06-11 Thread Andrew Berg
On 2011.06.11 04:41 AM, Asen Bozhilov wrote: > Hi all, > I am beginner in Python. What is interesting for me is that Python > interpreter treats in different way dot and square bracket notations. > I am coming from JavaScript where both notations lead prototype chain > lookup. > > In Python it seem

__dict__ is neato torpedo!

2011-06-11 Thread Andrew Berg
I'm pretty happy that I can copy variables and their value from one object's namespace to another object's namespace with the same variable names automatically: class simpleObject(): pass a = simpleObject() b = simpleObject() a.val1 = 1 a.val2 = 2 b.__dict__.update(a.__dict__) a.val1 = 'a'

Re: __dict__ is neato torpedo!

2011-06-11 Thread Andrew Berg
On 2011.06.11 09:12 PM, Terry Reedy wrote: > On 6/11/2011 9:32 PM, Andrew Berg wrote: > > I'm pretty happy that I can copy variables and their value from one > > You are copying names and their associations, but not the objects or > thier values. Associations? The upd

Re: __dict__ is neato torpedo!

2011-06-11 Thread Andrew Berg
On 2011.06.11 09:13 PM, Steven D'Aprano wrote: > So never update from a random object you don't know well. Of course. In the project I'm working on, this will be used in the __init__() method of a class that accepts a pair of dictionaries or possibly **kwargs (for flexibility and to avoid the very

Re: __dict__ is neato torpedo!

2011-06-11 Thread Andrew Berg
On 2011.06.11 10:08 PM, Ian Kelly wrote: > For immutable objects such as > ints, this doesn't matter. For mutable objects such as lists, it can: Well, that's confusing. How would I make actual copies? -- http://mail.python.org/mailman/listinfo/python-list

Re: __dict__ is neato torpedo!

2011-06-11 Thread Andrew Berg
On 2011.06.11 10:40 PM, Ben Finney wrote: > It's exactly the same as with an ordinary assignment (‘a = b’) in > Python. Fair enough. > > How would I make actual copies? > At what level? Level? I just want to be able to create an object b with values from dictionary a, and not have changes to a refl

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-14 Thread Andrew Berg
On 2011.06.13 08:58 PM, Chris Angelico wrote: > That's one of the reasons I like my laptop keyboard so much. I find that the terribly tiny keys on a laptop keyboard make them very evil. I don't see how anyone could type fast on one of them without making tons of errors. I constantly have to fix typ

<    1   2   3   4   5   6   7   8   9   10   >