Re: [Tutor] env var packages

2013-05-15 Thread eryksun
On Tue, May 14, 2013 at 3:54 PM, Matthew Ngaha wrote: > I was instructed to get django via easy installer that was > located in my Python/Scripts folder. it installed django to a > different place in site-packages, where django-admin.py resides. You appear to be using Windows, since you talk abou

Re: [Tutor] Making a Primary Number List generator

2013-05-15 Thread eryksun
On Wed, May 15, 2013 at 8:07 PM, Steven D'Aprano wrote: > On 16/05/13 06:02, Alan Gauld wrote: >> >> And C's printf() returns the number of chars printed. >> I actually wish python had followed suit because, as Marc says, >> it can occasionally be useful... > > Guido's time machine strikes again.

Re: [Tutor] Can't install latest PIL

2013-05-16 Thread eryksun
On Thu, May 16, 2013 at 2:12 AM, Jim Mooney wrote: > Okay, I'm trying to install the latest PIL on win 7. It claims Python > 2.7 was not found in the registry, although it's installed, on a path, > and works fine. The install box lets you type in a directory but won't > accept typing. I'm stumped.

Re: [Tutor] Pygraphics crashed

2013-05-16 Thread eryksun
On Thu, May 16, 2013 at 2:06 AM, Jim Mooney wrote: > > And regardless of the answer to that I still want to know how to > uninstall modules. Do I just find and delete them? And are they all in > the same place? You should be able to uninstall msi or exe packages just like any other Windows progra

Re: [Tutor] Making a Primary Number List generator

2013-05-16 Thread eryksun
On Thu, May 16, 2013 at 1:42 AM, eryksun wrote: > On the other hand a BufferedWriter will buffer the remaining 3000 > bytes that can't be written. You won't find out until an exception is > raised when the file is closed: Actually it was buffering all 4000 bytes. I forgot

Re: [Tutor] Can't install latest PIL

2013-05-16 Thread eryksun
On Thu, May 16, 2013 at 6:12 PM, Jim Mooney wrote: > I tried "import image from pil" and got the following error: > SyntaxError invalid syntax (python_init.py, line 1) If you see a syntax error, that means your code could not be compiled. Python's parser doesn't grok "import image from pil". In

Re: [Tutor] Pygraphics crashed

2013-05-16 Thread eryksun
On Thu, May 16, 2013 at 6:15 PM, Jim Mooney wrote: > How do I install PIL with easy-install? I used that once but forget > how. I seem to recall reading it installs a version that is Py native > and doesn't choke on your OS. Or did I read that wrong? I recommend pip instead of easy_install becau

Re: [Tutor] Can't install latest PIL

2013-05-17 Thread eryksun
On Fri, May 17, 2013 at 3:23 AM, Jim Mooney wrote: > BTW, I noticed that Msoft Visual Studio has Python. Does that mean I > could made a standalone Win executable with Python, or would a user > still need the Py interpreter installed? It would be nice if you could > make an exe. Are you referring

Re: [Tutor] Pygraphics crashed

2013-05-17 Thread eryksun
On Fri, May 17, 2013 at 10:31 AM, Oscar Benjamin wrote: > > The wheel format will solve part of the problem in that it will make > it safer and easier to install prebuilt binaries. It will still > require someone to create all of the prebuilt binaries for each > OS/architecture/Python version and

Re: [Tutor] why is unichr(sys.maxunicode) blank?

2013-05-17 Thread eryksun
On Fri, May 17, 2013 at 3:23 PM, Albert-Jan Roskam wrote: > > I was curious what the "high" four-byte ut8 unicode characters look like. > Why does the snippet below not print anything (well, it will eventually, I > think, but at that point I have lost my patience already). The following site list

Re: [Tutor] why is unichr(sys.maxunicode) blank?

2013-05-17 Thread eryksun
On Fri, May 17, 2013 at 11:06 PM, Dave Angel wrote: > One tool that can help is the name function in module unicodedata > > >>> import unicodedata > >>> unicodedata.name(u'\xb0') > 'DEGREE SIGN' > > If you try that on the values near sys.maxunicode you get an exception: > ValueError: no such nam

Re: [Tutor] why is unichr(sys.maxunicode) blank?

2013-05-18 Thread eryksun
On Sat, May 18, 2013 at 6:01 AM, Albert-Jan Roskam wrote: > > East Asian languages. But later on Joel Spolsky's "standard" page about > unicode > I read that it goes to 6 bytes. That's what I implied when I mentioned "utf8". Each surrogate in a UTF-16 surrogate pair is 10 bits, for a total of 20

Re: [Tutor] why is unichr(sys.maxunicode) blank?

2013-05-18 Thread eryksun
On Sat, May 18, 2013 at 12:45 PM, Albert-Jan Roskam wrote: > > It seems that the result of str.isalpha() and str.isdigit() *might* be > different depending > on the setting of locale.C_CTYPE. Yes, str() in 2.x uses the locale predicates from : http://pubs.opengroup.org/onlinepubs/9699919799/bas

Re: [Tutor] model methods in Django

2013-05-18 Thread eryksun
On Sat, May 18, 2013 at 10:22 PM, Dave Angel wrote: > The pub_date is probably an instance attribute of either the Poll class or > the models.Model class. It should probably be defined in the appropriate > __init__ method. In any case it's not a method attribute. Django uses function attributes

Re: [Tutor] Tutor Digest, Vol 111, Issue 61

2013-05-19 Thread eryksun
On Sun, May 19, 2013 at 3:37 AM, Jim Mooney wrote: > > Since Python on Win 7 can already find modules in Lib (and in > site-packages, under Lib) can I assume that it will find any > directories fabricated as mentioned, that are put in Lib or one of its > subdirectories, without doing anything furt

Re: [Tutor] model methods in Django

2013-05-19 Thread eryksun
On Sun, May 19, 2013 at 6:35 AM, Matthew Ngaha wrote: > > if you look at the diagram under that function, why is the value of > "was_published_recently.short_description" the title of that field? > replacing the old title? is a "short_desccription" attribute set > somewhere in django being inactiv

Re: [Tutor] model methods in Django

2013-05-19 Thread eryksun
On Sun, May 19, 2013 at 7:20 AM, Matthew Ngaha wrote: > Thanks that does clear it up. Also thats a huge script you linked, can options.py is the biggest module in the admin package. The link I posted is to the get_actions method of ModelAdmin. In the tutorial, PollAdmin extends this class. > i a

Re: [Tutor] model methods in Django

2013-05-19 Thread eryksun
t;> line, it is hard to follow the conversation, as we can't tell who you are >> quoting. > > ok thanks i didnt think about that. I was quoting eryksun. I'll > includethat line from now on I think this was in reference to your reply to John Steedman. Here's the archive

Re: [Tutor] Which version of python should i use?

2013-05-20 Thread eryksun
On Mon, May 20, 2013 at 5:59 AM, Amal Thomas wrote: > I am a beginner. I am using a unix sytem (ubuntu 12.10). Python 2.7.3 is > installed in my system. I found out that Python has version upto 3.3.2. > Should I update my python version? Ubuntu 12.10 should have 3.2.3 installed (the python3 pack

Re: [Tutor] still clarifying imorting

2013-05-20 Thread eryksun
On Mon, May 20, 2013 at 9:43 PM, Jim Mooney wrote: > If I make a package called jimlib with __init__.py in it, and a > program called bark.py in it, and even put it in site packages, I > still have to import the program with import jimlib.bark > > But I noticed that the pygraphics package is in

Re: [Tutor] nose error

2013-05-21 Thread eryksun
On Tue, May 21, 2013 at 8:09 PM, Jim Mooney wrote: > > "c:\Python27\Lib\site-packages\nose-1.3.0-py2.7.egg\nose\core.py", > line 200, in runTests > sys.exit(not self.success) > SystemExit: False > > As i said, nose works and says Okay on the asserts (or not if I give > things a bad value). I w

Re: [Tutor] Tutor Digest, Vol 111, Issue 72

2013-05-22 Thread eryksun
On Wed, May 22, 2013 at 12:26 AM, Jim Mooney wrote: > > Actually, I did notice that tests were zero, but the book I am using > does not mention needing the word 'test' as part of the regex. There > is only so much time in a day and so many books I can buy (and not all > comprehensive, apparently.)

Re: [Tutor] Tutor Digest, Vol 111, Issue 72

2013-05-22 Thread eryksun
On Wed, May 22, 2013 at 12:13 PM, Jim Mooney wrote: >> Please don't reply to digests. Each message has a Message-ID, and >> replies have an IN-REPLY-TO field that references the ID of the >> previous message in the thread. By replying to the digest your message >> has no meaningful Subject, and ev

Re: [Tutor] Available characters

2013-05-22 Thread eryksun
On Wed, May 22, 2013 at 2:14 PM, Citizen Kant wrote: > Does anybody know if there's a Python method that gives or stores the > complete list of ascii characters or unicode characters? The list of every > single character available would be perfect. The unicodedata module provides access to the Un

Re: [Tutor] keyboard interrupt

2013-05-22 Thread eryksun
On Wed, May 22, 2013 at 4:30 PM, Jim Mooney wrote: > > Figured it out. Ctrl-C only works in the Windows Command window, not > in an editor. Which IDE? In IDLE, your code runs in the main thread of a subprocess (unless IDLE is started with the -n option). A second thread ("SockThread") is started

Re: [Tutor] keyboard interrupt

2013-05-22 Thread eryksun
On Wed, May 22, 2013 at 8:56 PM, Jim Mooney wrote: > On 22 May 2013 15:05, eryksun wrote: >> On Wed, May 22, 2013 at 4:30 PM, Jim Mooney wrote: >>> >>> Figured it out. Ctrl-C only works in the Windows Command window, not >>> in an editor. >> >>

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread eryksun
On Fri, May 24, 2013 at 9:31 AM, Citizen Kant wrote: > Sorry. I'm not doing this on purpose, but I'm doing it anyway, so I'll check > how to fix it. You're replying with rich text, for which Gmail has a lot of its own custom CSS (e.g. the gmail_quote class). In Gmail I see the quoted text as a pu

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread eryksun
On Fri, May 24, 2013 at 7:04 AM, Citizen Kant wrote: > Same happens with the tuple (100, 'value', 2); where parenthesis and semi > colon work as a rule, setting the shape of a value named tuple that's > different to the shape of a value named list. At the same time both shapes > are equal (since

Re: [Tutor] Fwd: Difference between types

2013-05-24 Thread eryksun
On Fri, May 24, 2013 at 12:52 PM, Citizen Kant wrote: > They are values since they cannot be reduced by rewriting any further. You seem to be talking about the "atoms" of the language: identifiers, literals, parenthesized forms, displays, and so on. Please read sections 2.3 (identifiers), 2.4 (li

Re: [Tutor] making a random list, then naming it

2013-05-24 Thread eryksun
On Fri, May 24, 2013 at 9:10 PM, Dave Angel wrote: > > Is lists[(3,8)] really so much harder to type than > list_3_8 ? Since a comma creates a tuple, in this context you can just use lists[3,8] to save a couple more keystrokes. >>> from random import Random >>> randint = Random(42)

Re: [Tutor] keyboard interrupt

2013-05-24 Thread eryksun
On Fri, May 24, 2013 at 10:19 PM, Steven D'Aprano wrote: > > You can edit *other* people's questions and answers??!??!?? > > What. The. Hell. This should be done sparingly for answers. But it's very common for questions since inexperienced users almost always get the markdown wrong. _

Re: [Tutor] why can you swap an immutable tuple?

2013-05-25 Thread eryksun
On Sat, May 25, 2013 at 10:38 PM, Steven D'Aprano wrote: > On 26/05/13 05:23, Mark Lawrence wrote: >> >> On 25/05/2013 19:56, Jim Mooney wrote: >>> >>> I thought tuples were immutable but it seems you can swap them, so I'm >>> confused: >>> >>> a,b = 5,8 >> >> >> You've defined two names a and b s

Re: [Tutor] Fwd: Difference between types

2013-05-25 Thread eryksun
On Fri, May 24, 2013 at 2:53 PM, Albert-Jan Roskam wrote: > Why do I need to use a trailing comma to create a singleton > tuple? Without a comma it seems to mean "parenthesized single > object", ie the parentheses are basically not there. Here are some technical notes and references to augment th

Re: [Tutor] keyboard interrupt

2013-05-26 Thread eryksun
On Sun, May 26, 2013 at 4:34 AM, Steven D'Aprano wrote: > > So these edits aren't default-deny, but default-accept? Worse and worse. It shows who made the edit and when they edited it, which links to the revision history. When a question is closed it shows who voted to close it. Even retagging sh

Re: [Tutor] keyboard interrupt

2013-05-26 Thread eryksun
On Sun, May 26, 2013 at 8:25 PM, Jim Mooney wrote: > > StackOverflow may be good but I just had an unpleasant experience > wanting to add New .py file to my Windows context menu. The first > advice I saw was missing a backslash and had me adding the string to > the wrong key. Thankfully, it didn't

Re: [Tutor] making a string

2013-05-26 Thread eryksun
On Sun, May 26, 2013 at 8:20 PM, Steven D'Aprano wrote: > On 27/05/13 07:40, Jim Mooney wrote: > >> Good to know that compile doesn't check syntax, since I erroneously >> thought it did. > > compile does check syntax. Attempting to iterate an integer is a runtime TypeError, not a compile-time Syn

Re: [Tutor] Fwd: QT Python: How to re-use the return value of fileDialog.openFileName() ?

2013-05-27 Thread eryksun
On Mon, May 27, 2013 at 9:45 AM, Matthew Ngaha wrote: > On Mon, May 27, 2013 at 2:14 PM, SM wrote: > >>But then I also had to use self.fileDialog from within the function. Not >> sure how I could avoid using fileDialog. >> > > No problem. to do it without the instance variable, you access its > m

Re: [Tutor] bytecode primer, and avoiding a monster download

2013-05-27 Thread eryksun
On Mon, May 27, 2013 at 4:01 PM, Jim Mooney wrote: > I was looking at the bytecode doc page as a break from the Lutz book, > since I like Assembler-type code due to its total non-ambiguity, but > the page doesn't say much. Is there a doc somewhere that corresponds > some of the bytecode to Python

Re: [Tutor] bytecode primer, and avoiding a monster download

2013-05-28 Thread eryksun
On Tue, May 28, 2013 at 7:18 AM, Dave Angel wrote: > > dis.dis(myfunction) > > will disassemble one function. > > That's not all that's in the byte-code file, but this is 98% of what you > probably want out of it. And you can do it in the debugger with just the > standard library. The argument f

Re: [Tutor] bytecode primer, and avoiding a monster download

2013-05-28 Thread eryksun
On Tue, May 28, 2013 at 1:12 PM, Oscar Benjamin wrote: > On 28 May 2013 17:48, eryksun wrote: >> >> The argument for dis.dis() can be a module, class, function or code >> object. It disassembles all the top-level code objects that it finds, >> but it doesn't recu

Re: [Tutor] bytecode primer, and avoiding a monster download

2013-05-28 Thread eryksun
On Tue, May 28, 2013 at 1:58 PM, Oscar Benjamin wrote: > > So what happens to the code object for the top-level code in the > module itself when it is imported in the normal way? Is it just > discarded once import is complete? Is it temporarily accessible during > import? Normally, nothing holds

Re: [Tutor] Socket Error Handling Syntax

2013-05-28 Thread eryksun
On Tue, May 28, 2013 at 3:49 PM, Dave Angel wrote: > I don't use Windows, but I doubt if there's a separate exception > type for 10057. Windows sockets error codes at or above 1 aren't mapped to POSIX error codes. Instead errno is set directly from winerror. So there's no reason to look at wi

Re: [Tutor] walk registry using _winreg

2013-05-30 Thread eryksun
On Thu, May 30, 2013 at 10:47 AM, Albert-Jan Roskam wrote: > > def walkRegistry(regkey, keyToSet="file_locations", > valueToSet="temp_dir", > HKEY=_winreg.HKEY_CURRENT_USER, verbose=False): I suppose you don't need the "sam" option in your case, but in general it

Re: [Tutor] a little loop

2013-05-30 Thread eryksun
On Wed, May 29, 2013 at 12:51 PM, boB Stepp wrote: > On Wed, May 29, 2013 at 11:07 AM, Oscar Benjamin > wrote: > >> I don't know exactly how str.join is implemented but it does not use >> this quadratic algorithm. For example if str.join would first compute >> the length of the resulting string f

Re: [Tutor] google spreadsheet

2013-05-30 Thread eryksun
On Thu, May 30, 2013 at 12:50 PM, Mark Lawrence wrote: >> >> i trying to access google spreadsheet with help of python > > Start here > https://developers.google.com/google-apps/documents-list/v1/ > developers_guide_python > I guess!!! > > -- > If you're using GoogleCrap™ please read this :D

Re: [Tutor] a little loop

2013-05-30 Thread eryksun
On Thu, May 30, 2013 at 6:35 PM, Oscar Benjamin wrote: > > It's also for BINARY_ADD in the form a = a + b: Right you are. It sees that the next operation is a store back to "a". It wouldn't work the other way around, i.e. a = b + a. ___ Tutor maillist

Re: [Tutor] a little loop

2013-05-30 Thread eryksun
On Thu, May 30, 2013 at 3:16 PM, Steven D'Aprano wrote: > > Sure enough, ''.join(list-of-substrings) is measurably faster than > ''.join(iterator-of-substrings). A tuple or list is used directly. Otherwise join() has to create an iterator and build a new list. This isn't directly related to the

Re: [Tutor] when is a generator "smart?"

2013-06-02 Thread eryksun
On Sat, Jun 1, 2013 at 11:58 PM, Jim Mooney wrote: > > def uneven_squares(x,y): > squarelist = (c**2 for c in range(x,y) if c%2 != 0) > return squarelist #returning a generator > > print(list(uneven_squares(10,1))[2:10]) #slows as y gets bigger, then dies I think you said you switched

Re: [Tutor] when is a generator "smart?"

2013-06-02 Thread eryksun
On Sun, Jun 2, 2013 at 10:50 PM, Jim Mooney wrote: > In regard to that, I just tried importing Tkinter, according to a > guide I'm using. Except the guide is using tkinter and not Tkinter, > but Py27 has Tkinter. Lord knows why they bothered to change one lousy > letter - it would be less confusin

Re: [Tutor] when is a generator "smart?"

2013-06-02 Thread eryksun
On Sun, Jun 2, 2013 at 11:33 PM, eryksun wrote: > In 3.3, it was reorganized into the tkinter package Sorry, that should have been 3.x. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.

Re: [Tutor] when is a generator "smart?"

2013-06-03 Thread eryksun
On Mon, Jun 3, 2013 at 12:44 AM, Jim Mooney wrote: > On 2 June 2013 20:33, eryksun wrote: > >> >> The base sys.path configured in the registry already has lib-tk: >> >> C:\>reg query hklm\software\python\pythoncore\2.7\pythonpath >> >> HKEY

Re: [Tutor] when is a generator "smart?"

2013-06-03 Thread eryksun
On Mon, Jun 3, 2013 at 3:41 AM, Jim Mooney wrote: > Ah, useful. A lot more than is on windows path and PYTHONPATH > obviously gets snuck in there. Sure enough, I queried sys.path and > there's a Lot more in there. The path for the script comes first, followed by the contents of the PYTHONPATH env

Re: [Tutor] three numbers for one

2013-06-11 Thread eryksun
t;>> '\u4e00'.isdecimal() False >>> '\u4e00'.isdigit() False >>> unicodedata.numeric('\u4e00') 1.0 > (Also the Japanese numerals page shows a character 京 (kei) with a > bigger numeric value than the 兆 (chō) character that

Re: [Tutor] On a looping input, subsequent inputs are hidden

2013-06-11 Thread eryksun
On Tue, Jun 11, 2013 at 2:17 AM, Jim Mooney wrote: > > But the Second and subsequent inputs, in Windows, hide the input with > dots, while the first shows the input, and I can't figure out why. I > don't change a thing between the first and subsequent calls to input > except changing the input mes

Re: [Tutor] On a looping input, subsequent inputs are hidden

2013-06-11 Thread eryksun
On Tue, Jun 11, 2013 at 2:33 PM, Jim Mooney wrote: > On 11 June 2013 01:07, Alan Gauld wrote: > >> First you are effectively creating an entire Tkinter app >> inside popup() each time. > > I partially mis-spoke myself. The error was not caused Just by > creating the app every time, but very oddly

Re: [Tutor] Value Error

2013-06-13 Thread eryksun
On Wed, Jun 12, 2013 at 6:31 PM, Dave Angel wrote: > i = complex(0,1) >>> 1j 1j http://en.wikipedia.org/wiki/Imaginary_unit#Alternative_notations cmath.sqrt(float((math.e **(i * math.pi)).real)) The real/imag attributes are already floats: >>> from math import e, pi, si

Re: [Tutor] sound implementation problems

2013-06-14 Thread eryksun
On Thu, Jun 13, 2013 at 11:55 PM, Jim Mooney wrote: > > My IDE startup script has been changed to also go to the proper working > directory. > BUT - Py 3.3 at the command prompt uses my 3.3 working directory, and Py 2.7 > ALSO uses the 3.3 working directory, which is not what I want, obviously. >

Re: [Tutor] What are these two string-formatting styles called?

2013-06-14 Thread eryksun
On Fri, Jun 14, 2013 at 12:01 PM, Jim Mooney wrote: > On 14 June 2013 08:23, Dotan Cohen wrote: >> >> What are these two string-formatting styles called? >> '%.3f' % x >> '{0:.3f}'.format(x) > > > The first one is a string Expression, using % as the overloaded operator > The second one is a strin

Re: [Tutor] sound implementation problems

2013-06-15 Thread eryksun
On Fri, Jun 14, 2013 at 6:35 PM, Jim Mooney wrote: > On 14 June 2013 08:49, eryksun wrote: >> >> C:\>python -i -c "import os; os.chdir('C:/Python33')" > > Well, that didn't work anyway. Got me the right directory and the > interpeter, b

Re: [Tutor] sound implementation problems

2013-06-15 Thread eryksun
On Fri, Jun 14, 2013 at 12:05 PM, Jim Mooney wrote: > On 14 June 2013 08:49, eryksun wrote: >> >> C:\>doskey calc=c:\python33\python -c "from cmath import *;print($*)" >> >> C:\>calc e**(1j*pi/3) >> (0.5001+0.86602540378

Re: [Tutor] What is the difference between checking false?

2013-06-15 Thread eryksun
On Sat, Jun 15, 2013 at 9:30 PM, Jim Mooney wrote: > This is puzzling me. If I check the equality of 0, None, empty > string, and empty list with False, only zero satisfies the equality. > But if I use them in a not statement, they all turn out False. > What gives? > > #Using C:\Python33\python.ex

Re: [Tutor] What is the difference between checking false?

2013-06-15 Thread eryksun
On Sat, Jun 15, 2013 at 10:23 PM, eryksun wrote: > This function is hard coded for the singletons True, > False, and None -- and otherwise uses either __bool__ > (tp_as_number->nb_bool) or __len__ (tp_as_mapping->mp_length or > tp_as_sequence->sq_length). A length of 0 is fal

Re: [Tutor] What is the difference between checking false?

2013-06-16 Thread eryksun
On Sat, Jun 15, 2013 at 11:53 PM, Jim Mooney wrote: > > class NobodyHome: pass > x = NobodyHome() > print(not x) # Result is False when I thought this would be True. Quote: >> If neither __bool__ nor __len__ is defined, the object defaults to being >> truthy: >> >> >>> not not object() >>

Re: [Tutor] What is the difference between checking false?

2013-06-16 Thread eryksun
On Sat, Jun 15, 2013 at 11:15 PM, Jim Mooney wrote: > > ## Comparing different types for equality always fails: > > if '5' != 5: > print('oops') It depends on the __eq__ and __ne__ methods defined by the types. int and str have their own implementations of "rich comparisons". But that's a sub

Re: [Tutor] On a looping input, subsequent inputs are hidden

2013-06-16 Thread eryksun
On Tue, Jun 11, 2013 at 2:00 PM, Jim Mooney wrote: > On 11 June 2013 05:59, Steven D'Aprano wrote: > >> I'm afraid I don't understand what you mean. Second and subsequent inputs? I >> only see one. Hide the input with dots? >> >> Can you copy and paste an example? > > That would be a graphic of t

Re: [Tutor] Is there a programmatic use for keys() and values()

2013-06-16 Thread eryksun
On Sun, Jun 16, 2013 at 4:43 AM, Roel Schroeven wrote: > Jim Mooney schreef: >> I'll get to here: >> >> {'alpha':'beta' >> >> Only my cursor is to the Left of the final quote. Then I have to go >> hunt the Right Arrow or End key In PyScripter you can just type the closing quote/brace over the aut

Re: [Tutor] The Whole Tree

2013-06-16 Thread eryksun
On Sun, Jun 16, 2013 at 3:17 PM, Steven D'Aprano wrote: > > plus some more exotic built-ins, which I haven't shown. Some types that didn't make it into Steven's list: zip map filter enumerate reversed memoryview slice ellipsis, type(...) super classmetho

Re: [Tutor] Need help appending data to a logfile

2013-06-17 Thread eryksun
On Mon, Jun 17, 2013 at 5:43 PM, Dave Angel wrote: > But in 3.3, it says: > Help on built-in function close: > > close(...) > > with no more explanation. The category "built-in function" here doesn't mean it's in the builtins namespace. It means it's a function or method from an extension module

Re: [Tutor] "farkadoodle" or: unique global names, was Re: Data persistence problem

2013-06-22 Thread eryksun
On Sat, Jun 22, 2013 at 7:10 AM, Steven D'Aprano wrote: > The function attribute "__closure__" is set to None for regular functions. > For closures, it is set to a bunch of stuff needed for the inner function to > work correctly. (No user serviceable parts inside.) Basically, the inner > function

Re: [Tutor] EXE Problem

2013-06-22 Thread eryksun
On Wed, Jun 19, 2013 at 6:58 PM, Alan Gauld wrote: > On 19/06/13 17:41, Jim Mooney wrote: > >> you should use forward slashes. I have no idea why Bill Gates thought >> backslashes were kewl > > Because MS DOS was copying CP/M which didn't have directory paths > (it was used with 180K floppy disks

Re: [Tutor] "farkadoodle" or: unique global names, was Re: Data persistence problem

2013-06-22 Thread eryksun
On Sat, Jun 22, 2013 at 3:59 PM, Albert-Jan Roskam wrote: > > I was playing around with this a bit and arrived at the following > surprising (for me at least) result. I thought the global/local/nonlocal > keywords could be used to get values from another scope. Though this > could also happen impl

Re: [Tutor] appending/updating values dict key value pairs

2013-06-23 Thread eryksun
On Sun, Jun 23, 2013 at 5:42 AM, Sivaram Neelakantan wrote: > I've sort of used a dict of this sort {'a': [1,2,'fff'] } in my > programs and I've noticed that I've got to unpack the list with > hardcoded list positions when I retrieve the value of a key. > > I think I'd be better off, if I did som

Re: [Tutor] Help

2013-06-23 Thread eryksun
On Thu, Jun 20, 2013 at 6:10 PM, Antonio Zagheni wrote: > > I am a begginer in Python. > I did a function that returns a string and I want to copy this to the > clipboard. > I have tried a lot of suggestions found at Google but nothing works properly. > Is there an easy way to do that? > I am usi

Re: [Tutor] "farkadoodle" or: unique global names, was Re: Data persistence problem

2013-06-24 Thread eryksun
On Sun, Jun 23, 2013 at 10:38 PM, Jim Mooney wrote: > What about class variables instead of globals?, I put this in the my > lazy typer module, maker.py, which works fine to persist the numbers > between function calls so I can increment them: > > class count: > dict = list = set = tuple = 0 >

Re: [Tutor] Need help printing a pickled data

2013-06-25 Thread eryksun
On Mon, Jun 24, 2013 at 6:57 PM, Steven D'Aprano wrote: > > You certainly shouldn't be writing pickle data to a log file! Firstly, > log files are usually opened in text mode, not binary mode, so it > probably won't work, and secondly even if it did work, you will be > dumping a load of pickled bi

Re: [Tutor] mistaken about splitting expressions over lines

2013-06-25 Thread eryksun
On Mon, Jun 24, 2013 at 9:58 PM, Dave Angel wrote: > > Alternatively, you can also use the statement continuation mechanism, > whereby the last character of the line is a backslash. Using that approach > you can break almost anywhere, except within a token or inside a string > literal. Also, the

Re: [Tutor] mistaken about splitting expressions over lines

2013-06-25 Thread eryksun
On Tue, Jun 25, 2013 at 10:11 AM, Peter Otten <__pete...@web.de> wrote: > > In older Pythons for ("alpha" "beta") the compiler would merge the two > strings into one whereas ("alpha" + "beta") would trigger a str.__add__() > call at runtime. Nowadays the peephole optimiser recognizes ("alpha" + > "

Re: [Tutor] mistaken about splitting expressions over lines

2013-06-25 Thread eryksun
On Tue, Jun 25, 2013 at 11:35 AM, Peter Otten <__pete...@web.de> wrote: > eryksun wrote: > >> Constant folding for binary operations has a length limit of 20 for >> sequences: >> >> >>> dis.dis(lambda: '0123456789' + '01234567

Re: [Tutor] is the the two style of writting the same?

2013-08-20 Thread eryksun
On Tue, Aug 20, 2013 at 3:31 PM, Walter Prins wrote: > On 20 August 2013 10:20, sikonai sikonai wrote: >> >> >>> list=[1,2,3,4,5,6,7,8,9] >> >>> list[9:0:-2] >> [9, 7, 5, 3] >> >>> list[10:0:-2] >> [9, 7, 5, 3] > > For the specific list you show, the 2 expressions yield the same result. > However

Re: [Tutor] Python execution timer/proficiency testing

2013-08-27 Thread eryksun
On Tue, Aug 27, 2013 at 2:18 AM, Steven D'Aprano wrote: > On Mon, Aug 26, 2013 at 08:20:30PM +0200, Dino Bektešević wrote: > >> Warning (from warnings module): >> File "/usr/lib/python2.7/dist-packages/scipy/optimize/minpack.py", line >> 152 >> warnings.warn(msg, RuntimeWarning) >> RuntimeWa

Re: [Tutor] myown.getfilesystemencoding()

2013-08-30 Thread eryksun
On Fri, Aug 30, 2013 at 11:04 AM, Albert-Jan Roskam wrote: > In Windows, sys.getfilesystemencoding() returns 'mbcs' (multibyte code > system), which doesn't say very much imho. Why aren't you using Unicode for the filename? The native encoding for NTFS is UTF-16, and CPython 2.x uses _wfopen() if

Re: [Tutor] myown.getfilesystemencoding()

2013-08-31 Thread eryksun
On Sat, Aug 31, 2013 at 9:16 AM, Oscar Benjamin wrote: > Spyder has both an internal interpreter and an external interpreter. > One is the same interpreter process that runs the Spyder GUI. The > other is run in a subprocess which keeps the GUI safe but reduces your > ability to inspect the worksp

Re: [Tutor] os.system vs subprocess.Popen args problems

2013-09-02 Thread eryksun
On Mon, Sep 2, 2013 at 10:19 AM, learner404 wrote: > > I can't understand why the command below works with os.system but not with > subprocess.Popen (on windows, recording video with FFMPEG.exe) > > cmd=('ffmpeg -f dshow -i video="%s" -f dshow -i audio="%s" -q 5 "%s"')% > (videoinputName, audioinp

Re: [Tutor] os.system vs subprocess.Popen args problems

2013-09-03 Thread eryksun
On Tue, Sep 3, 2013 at 5:54 AM, Oscar Benjamin wrote: > On 3 September 2013 05:49, eryksun wrote: > > I've previously tried to find documentation that explains how MSVCRT > handles this. I didn't find anything as explicit as the explanation in > the subprocess

Re: [Tutor] os.system vs subprocess.Popen args problems

2013-09-04 Thread eryksun
On Wed, Sep 4, 2013 at 5:14 AM, learner404 wrote: > > Yes, this worked :) > > subprocess.Popen(["ffmpeg","-f","dshow","-i","video="+videoinputName,"-f", > "dshow","-i","audio="+audioinputName,"-q","5","%s"%videoFileOutput], > shell=True) Using shell=True also sets startupinfo to hide the window.

Re: [Tutor] os.system vs subprocess.Popen args problems

2013-09-04 Thread eryksun
On Wed, Sep 4, 2013 at 6:22 AM, Oscar Benjamin wrote: > On 4 September 2013 11:11, eryksun wrote: > >> Using shell=True also sets startupinfo to hide the window. If that's >> the only reason you're using the shell, you may as well cut out the >> middleman

Re: [Tutor] os.system vs subprocess.Popen args problems

2013-09-04 Thread eryksun
On Wed, Sep 4, 2013 at 7:11 AM, Oscar Benjamin wrote: > On 4 September 2013 11:42, eryksun wrote: >>>> si = subprocess.STARTUPINFO() >>>> si.dwFlags |= subprocess.STARTF_USESHOWWINDOW >>>> si.wShowWindow = subprocess.SW_HIDE >>> >&

Re: [Tutor] myown.getfilesystemencoding()

2013-09-04 Thread eryksun
On Wed, Sep 4, 2013 at 8:39 AM, Albert-Jan Roskam wrote: > But given that chcp returns cp850 on my windows system (commandline), > wouldn't it be more descriptive if sys.getfilesystemencoding() > returned 'cp850'? The common file systems (NTFS, FAT32, UDF, exFAT) support Unicode filenames. The co

Re: [Tutor] How to add modules?

2013-09-19 Thread eryksun
On Thu, Sep 19, 2013 at 6:05 AM, Peter Otten <__pete...@web.de> wrote: > As I'm not a windows user have no first-hand experience with the above. Once > you have pip installed you can search the Python package index (aka "Cheese > Shop", ) with pip requires a C compile

Re: [Tutor] ImportError: No module named '_sysconfigdata_m'

2013-09-23 Thread eryksun
On Mon, Sep 23, 2013 at 3:28 PM, Albert-Jan Roskam wrote: > I just wanted to type "git status" in my Linux terminal but I made a typo > and I got a long Python 3.3 traceback message. Just curious: What does it > mean? > > gigt status > Traceback (most recent call last): "gigt"? Why is that trying

Re: [Tutor] ImportError: No module named '_sysconfigdata_m'

2013-09-24 Thread eryksun
On Tue, Sep 24, 2013 at 8:18 AM, Albert-Jan Roskam wrote: > am using Linux Mint XFCE. I have to look up the exact version number. I > recently > downloaded and installed Python 3.3. I downloaded the tarball > and compiled, tested and installed everything as per instructions in the > (readme? inst

Re: [Tutor] ImportError: No module named '_sysconfigdata_m'

2013-09-24 Thread eryksun
On Tue, Sep 24, 2013 at 1:42 PM, Albert-Jan Roskam wrote: > I did not use "--prefix". I just reinstalled Python 3.2 via the package > manager, and > it everything is working again --THANK YOU ALL! > > antonia@antonia-HP-2133 ~ $ which python3.3 > /usr/local/bin/python3.3 This is the version you

Re: [Tutor] HELP Please!!!....How Do I Make a Graph Chart Generate in Python Based on my Code

2013-09-25 Thread eryksun
On Tue, Sep 24, 2013 at 9:15 PM, Dino Bektešević wrote: > > original question: http://code.activestate.com/lists/python-tutor/96889/ > my response: http://code.activestate.com/lists/python-tutor/96897/ > > For someone browsing through Tutor in archive form I can see how this > is a tad confusing,

Re: [Tutor] HELP Please!!!....How Do I Make a Graph Chart Generate in Python Based on my Code

2013-09-25 Thread eryksun
On Wed, Sep 25, 2013 at 6:24 PM, Dino Bektešević wrote: > > Where did you find that In-Reply-To: field? In example Alan's response > header Gmail has a "Show original" link in the message drop-down menu. But in this case I just searched the September text archive: https://mail.python.org/piperma

Re: [Tutor] comma in an assignment

2013-10-22 Thread eryksun
On Tue, Oct 22, 2013 at 3:20 PM, Key, Gregory E (E S SF RNA FSF 1 C) wrote: > I understand that a comma in Python is a separator and not an operator. In The comma operator creates a tuple. It has low precedence, so you usually need parentheses. But sometimes the parentheses are redundant such as

Re: [Tutor] How to Terminate a Popen call?

2013-10-22 Thread eryksun
On Tue, Oct 22, 2013 at 9:04 PM, SM wrote: > def run(self): > (process, err) = Popen(self.fwcmd, stdout=PIPE, > stderr=PIPE).communicate() > if len(err) > 0: > # print("Error") > # Error handling code > else: > # print("S

Re: [Tutor] comma in an assignment

2013-10-22 Thread eryksun
On Tue, Oct 22, 2013 at 9:50 PM, Steven D'Aprano wrote: > However, there does have to be the same number of items on both sides: > > py> a, b, c = "xy" > Traceback (most recent call last): > File "", line 1, in > ValueError: need more than 2 values to unpack 3.x extends sequence unpacking to s

Re: [Tutor] why does platform.architecture default to sys.executable?

2013-10-26 Thread eryksun
On Sat, Oct 26, 2013 at 12:39 PM, Albert-Jan Roskam wrote: > > Why does the "executable" parameter default to sys.executable? In general platform.architecture() parses the output of the UNIX "file" command. But on Windows the linkage is hard coded to 'WindowsPE', and bits is the default value cal

Re: [Tutor] UnicodeDecodeError while parsing a .csv file.

2013-10-28 Thread eryksun
On Mon, Oct 28, 2013 at 7:49 PM, Steven D'Aprano wrote: > > By default Python 3 uses UTF-8 when reading files. As the error below > shows, your file actually isn't UTF-8. Modules default to UTF-8, but io.TextIOWrapper defaults to the locale preferred encoding. To handle terminals, it first tries

Re: [Tutor] UnicodeDecodeError while parsing a .csv file.

2013-10-29 Thread eryksun
On Tue, Oct 29, 2013 at 6:33 AM, Albert-Jan Roskam wrote: > Why is do_setlocale=False here? Actually, what does this parameter do? > It seems strange that a getter function has a 'set' argument. On Windows, getpreferredencoding doesn't use setlocale. It calls WinAPI GetACP to fetch the ANSI codep

<    1   2   3   4   5   6   7   >