Re: Show off your Python chops and compete with others

2013-11-06 Thread Andrew Cooper
On 07/11/2013 00:24, Roy Smith wrote: > In article , > Andrew Cooper wrote: > >> On 07/11/2013 00:00, Nathaniel Sokoll-Ward wrote: >>> Thought this group would appreciate this: >>> www.metabright.com/challenges/python >>> >>> MetaBright mak

Re: Python 3 lack of support for fcgi/wsgi.

2015-03-29 Thread Andrew Berg
On 2015.03.29 13:57, John Nagle wrote: > There's "wsgiref", which looks more promising, but has a different > interface. That's not what the Python documentation recommends as > the first choice, but it's a standard module. Oh? > These days, FastCGI is never used directly. Just like mod_python, i

Re: Project, how to debug

2015-03-31 Thread Andrew Farrell
points of general advice: - As noted by Chris, you first need to figure out what the code is *supposed* to do. - Have a notebook and pencil next to you as you are working through this so that you can make notes and draw out the structure of things. - Write down the general structure of the code on

Re: New to Programming - XML Processing

2015-03-31 Thread Andrew Farrell
You should follow Rustom's advice before just diving into the blog post I linked to. Otherwise you risk blindly following things and losing your bearings when you run into bugs. On Tue, Mar 31, 2015 at 11:17 PM, Rustom Mody wrote: > On Wednesday, April 1, 2015 at 8:57:15 AM UTC+5:30, catperson w

Re: New to Programming - XML Processing

2015-03-31 Thread Andrew Farrell
> I am new to programming, though not new to computers. One quick tip: when starting a new project, it is sometimes is useful to see if others have done the same thing and use their approach to guide yours. In your case, googling "Garmin Forerunner xml python" results in this blog post which is re

Re: Concatenating Strings

2015-04-09 Thread Andrew Farrell
I am under the impression that using format() is the canonically "right way to do it". It is certainly more readable than using ''.join() and is more semantically specific than string addition. On Thu, Apr 9, 2015 at 1:35 PM, Chris Angelico wrote: > On Fri, Apr 10, 2015 at 4:29 AM, Travis Griggs

Re: Using + with strings considered bad

2015-04-29 Thread Andrew Berg
On 2015.04.29 04:08, Mark Lawrence wrote: > On 29/04/2015 09:29, Cecil Westerhof wrote: >> Because I try to keep my lines (well) below 80 characters, I use the >> following: >> print('Calculating fibonacci and fibonacci_memoize once for ' + >>str(large_fibonacci) + ' to determine s

Re: Bitten by my C/Java experience

2015-05-04 Thread Andrew Cooper
ot; for more information. >>> def foo(**kwargs): ... return { (k, kwargs[k]) for k in kwargs } ... >>> foo() set() >>> foo(a=1) {('a', 1)} >>> ~Andrew -- https://mail.python.org/mailman/listinfo/python-list

Basic misunderstanding on object creation

2015-05-13 Thread andrew cooke
ost recent call last): File "", line 1, in File "", line 4, in __new__ TypeError: object() takes no parameters What I was expecting to happen (and what happens in 3.2) is that the object.__new__ method passes the argument to the __init__ of the subclass. Any help apprecia

Re: Basic misunderstanding on object creation

2015-05-13 Thread andrew cooke
On Wednesday, 13 May 2015 11:36:12 UTC-3, Thomas Rachel wrote: > Am 13.05.2015 um 15:25 schrieb andrew cooke: > > >>>> class Foo: > > ... def __new__(cls, *args, **kargs): > > ... print('new', args, kargs) > > ... s

Re: Basic misunderstanding on object creation

2015-05-13 Thread andrew cooke
> But then nothing will be passed to __init__ on the subclass. > > Andrew >>> class Foo: ... def __new__(cls, *args, **kargs): ... print('new', args, kargs) ... super().__new__(cls) ... >>> class Bar(Foo): ... def __init__(

Re: Basic misunderstanding on object creation

2015-05-13 Thread andrew cooke
On Wednesday, 13 May 2015 11:56:21 UTC-3, Ian wrote: > On Wed, May 13, 2015 at 8:45 AM, andrew cooke wrote: > >>>> class Foo: > > ... def __new__(cls, *args, **kargs): > > ... print('new', args, kargs) > > ... sup

Re: Basic misunderstanding on object creation

2015-05-13 Thread andrew cooke
On Wednesday, 13 May 2015 13:37:23 UTC-3, Terry Reedy wrote: > On 5/13/2015 9:25 AM, andrew cooke wrote: > > > The following code worked on Python 3.2, but no longer works in 3.4. > > Bugfixes break code that depends on buggy behavior. See > https://bugs.python.org/issue168

Cross compiling C Python2.7.10 for arm on x86_64 linux box.

2015-06-29 Thread Andrew Robinson
Hi, I'm Needing to get python 2.7.10 to cross compile correctly for an ARM embedded device. I'm very close, as it does build with warnings, but the result is defective and I'm not sure how to fix it. For some odd reason, the interpreter does run -- but I either get random segfaults -- or if I

TypeCheck vs IsInstance in C API

2015-08-25 Thread Andrew Wang
Hi. I know this thread is ancient, but I would like to know the answer as well ( https://mail.python.org/pipermail/python-list/2006-May/413542.html). Thanks. Andrew -- https://mail.python.org/mailman/listinfo/python-list

OS X Python: can I explicitly set MACOSX_DEPLOYMENT_TARGET for extensions?

2015-10-19 Thread Andrew Jaffe
e any upsides? Does a newer deployment target allow more recent compilers and/or higher optimizations? -Andrew -- https://mail.python.org/mailman/listinfo/python-list

[Ubuntu] PyQt5

2015-11-07 Thread Andrew Diamond
Hi! I'm fairly new to Python, and installed pyqt5 and began working through the examples at http://zetcode.com/gui/pyqt5/menustoolbars/ However, whenever I click one of the buttons or menus in the example apps I run that is supposed to quit the application, it locks up. This happens with all

Re: [Ubuntu] PyQt5

2015-11-08 Thread Andrew Diamond
On Saturday, November 7, 2015 at 10:13:25 PM UTC-5, Andrew Diamond wrote: > Hi! > > I'm fairly new to Python, and installed pyqt5 and began working through the > examples at http://zetcode.com/gui/pyqt5/menustoolbars/ However, whenever I > click one of the buttons or menus

Re: [Ubuntu] PyQt5

2015-11-08 Thread Andrew Diamond
On Sunday, November 8, 2015 at 11:22:30 AM UTC-5, Chris Angelico wrote: > On Mon, Nov 9, 2015 at 3:03 AM, Andrew Diamond wrote: > > On Saturday, November 7, 2015 at 10:13:25 PM UTC-5, Andrew Diamond wrote: > >> Hi! > >> > >> I'm fairly new to Python, and

Re: Python 3 on Mac OS X 10.8.4

2014-06-19 Thread Andrew Jaffe
conflict with the system installed python. There is no problem with using them. Yours, Andrew -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3 is killing Python

2014-07-17 Thread Andrew Berg
On 2014.07.17 19:26, Mark Lawrence wrote: > I'm looking forward to see the massive number of fixes that come from > rr, assuming of course that he signs the CLA to make this possible. Or > has he already done so? > Maybe he's too busy working on RickPy 4000 (or whatever it was called). -- http

Re: Python 3.4.1 64 bit Version

2014-07-18 Thread Andrew Berg
On 2014.07.18 08:53, Zachary Ware wrote: > For the record, all versions of CPython on Windows (not counting > anything relating to cygwin) are "on win32" regardless of the > bittedness of the processor or the interpreter. > And in case you need more reassurance, there is the platform module in the

Re: OT: usenet reader software

2014-07-18 Thread Andrew Berg
On 2014.07.18 14:10, memilanuk wrote: > I'm on Ubuntu (14.04 LTS, if it matters) and I've been using Thunderbird > for a lng time... I've tinkered with slrn off and on over the years, > tried pan occasionally due to recommendations... but I keep ending up > back @ Thunderbird. About the onl

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-03 Thread Andrew Berg
On 2014.08.03 18:08, Chris Angelico wrote: > The best way to do it is to use the Unicode codepage, but cmd.exe just > plain has issues. There are underlying Windows APIs for displaying > text that have problems with astral characters (I think that's what it > is), so ultimately, you're largely stuc

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-03 Thread Andrew Berg
On 2014.08.03 23:14, Glenn Linderman wrote: > Having read a bit about ConEmu, it seems that it is a "pretty face" built on > top of Windows Console, by screen scraping the real (but hidden) Windows > Console, and providing a number of interesting display features and modes. So > while it adds funct

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Andrew Berg
On 2014.08.04 04:46, Glenn Linderman wrote: > How does one "directly run" another application using ConEmu? That wasn't > clear > from what I found to read. It sounded like you run ConEmu, run one or more > shells within it, and launch programs from those shells? And so it was also > unclear if a

RE: Wikibooks example doesn't work8

2014-08-06 Thread Andrew Christianson
The if statement in question isn't inside the while loop. White space and indentation is meaningful in python, so putting the if count > 3 block at same indentation as the while statement effectively places it outside the loop. Regards, Drew Original message From: Seymore4Hea

Re: Log base 2 of large integers

2014-08-13 Thread Andrew Jaffe
log2(n): """ return log_2(n) by splitting the problem into the integer and fractional parts""" l2f = log2_floor(n) if n == 2**l2f: return l2f else: return l2f + math.log(n*2**-l2f, 2) Andrew -- https://mail.python.org/mailman/listinfo/python-list

Password strategy [OT] was: PyPI password rules

2014-08-26 Thread Andrew Berg
On 2014.08.26 01:16, Chris Angelico wrote: > A huge THANK YOU to whoever set the rules for PyPI passwords! You're > allowed to go with a monocase password, as long as it's at least 16 > characters in length. Finally, someone who recognizes XKCD 936 > passwords! > > And yes, I generated an XKCD 936

Re: When does True == True

2014-08-28 Thread Andrew Berg
On 2014.08.28 15:38, Seymore4Head wrote: > What am I doing wrong? >>> True == True True >>> True == "True" False >>> type(True) >>> type("True") Also, if is already a boolean test, and it is more Pythonic to simply write "if pigword.isalpha():". -- https://mail.python.org/mailman/listinfo/pytho

Re: Function passed as an argument returns none

2014-10-01 Thread Andrew Berg
On 2014.10.01 17:37, Shiva wrote: > Only 'None' gets passed on to parameter 'got' instead of the expected value > of 4. > Any idea why 'None' is getting passed even though calling the donuts(4) > alone returns the expected value? donuts() prints what you tell it to ("Number of donuts: 5"), and then

Re: Question About Running Python code

2014-10-16 Thread Andrew Jaffe
On 15/10/2014 23:50, ryguy7272 wrote: The error that I get is this. 'invalid syntax' The second single quote in this line is highlighted pink. print 'Downloading data from Yahoo for %s sector' % sector This is a script written for Python 2.*, but you say you are using Python 3.4. In Python 3,

Re: Python bug in Windows 8--report now, or later?

2011-09-19 Thread Andrew Berg
On 2011.09.19 09:00 AM, Brian Curtin wrote: > You said "the application does not create an app folder in the user's > 'application data' directory" -- what does this mean, or rather, what > is the specific folder you're expecting to have? If Python can't > create the directory but you can do it man

logging.config and {-style formatting

2011-09-19 Thread Andrew Berg
Is it possible to use {-style formatting with a logging config file? I can add style='{' to a logging.Formatter() call and it works fine, but I see no way of doing this from a config file. I tried adding a style option in the config file, but it has no effect. I see no mention of the {-style in the

Odd behavior with imp.reload and logging

2011-09-21 Thread Andrew Berg
When using a logger in a module and then using imp.reload to reload the module, logger messages are repeated in direct proportion to the number of times the modules was loaded. That is, on the first import, the message is written once, but on the second run, each message is written twice, three tim

Re: Odd behavior with imp.reload and logging

2011-09-21 Thread Andrew Berg
On 2011.09.21 08:57 PM, Chris Angelico wrote: > Unfortunately, Python doesn't really like modules to be reloaded. Are > you able to explicitly close the logger before reloading? The reload isn't controlled by the module, but I have no problem clearing out any loggers at the beginning. I'm looking t

Re: Odd behavior with imp.reload and logging

2011-09-21 Thread Andrew Berg
On 2011.09.21 11:22 PM, Steven D'Aprano wrote: > You could > try something like this (untested): That works. Thanks! This makes me wonder what else stays around after a reload and what side effects there are, though. I would really like to purge everything from the previous import. The main progra

Re: Odd behavior with imp.reload and logging

2011-09-21 Thread Andrew Berg
On 2011.09.22 12:09 AM, Chris Angelico wrote: > On-the-fly reloading of modules isn't really one of Python's > strengths. Everyone who asks about it seems to be doing rapid > development/debugging and wanting to save on startup time (as opposed > to, say, running a server and updating code in it wh

Re: Odd behavior with imp.reload and logging

2011-09-22 Thread Andrew Berg
On 2011.09.22 01:46 AM, Chris Angelico wrote: > I think Pike may be a good choice for you. That's quite unappealing for a few reasons. First, that would likely require writing an entirely new bot (I'm not even that familiar with the current one; I've only been writing a module for it). Also, I don'

Re: Odd behavior with imp.reload and logging

2011-09-22 Thread Andrew Berg
On 2011.09.22 03:25 AM, Steven D'Aprano wrote: > Objects left lying around from before the reload will keep references > open to the way things were before the reload. This often leads to > confusion when modules are edited, then reloaded. (Been there, done that.) I'll keep that in mind. My modul

Re: Odd behavior with imp.reload and logging

2011-09-23 Thread Andrew Berg
On 2011.09.22 03:12 AM, Chris Angelico wrote: > In theory, this should mean that you load it fresh every time - I > think. If not, manually deleting entries from sys.modules might help, > either with or without the list of modules. I've played around with sys.modules, and it seems there are issues

Is there any way to access attributes from an imported module?

2011-10-01 Thread Andrew Berg
I'm not sure the subject's wording is the best, but I'll try to explain. I have a main script that imports several modules and I need to be able to call methods from a class instance inside that main script from a module. Currently, functions can be defined to access the methods, but such functions

Re: Is there any way to access attributes from an imported module?

2011-10-02 Thread Andrew Berg
On 2011.10.02 01:55 AM, Steven D'Aprano wrote: > Have I missed something? Why can't you just import the module and call the > methods like you would for any other module and class? > > import module > instance = module.Some_Class() > result = instance.method(some, arguments, may, be, needed) I nee

Re: Is there any way to access attributes from an imported module?

2011-10-02 Thread Andrew Berg
On 2011.10.02 02:11 AM, Gary Herron wrote: > You may be able to do the simplest thing: If a module wants to call > something form the main module (or main script as you call it) just try > importing that main script and call whatever it is you want. This > results in a circular set of imports,

Re: Is there any way to access attributes from an imported module?

2011-10-02 Thread Andrew Berg
I found a way to do it, albeit a very hackish one. Since the class instance already catches exceptions from the modules it imports, I can make a custom exception (in a common area for both it and the submodules to import) for it to catch and have it call its own methods there based on information s

Re: CSV writer question

2011-10-24 Thread Andrew McLean
anteed to happen in other Python implementations (e.g. IronPython, PyPy and Jython). Andrew -- http://mail.python.org/mailman/listinfo/python-list

Creating very similar functions with different parameters

2011-10-24 Thread Andrew Berg
I want to create a decorator with two different (but very similar) versions of the wrapper function, but without copying giant chunks of similar code. The main difference is that one version takes extra parameters. def test_dec(func, extra=False): if extra: def wrapper(ex_p

Re: Need Windows user / developer to help with Pynguin

2011-10-27 Thread Andrew Berg
On 10/27/2011 2:38 PM, Lee Harr wrote: > I am hoping someone can look at what is there and come up with a > reliable method or a simple set of steps that people can follow to get > up and running. Hopefully without having to resort to the command > prompt. > > I started a wiki page here: > http://

Re: Need Windows user / developer to help with Pynguin

2011-10-28 Thread Andrew Berg
On 10/27/2011 5:36 PM, Lee Harr wrote: > What message do you get when trying to download? It said something like "You're trying to download from a forbidden country. That's all we know." Anyway, I was able to get the files. Once everything is set up, it seems to work. I haven't done any serious te

Re: Need Windows user / developer to help with Pynguin

2011-10-29 Thread Andrew Berg
On 10/29/2011 9:43 AM, Lee Harr wrote: > So, windows now creates the dummy folder automatically? That is the default choice, but users are given a prompt to choose an arbitrary directory. Note that this only applies to the ZIP extractor in Explorer; other archive programs have their own behavior. I

Announcing Mii (My) Chat

2011-11-19 Thread Andrew Evans
e for that matter. I am self taught and consider myself a hobbyist programmer. It would be great if some one could suggest a library for TCP Nat Traversal. As well I am open to any and all suggestions! I appreciate any feedback *cheers Andrew Evans Here is the link http://code.google.com/p/mii

Need some IPC pointers

2011-11-30 Thread Andrew Berg
I've done some research, but I'm not sure what's most appropriate for my situation. What I want to do is have a long running process that spawns processes (that aren't necessarily written in Python) and communicates with them. The children can be spawned at any time and communicate at any time. Bei

Re: Need some IPC pointers

2011-11-30 Thread Andrew Berg
On 11/30/2011 3:32 PM, Devin Jeanpierre wrote: > You could also use threads and pipes. (I'm not actually > sure how threads+pipes works, but I'm told that it's a viable > approach). Sounds interesting, but I'm not familiar with threading (not that I wouldn't be willing to learn). Is it even possibl

Re: Need some IPC pointers

2011-11-30 Thread Andrew Berg
On 11/30/2011 10:35 PM, Alec Taylor wrote: > Sure, I'll give you some pointers: I almost rephrased the subject line because I knew someone would make that joke. :P -- CPython 3.2.2 | Windows NT 6.1.7601.17640 | Thunderbird 7.0 -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2 or 3

2011-12-02 Thread Andrew Berg
On 12/2/2011 9:54 PM, Antti J Ylikoski wrote: > What is the opinion of the wizards here, shall I learm Python 2 or > Python 3? I'm posting this here because I feel that this point is > interesting to other students of Python. Unless you are tied to Python 2 in some way, go for Python 3 and don't l

Re: Python 2 or 3

2011-12-02 Thread Andrew Berg
On 12/3/2011 12:23 AM, Terry Reedy wrote: > PyPy has a roadmap for 3.2 > http://pypy.org/py3donate.html > They definitely plan to do it one way or another. I never said there were no plans, but at $2567 out of $60k, I don't see it happening soon. Unless someone decides to donate a huge sum of money

Re: Python 2 or 3

2011-12-02 Thread Andrew Berg
I accidentally quoted the wrong figure. I meant $4369 of $105000. -- CPython 3.2.2 | Windows NT 6.1.7601.17640 | Thunderbird 7.0 -- http://mail.python.org/mailman/listinfo/python-list

Re: Need some IPC pointers

2011-12-06 Thread Andrew Berg
What about named pipes? I don't mind a bit of "if Windows do this, else, do that" as long I'm not coding two or more completely different approaches. I'm not too familiar with named pipes, though; perhaps someone with some experience could chime in. Apparently this didn't go through to Google Gro

Re: I love the decorator in Python!!!

2011-12-08 Thread Andrew Berg
On 12/8/2011 10:38 AM, Chris Angelico wrote: > One piece of sophistication that I would rather like to see, but don't > know how to do. Instead of *args,**kwargs, is it possible to somehow > copy in the function's actual signature? I remember seeing this in a PEP that is planned to be implemented i

Re: I love the decorator in Python!!!

2011-12-08 Thread Andrew Berg
Decorators are great for adding common functionality to several functions without duplicating code. For example, I have one for my IRC bot that checks that the person sending the command is authorized to use the command. It's only "if mask in owner list then execute function else say access denied"

Re: Multiprocessing bug, is information ever omitted from a traceback?

2011-12-10 Thread Andrew Berg
On 12/10/2011 11:53 AM, John Ladasky wrote: > Why did you specify Python 2.7.2, instead of the 2.7.6 version that is > being offered to me by Ubuntu Software Center? Does it matter? There is no Python 2.7.6. I think you have it confused with the version 2.7.2-6. If I'm not mistaken, that appended

Re: subprocess question

2011-12-11 Thread Andrew Berg
On 12/11/2011 10:39 PM, [email protected] wrote: > And another question - why can't I use the tilde as a shortcut to the home > directory? Because subprocess doesn't use the shell (which is what expands the tilde to the invoking user's home directory). I recommend using os.path.join and os.enviro

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-19 Thread Andrew Berg
On 12/18/2011 8:16 PM, Rick Johnson wrote: > On Dec 18, 7:26 pm, Steven D'Aprano [email protected]> wrote: >> Not everybody uses editors more advanced than Notepad. > And they have no excuse for NOT using a better one. Well, except for a > "foolish consistency" that is! But what abou

Re: Getting a patch accepted

2011-12-19 Thread Andrew Berg
On 12/19/2011 3:24 PM, Rick Johnson wrote: > ... > I want to see him mingling with > the masses and manning the trenches. I want to see him shaking hands > and kissing babies! I prefer these over-the-top responses over the more subtle ones. Much more entertaining IMO. -- CPython 3.2.2 | Windows N

Re: the slash & Windows paths

2011-12-19 Thread Andrew Berg
On 12/19/2011 4:02 PM, Juan Declet-Barreto wrote: > I have a Windows-style path that I need to modify so Python functions > can find it. For example, the path > “C:\Projects\Population_Pyramids\charts\test.xls” is being interpreted > as pointing to a file called “est.xls” since the “t” is being esc

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-19 Thread Andrew Berg
On 12/19/2011 7:18 PM, Roy Smith wrote: > Sorry, I wasn't meaning to imply support for the syntax proposal. Just > reacting to the (seemingly unrelated) comment that a customer with > foolish access policies would not be worthy of your business. It was directed at Rick, and by "your", I was refer

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-19 Thread Andrew Berg
On 12/19/2011 9:38 PM, alex23 wrote: > Do you mean directly editing the source code on a production machine? > Because that's pretty much the only scenario I can come up with where > that's plausible. You'd have to ask Steven D'Aprano; it was his scenario. -- CPython 3.2.2 | Windows NT 6.1.7601.1

Why does this launch an infinite loop of new processes?

2011-12-21 Thread Andrew Berg
I am trying to understand the multiprocessing module, and I tried some simple code: import multiprocessing def f(): print('bla bla') p = multiprocessing.Process(target=f) p.start() p.join() And the result is a new process that spawns a new process that spawns a new process ad infinitum un

Re: Why does this launch an infinite loop of new processes?

2011-12-21 Thread Andrew Berg
On 12/21/2011 1:07 PM, Joshua Landau wrote: > Eh? It works for me. Python 3.2 + 2.7 > Is this the full code? That is the full code. -- CPython 3.2.2 | Windows NT 6.1.7601.17640 | Thunderbird 7.0 -- http://mail.python.org/mailman/listinfo/python-list

Re: Why does this launch an infinite loop of new processes?

2011-12-21 Thread Andrew Berg
On 12/21/2011 1:29 PM, Ethan Furman wrote: > Anything that runs at import time should be protected by the `if > __name__ == '__main__'` idiom as the children will import the __main__ > module. So the child imports the parent and runs the spawn code again? That makes sense. -- CPython 3.2.2 | Wi

IPC with multiprocessing.connection

2011-12-22 Thread Andrew Berg
I'm trying to set up a system where my main program launches external programs and then establishes connections to them via named pipes or Unix domain sockets (depending on platform) with multiprocessing.connection.Listener. The issue I'm having is with the accept() method. If there is nothing on t

Re: Can't I define a decorator in a separate file and import it?

2011-12-22 Thread Andrew Berg
You have the same code for both files... -- http://mail.python.org/mailman/listinfo/python-list

Re: IPC with multiprocessing.connection

2011-12-23 Thread Andrew Berg
On 12/23/2011 2:32 AM, Deepak Babu wrote: See if http://www.rsdcbabu.com/2011/02/multiprocessing-with-python.htmlhelps you. It doesn't. There is not even a mention of the connection submodule (plus it's Python 2, and I'm familiar enough with Python 2 to do a good job of porting to py3k). I don'

Re: IPC with multiprocessing.connection

2011-12-23 Thread Andrew Berg
On 12/23/2011 5:50 AM, bobicanprogram wrote: You might want to check out the code samples at: http://www.icanprogram.com/06py/lesson1/lesson1.html Let's see, I asked about a method in the multiprocessing module, and you recommend code snippets that run on Python versions that don't even have th

Re: Python education survey

2011-12-27 Thread Andrew Berg
On 12/27/2011 11:59 AM, K Richard Pixley wrote: You'd do better to encourage eclipse, but setting that up isn't trivial either. IIRC, all I had to do to set up PyDev was copy a URL to Eclipse's "Install New Software" wizard, and have Eclipse download and install it. Extra steps are needed if a

Re: Python education survey

2011-12-27 Thread Andrew Berg
On 12/27/2011 4:04 PM, K Richard Pixley wrote: You still need to match versions of PyDev to versions of Eclipse to versions of operating system to versions of other eclipse plugins. I spent a few days trying to get it together once and came to the conclusion that it was a much bigger effort than

Re: RSA and Cryptography in PYTHON

2011-12-28 Thread Andrew Berg
On 12/27/2011 5:45 PM, 8 Dihedral wrote: I am getting lousy in the news group in my writing? I mean the non-trivial decoding of the key decomposition. Of course RSA is symmetric in encoding and decoding of data. You really are a markov chain bot. -- CPython 3.2.2 | Windows NT 6.1.7601.1764

Re: .format vs. %

2011-12-31 Thread Andrew Berg
On 12/31/2011 12:19 PM, davidfx wrote: > Should we always be using .format() for formatting strings or %? In new code, yes. %-style formatting will eventually go away, but probably not for a long time. > If I wanted to put .format into a variable, how would I do that. What do you mean? -- CPytho

Re: Python education survey

2011-12-31 Thread Andrew Berg
On 12/31/2011 1:06 PM, Alexander Kapps wrote: > xkcd/386 has been the excuse for replying to RR for ages and I still > don't understand why he gets that much advertence. Charity? Sympathy > for the lone and broken? > > FWIW, it undermines all my attempts to block him. Sigh. Do what I do: laugh a

Re: .format vs. %

2012-01-03 Thread Andrew Berg
On 1/2/2012 11:58 PM, Ian Kelly wrote: > I can't believe I'm taking Rick's side here, but the docs do say: > > "Note: The formatting operations described here are obsolete and may > go away in future versions of Python. Use the new String Formatting in > new code." > > http://docs.python.org/py3k

Re: import issue with classes

2012-01-03 Thread Andrew Berg
On 1/3/2012 8:50 PM, Rodrick Brown wrote: > Import FooA doesn't work and I need to use from FooA import FooA > instead? This puzzles me. > Thanks. If you have a module called FooA with a class called FooA, then import FooA imports the /module/. The class would be FooA.FooA, just as the variable x

Re: help me get excited about python 3

2012-01-04 Thread Andrew Berg
On 1/4/2012 9:56 AM, Sean Wolfe wrote: > I am still living in the 2.x world because all the things I want to do > right now in python are in 2 (django, pygame). But I want to be > excited about the future of the language. I understand the concept of > needing to break backwards compatibility. But i

Re: Getting involved

2012-01-07 Thread Andrew Berg
On 1/7/2012 4:59 AM, Sophie Sperner wrote: > Could you please list me 2 or 3 projects in Python and/or Java which > are currently active (vivid) and useful? If you really want to mix Python and Java, you could help the Jython project update to 3.x. One thing the Python community as a whole could re

Re: Trouble with internationalized path under windows

2012-01-22 Thread Andrew Berg
On 1/22/2012 2:08 PM, Jacob Hallén wrote: > Am using WIndows 7 with a Swedish locale. The program uses Unicode > successfully internally, and the Windows help says that the locale only > applies to non-Unicode programs. I have tried with using characters from the > Latin-1 character set in the p

multi-result set MySQLdb queries.

2013-02-07 Thread Andrew Robinson
Hi, I'm being forced to use "import MySQLdb" to access a serverand am not getting all my data back. I'm trying to send multiple queries all at once (for time reasons) and then extract the rows in bulk. The queries have different number of columns; For a contrived example; script.db.query

Re: call from pthon to shell

2013-02-12 Thread Andrew Robinson
On 02/12/2013 05:38 AM, Bqsj Sjbq wrote: >>> import os >>> os.system("i=3") 0 >>> os.system("echo $i") 0 why i can not get the value of i? First: os.system is only defined to give the return value (exit code) of the sub-process. However, one way to get the output of shell commands is to u

Re: UnicodeEncodeError when not running script from IDE

2013-02-12 Thread Andrew Berg
On 2013.02.12 04:43, Magnus Pettersson wrote: > I am using Eclipse to write my python scripts and when i run them from inside > eclipse they work fine without errors. > > But almost in every script that handle some form of special characters like > swedish åäö and chinese characters etc i get U

Re: Calendar module question

2013-02-17 Thread Andrew Berg
On 2013.02.17 01:47, Phil wrote: > Why would this code work under the Wing IDE and nowhere else? Could > there be a different calendar module included with Wing? > > import calendar > > cal = calendar.prcal(2013) > print cal > > Traceback (most recent call last): >File "calendar.py", line 1

Re: Quick IDE Question

2013-02-17 Thread Andrew Berg
On 2013.02.17 18:38, Claira wrote: > Ok, thanks brilliant people! I can't really keep up with the > conversation about where I should ask since I check my email once a > week, though the quick question I had was that I heard lighttable.com > was an innovative IDE, and since

Re: FYI: AI-programmer

2013-02-22 Thread Andrew Robinson
On 02/22/2013 07:21 PM, Ian Kelly wrote: On Fri, Feb 22, 2013 at 4:41 AM, Chris Angelico wrote: That's not artificial intelligence, though. It's artificial program generation based on a known target output. The "Fitness" calculation is based on a specific target string. This is fine for devisin

Re: FYI: AI-programmer

2013-02-22 Thread Andrew Robinson
On 02/22/2013 08:23 PM, Ian Kelly wrote: On Fri, Feb 22, 2013 at 5:09 AM, Andrew Robinson wrote: On 02/22/2013 07:21 PM, Ian Kelly wrote: I am curious about how he deals with infinite loops in the generated programs. Probably he just kills the threads after they pass some time threshold

Re: Altering sys.stdin

2013-02-23 Thread Andrew Berg
On 2013.02.23 07:00, Draic Kin wrote: > Intepreter actually freezes when an object without > encoding attribute is assigned to sys.stdin. Why is that? I that a > correct behavior? Is there any workaround to alter input object for > interactive console? If you're going to replace something, the rep

Re: Suggested feature: slice syntax within tuples (or even more generally)?

2013-02-25 Thread Andrew Robinson
On 02/14/2013 05:23 AM, Terry Reedy wrote: On 2/13/2013 2:00 PM, [email protected] wrote: Hello, Would it be feasible to modify the Python grammar to allow ':' to generate slice objects everywhere rather than just indexers and top-level tuples of indexers? Right now in Py2.7, Py3.3:

Re: Suggested feature: slice syntax within tuples (or even more generally)?

2013-02-25 Thread Andrew Robinson
Errata, I made a tyepopeo in the middle of the night: eg:"""Python evaluates right to left; this is semantically an iterator giving a[1],a[2],a[5],a[11]""" Sigh: Python Iterates from left to right; --Andrew. -- http://mail.python.org/mailman/listinfo/python-list

Re: Suggested feature: slice syntax within tuples (or even more generally)?

2013-02-25 Thread Andrew Robinson
On 02/25/2013 10:28 AM, Ian Kelly wrote: On Sun, Feb 24, 2013 at 6:10 PM, Andrew Robinson wrote: I've read through the whole of the subject, and the answer is no, although I think allowing it in (::) is a *very* good idea, including as a replacement for range or xrange. s=1:2:3 for i

Re: Suggested feature: slice syntax within tuples (or even more generally)?

2013-02-25 Thread Andrew Robinson
On 02/25/2013 04:54 PM, Ian Kelly wrote: On Mon, Feb 25, 2013 at 12:41 AM, Andrew Robinson wrote: Intuitively, it should result in an infinite loop starting at 0. But ranges require a stop value for a very good reason -- it should not be this easy to accidentally create an infinite for loop

Re: Do you feel bad because of the Python docs?

2013-02-26 Thread Andrew Berg
On 2013.02.26 10:19, notbob wrote: > zsh? What docs!? You mean other than the gigantic user manual? http://zsh.sourceforge.net/Doc/ -- CPython 3.3.0 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list

Re: Python script not working on windows 7 but works fine on linux

2013-03-04 Thread Andrew Berg
On 2013.03.04 19:58, Steven D'Aprano wrote: > Windows understands forward slashes in paths too. You can make your code > (almost) platform-independent, and avoid a lot of problems with unescaped > backslashes, by always using forward slashes in paths. Or use os.path.join, the entire purpose of wh

Re: Unhelpful traceback

2013-03-06 Thread Andrew Berg
On 2013.03.07 00:33, John Nagle wrote: > This is wierd, becuase "for fields in reader" isn't directly > doing a decode. That's further down somewhere, and the backtrace > didn't tell me where. Looking at the csv module docs,the reader object iterates over the csvfile argument (which can be any iter

Re: http://stackoverflow.com/questions/15311450/my-chat-client-freezes-up-after-beginning-threads

2013-03-09 Thread Andrew Berg
On 2013.03.09 09:26, Owatch wrote: > Thing is, when I run the program. Nothing happens. > > Can somebody help point out what is wrong? (I've asked questions and > researched for 3 days, without getting anywhere, so I did try) You defined a thread, but never created or started it. Also, why did y

<    4   5   6   7   8   9   10   11   12   13   >