Pyglet being extremely slow

2010-07-19 Thread Joshua Landau
I've just tried Pyglet on my computer, a lower-end laptop at that, and going though the Pyglet tutorials I've tried this: import pyglet window = pyglet.window.Window() @window.event def on_key_press(symbol, modifiers): print 'A key was pressed' @window.event def on_draw():

Re: Beginner. 2d rotation gives unexpected results.

2013-07-24 Thread Joshua Landau
On 23 July 2013 13:34, en...@yandex.ru wrote: Hello! This is my first post, nice to meet you all! I`m biology student from Russia, trying to learn python to perform some simple simulations. Here`s my first problem. I`m trying to perform some simple 2d vector rotations in pygame, in order

Re: Critic my module

2013-07-25 Thread Joshua Landau
On 25 July 2013 14:24, Devyn Collier Johnson devyncjohn...@gmail.comwrote: Aloha Python Users! I made a Python3 module that allows users to use certain Linux shell commands from Python3 more easily than using os.system(), subprocess.Popen(), or subprocess.getoutput(). This module (once

Re: Critic my module

2013-07-26 Thread Joshua Landau
On 26 July 2013 16:08, Alister alister.w...@ntlworld.com wrote: The main point of this is for shell users that are using Python and do not know some of the Python commands. This module would make Python more like a Linux shell. For instance, a shell user would type boash.uname() because

Re: RE Module Performance

2013-07-28 Thread Joshua Landau
On 28 July 2013 09:45, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: Op 27-07-13 20:21, wxjmfa...@gmail.com schreef: utf-8 or any (utf) never need and never spend their time in reencoding. So? That python sometimes needs to do some kind of background processing is not a problem,

Re: RE Module Performance

2013-07-28 Thread Joshua Landau
On 28 July 2013 19:29, Chris Angelico ros...@gmail.com wrote: On Sun, Jul 28, 2013 at 7:19 PM, Joshua Landau jos...@landau.ws wrote: On 28 July 2013 09:45, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: Op 27-07-13 20:21, wxjmfa...@gmail.com schreef: utf-8 or any (utf) never need

Re: collections.Counter surprisingly slow

2013-07-29 Thread Joshua Landau
On 29 July 2013 07:25, Serhiy Storchaka storch...@gmail.com wrote: 28.07.13 22:59, Roy Smith написав(ла): The input is an 8.8 Mbyte file containing about 570,000 lines (11,000 unique strings). Repeat you tests with totally unique lines. Counter is about ½ the speed of defaultdict in

Re: collections.Counter surprisingly slow

2013-07-29 Thread Joshua Landau
On 29 July 2013 12:46, Stefan Behnel stefan...@behnel.de wrote: Steven D'Aprano, 28.07.2013 22:51: Calling Counter ends up calling essentially this code: for elem in iterable: self[elem] = self.get(elem, 0) + 1 (although micro-optimized), where iterable is your data (lines).

Re: Critic my module

2013-07-29 Thread Joshua Landau
On 29 July 2013 19:36, Lele Gaifax l...@metapensiero.it wrote: This thread did not mention alternative and existing modules with (almost) the same goal, two come to mind: * https://pypi.python.org/pypi/sh * https://pypi.python.org/pypi/sarge Actually, I noted both those and plumbum. --

Re: PEP8 79 char max

2013-07-29 Thread Joshua Landau
On 29 July 2013 22:18, Skip Montanaro s...@pobox.com wrote: For the purposes of limiting the length you need to scan between first and last column, I would recommend leaving the recommended line length to ~ 80 columns. Just for grins, I grabbed a non-computer book, Atul Gawande's Checklist

Re: PEP8 79 char max

2013-07-29 Thread Joshua Landau
On 29 July 2013 22:34, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Mon, 29 Jul 2013 15:18:59 -0500, Ed Leafe wrote: On Jul 29, 2013, at 3:08 PM, Joel Goldstick joel.goldst...@gmail.com wrote: Not performance, but human readability IMO, this isn't always the

Re: import syntax

2013-07-29 Thread Joshua Landau
On 29 July 2013 21:23, Devyn Collier Johnson devyncjohn...@gmail.comwrote: On 07/29/2013 04:20 PM, Tim Chase wrote: On 2013-07-29 16:09, Dave Angel wrote: On 07/29/2013 03:48 PM, Devyn Collier Johnson wrote: The PEP8 recommends importing like this: import os import re not like this:

Re: Has anyone gotten Pyglet to work

2013-07-29 Thread Joshua Landau
On 29 July 2013 23:22, Devyn Collier Johnson devyncjohn...@gmail.comwrote: Duh, thanks for the tip (^u^), but I still get an error (different error). NOTE: this is all python2.7 code because Pyglet supposedly has issues with Python3. collier@Nacho-Laptop:~$ pip install pyglet

Re: Pyglet on Python3.x, problems

2013-07-29 Thread Joshua Landau
On 29 July 2013 23:04, John Ladasky john_lada...@sbcglobal.net wrote: For whatever reason, the pyglet package is getting a lot of attention on c.l.python these past few days. I am guilty of generating some of that potentially off-topic conversation myself. At the end of my last thread, I

Re: PEP8 79 char max

2013-07-29 Thread Joshua Landau
On 30 July 2013 00:08, Rhodri James rho...@wildebst.demon.co.uk wrote: On Mon, 29 Jul 2013 22:09:10 +0100, Steven D'Aprano steve+comp.lang.python@**pearwood.infosteve%2bcomp.lang.pyt...@pearwood.info wrote: On Mon, 29 Jul 2013 15:43:49 -0400, Devyn Collier Johnson wrote: In Python

Re: PEP8 79 char max

2013-07-29 Thread Joshua Landau
On 30 July 2013 01:41, Rhodri James rho...@wildebst.demon.co.uk wrote: On Tue, 30 Jul 2013 01:11:18 +0100, Joshua Landau jos...@landau.ws wrote: On 30 July 2013 00:08, Rhodri James rho...@wildebst.demon.co.uk wrote: I'm working on some shonky C code at the moment that inconsistent

Re: PEP8 79 char max

2013-07-30 Thread Joshua Landau
On 30 July 2013 16:44, Skip Montanaro s...@pobox.com wrote: So if everyone basically follows PEP8 we all benefit from playing by the same game rules, as it were. (I think I'm agreeing with you, but nonetheless, I will forge ahead.) To the extent that 80-column window widths have been

Re: RE Module Performance

2013-07-30 Thread Joshua Landau
On 30 July 2013 17:39, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: Op 30-07-13 18:13, MRAB schreef: On 30/07/2013 15:38, Antoon Pardon wrote: Op 30-07-13 16:01, wxjmfa...@gmail.com schreef: I am pretty sure that once you have typed your 127504 ascii characters, you are very happy

Re: PEP8 79 char max

2013-07-30 Thread Joshua Landau
On 30 July 2013 18:08, Vito De Tullio vito.detul...@gmail.com wrote: Ed Leafe wrote: I had read about a developer who switched to using proportional fonts for coding, and somewhat skeptically, tried it out. After a day or so it stopped looking strange, and after a week it seemed so much

Re: PEP8 79 char max

2013-07-31 Thread Joshua Landau
On 30 July 2013 18:52, Grant Edwards invalid@invalid.invalid wrote: On 2013-07-30, Joshua Landau jos...@landau.ws wrote: On 30 July 2013 18:08, Vito De Tullio vito.detul...@gmail.com wrote: Ed Leafe wrote: I had read about a developer who switched to using proportional fonts

Re: Python script help

2013-07-31 Thread Joshua Landau
On 30 July 2013 22:47, Cameron Simpson c...@zip.com.au wrote: On 30Jul2013 09:12, cool1...@gmail.com cool1...@gmail.com wrote: | ** urlib, urlib2 Sure. And I'd use BeautifulSoup to do the parse. You'll need to fetch that. So: urllib[2] to fetch the document and BS to parse it for links,

Re: PEP8 79 char max

2013-08-01 Thread Joshua Landau
On 31 July 2013 17:32, Grant Edwards invalid@invalid.invalid wrote: On 2013-07-31, Tim Chase python.l...@tim.thechases.com wrote: On 2013-07-31 07:16, Joshua Landau wrote: On 30 July 2013 18:52, Grant Edwards wrote: I also find intializers for tables of data to be much more easily read

Re: Python: Code is ignoring the if and else

2013-08-02 Thread Joshua Landau
On 3 August 2013 02:44, kevin4f...@gmail.com wrote: Yeah, I already know about that. But if I try to change it, I'm not even able to start the program. If I try to change the if statement that it corresponds with, I get a an error saying card is not a global. And if I try to shift it in, for

Re: PEP8 revised: max line lengths

2013-08-02 Thread Joshua Landau
On 2 August 2013 22:34, Chris Angelico ros...@gmail.com wrote: On Fri, Aug 2, 2013 at 10:15 PM, wxjmfa...@gmail.com wrote: Problem #3 cm or inch? The only serious unit is an SI unit. (In scientific publications, only SI units are accepted) The cm is not a primary SI unit either. But

Re: [argparse] mutually exclusive group with 2 sets of options

2013-08-04 Thread Joshua Landau
On 5 August 2013 03:05, Francois Lafont francois.lafont@nospam.invalidwrote: Hello, Up. ;-) Le 04/08/2013 04:10, Francois Lafont a écrit : Is it possible with argparse to have this syntax for a script? my-script (-a -b VALUE-B | -c -d VALUE-D) I would like to do this with the

Re: Hangman question

2013-08-05 Thread Joshua Landau
On 5 August 2013 06:11, eschneide...@comcast.net wrote: I'm on chapter 9 of this guide to python: http://inventwithpython.com/chapter9.html but I don't quite understand why line 79 is what it is (blanks = blanks[:i] + secretWord[i] + blanks[i+1:]). I particularly don't get the [i+1:]

Re: Creating a running tally/ definitely new to this

2013-08-05 Thread Joshua Landau
On 6 August 2013 02:01, gratedme...@gmail.com wrote: I currently working on a game, where I need to maintain a running tally of money, as the player makes purchases as they navigate thru game. I not exactly sure how to do this in python. I know it is a fairly basic step, nonetheless. Any

Re: Sort lines in a plain text file alphanumerically

2013-08-05 Thread Joshua Landau
On 6 August 2013 03:00, Devyn Collier Johnson devyncjohn...@gmail.comwrote: I am wanting to sort a plain text file alphanumerically by the lines. I have tried this code, but I get an error. I assume this command does not accept newline characters. HINT #1: Don't assume that without a reason.

Re: Newbie: static typing?

2013-08-06 Thread Joshua Landau
On 6 August 2013 10:01, Rui Maciel rui.mac...@gmail.com wrote: Ben Finney wrote: Rui Maciel rui.mac...@gmail.com writes: Is there any pythonic way to perform static typing? I think no; static typing is inherently un-Pythonic. Python provides strong, dynamic typing. Enjoy it! Bummer.

Re: Newbie: static typing?

2013-08-06 Thread Joshua Landau
On 6 August 2013 10:05, Rui Maciel rui.mac...@gmail.com wrote: Gary Herron wrote: The Pythonic way is to *enjoy* the freedom and flexibility and power of dynamic typing. If you are stepping out of a static typing language into Python, don't step just half way. Embrace dynamic typing. (Like

Re: Sort lines in a plain text file alphanumerically

2013-08-06 Thread Joshua Landau
On 6 August 2013 11:52, Chris Angelico ros...@gmail.com wrote: On Tue, Aug 6, 2013 at 11:38 AM, Devyn Collier Johnson devyncjohn...@gmail.com wrote: with open('/home/collier/pytest/sort.TXT') as file: sorted(file, key=str.casefold, reverse=True) Thanks for the advice Joshua. I

Re: new to While statements

2013-08-06 Thread Joshua Landau
On 7 August 2013 04:38, krismesenbr...@gmail.com wrote: import random def room (): No need for the space after room. hp = 10 while hp != 0: while hp: would be idiomatic, but you probably want while hp 0 if you allow negatives. random_Number = random.randint(1, 2) You

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Joshua Landau
On 6 August 2013 20:42, Luca Cerone luca.cer...@gmail.com wrote: Hi Chris, thanks Do you ever instantiate any A() objects? You're attempting to call an unbound method without passing it a 'self'. I have tried a lot of variations, instantiating the object, creating lambda functions that

Re: beginner question (True False help)

2013-08-07 Thread Joshua Landau
On 7 August 2013 09:17, eschneide...@comcast.net wrote: I'm trying to create an option for the program to repeat if the user types 'y' or 'yes', using true and false values, or otherwise end the program. If anyone could explain to me how to get this code working, I'd appreciate it. Always

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Joshua Landau
On 7 August 2013 09:33, Luca Cerone luca.cer...@gmail.com wrote: To correct my example: from multiprocessing import Pool class A(object): def __init__(self,x): self.value = x def fun(self,x): return self.value**x l = range(100) p = Pool(4) op = p.map(A(3).fun,

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Joshua Landau
On 7 August 2013 11:10, Luca Cerone luca.cer...@gmail.com wrote: I can't try it now, I'll let you know later if it works! (Though just by reading I can't really understand what the code does). Well, from multiprocessing import Pool from functools import partial class A(object): def

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Joshua Landau
On 7 August 2013 15:46, Peter Otten __pete...@web.de wrote: import copy_reg import multiprocessing import new new is deprecated from 2.6+; use types.MethodType instead of new.instancemethod. def make_instancemethod(inst, methodname): return getattr(inst, methodname) This is just

Re: Creating a running tally/ definitely new to this

2013-08-07 Thread Joshua Landau
On 6 August 2013 16:24, gratedme...@gmail.com wrote: On Monday, August 5, 2013 10:15:30 PM UTC-4, Dave Angel wrote: gratedme...@gmail.com wrote: I currently working on a game, where I need to maintain a running tally of money, as the player makes purchases as they navigate thru game. I

Re: make elements of a list twice or more.

2013-08-07 Thread Joshua Landau
On 7 August 2013 17:59, Peter Otten __pete...@web.de wrote: liuerfire Wang wrote: Here is a list x = [b, a, c] (a, b, c are elements of x. Each of them are different type). Now I wanna generate a new list as [b, b, a, a, c, c]. I know we can do like that: tmp = [] for i in x:

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Joshua Landau
On 7 August 2013 23:26, Luca Cerone luca.cer...@gmail.com wrote: Thanks for the post. I actually don't know exactly what can and can't be pickles.. I just try it and see what works ;). The general idea is that if it is module-level it can be pickled and if it is defined inside of something

Re: Suggestion: PEP for popping slices from lists

2013-08-08 Thread Joshua Landau
On 8 August 2013 21:03, Terry Reedy tjre...@udel.edu wrote: If .pop were being added today, I would argue against including the index parameter. GASP! That's no fair! 1) When using pop you normally want to keep the mutability available, so iter(mylist) is a no-go. 2) When using the index, it's

Re: beginner question (True False help)

2013-08-09 Thread Joshua Landau
On 9 August 2013 23:27, eschneide...@comcast.net wrote: This is what I ended up with btw. Does this insult anyone's more well attuned Python sensibilities? ... Yes. You didn't listen to any of the advice we've been giving you. You've had *much* better answers given than this. Start from

Re: beginner question (True False help)

2013-08-09 Thread Joshua Landau
On 10 August 2013 00:14, eschneide...@comcast.net wrote: I don't understand any of the advice any of you have given. What about it don't you understand? Pick a sentence you don't understand and throw it back at us. If you understand all the sentences but not how they come together, say so. If

Re: beginner question (True False help)

2013-08-09 Thread Joshua Landau
On 10 August 2013 00:34, eschneide...@comcast.net wrote: What does global mean? Python has scopes for its variables. Most programming languages do. A scope is a restriction on where variables exist -- they exist only within the scope. This can be seen in this example: def function():

Re: Get filename using filefialog.askfilename

2013-08-10 Thread Joshua Landau
On 10 August 2013 11:37, cheirasa...@gmail.com wrote: Sarcastic what the kcuf ¿?¿?¿? My english is SO bad? Do you know me? I can not understand this paranoia i only was giving thanks. Sarcasm and a lack thereof is very hard to see over the Internet. It's probably just a

Re: Python Basic Doubt

2013-08-10 Thread Joshua Landau
On 11 August 2013 04:43, Chris Angelico ros...@gmail.com wrote: On Sun, Aug 11, 2013 at 4:21 AM, Gary Herron gary.her...@islandtraining.com wrote: On 08/10/2013 06:00 PM, Chris Angelico wrote: All it takes is a slightly odd or buggy __eq__ implementation and the == versions will misbehave. To

Re: Paramiko Help. Execute command to Interactive Shell which is opened by SSHClient()

2013-08-11 Thread Joshua Landau
On 11 August 2013 06:18, sagar varule sagar.var...@gmail.com wrote: Can any one comment on this.. If you don't get replies here it's probably because no-one knows Paramiko. I suggest posting elsewhere to see if there are any Paramiko users in other places willing to help. There might be a

Could you verify this, Oh Great Unicode Experts of the Python-List?

2013-08-11 Thread Joshua Landau
Basically, I think Twitter's broken. For my full discusion on the matter, see: http://www.reddit.com/r/learnpython/comments/1k2yrn/help_with_len_and_input_function_33/cbku5e8 Here's the first post of mine, ineffectually edited for this list: strikethroughThe obvious solution [to getting the

Re: Paramiko Help. Execute command to Interactive Shell which is opened by SSHClient()

2013-08-11 Thread Joshua Landau
On 11 August 2013 08:02, sagar varule sagar.var...@gmail.com wrote: On Sunday, August 11, 2013 11:28:31 AM UTC+5:30, Joshua Landau wrote: You also didn't say what didn't work with the first block of code. Submitting Command to Interactive Shell through code did not work. In what way didn't

Re: Could you verify this, Oh Great Unicode Experts of the Python-List?

2013-08-11 Thread Joshua Landau
07:17:42 +0100, Joshua Landau wrote: So the solution is: import unicodedata len(unicodedata.normalize(NFC, tweet)) 4 In this particular case, this will reduce the tweet to the normalised form that Twitter uses. [...] After further testing (I don't actually use Twitter

Re: Could you verify this, Oh Great Unicode Experts of the Python-List?

2013-08-11 Thread Joshua Landau
On 11 August 2013 07:24, Chris Angelico ros...@gmail.com wrote: On Sun, Aug 11, 2013 at 7:17 AM, Joshua Landau jos...@landau.ws wrote: Given tweet = bcaf\x65\xCC\x81.decode(): tweet 'café' But: len(tweet) 5 You're now looking at the difference between glyphs

Re: Paramiko Help. Execute command to Interactive Shell which is opened by SSHClient()

2013-08-11 Thread Joshua Landau
On 11 August 2013 09:57, Chris Angelico ros...@gmail.com wrote: On Thu, Aug 8, 2013 at 8:20 AM, sagar varule sagar.var...@gmail.com wrote: stdin, stdout, stderr = client.exec_command(bv_cmd) for line in stderr.readlines(): print line for line in

Re: Am I not seeing the Error?

2013-08-11 Thread Joshua Landau
On 11 August 2013 09:28, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: into more lines. Why is all that in a single line? The only good excuse for writing multiple statements on a single line separated by semi-colons is if the Enter key on your keyboard is broken. That's not a

Re: Could you verify this, Oh Great Unicode Experts of the Python-List?

2013-08-11 Thread Joshua Landau
On 11 August 2013 12:14, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sun, 11 Aug 2013 10:44:40 +0100, Joshua Landau wrote: On 11 August 2013 10:09, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: The reason some accented letters have single code point forms

Re: Could you verify this, Oh Great Unicode Experts of the Python-List?

2013-08-11 Thread Joshua Landau
On 11 August 2013 13:51, wxjmfa...@gmail.com wrote: Le dimanche 11 août 2013 11:09:44 UTC+2, Steven D'Aprano a écrit : On Sun, 11 Aug 2013 07:17:42 +0100, Joshua Landau wrote: The reason some accented letters have single code point forms is to support legacy charsets; ... No. jmf PS

Re: Am I not seeing the Error?

2013-08-13 Thread Joshua Landau
On 12 August 2013 16:47, Roy Smith r...@panix.com wrote: I can't quite sort out the multiple quoting levels, but somebody said: Programming like that is called trolling. A programmer that uses trolling is called a troll. A troll can also refer to such a line of code itself. My scripts contain

Re: Could you verify this, Oh Great Unicode Experts of the Python-List?

2013-08-13 Thread Joshua Landau
On 11 August 2013 12:14, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sun, 11 Aug 2013 10:44:40 +0100, Joshua Landau wrote: café will be in your Copy-Paste buffer, and you can paste it in to the tweet-box. It takes 5 characters. So much for testing ;). How do you know

Re: Am I not seeing the Error?

2013-08-14 Thread Joshua Landau
On 14 August 2013 02:20, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: Ned Batchelder wrote: Everyone: this program seems to be a direct and misguided transliteration from a bash script. Not a particularly well-written bash script, either -- it's full of superfluous uses of 'cat'.

Re: .split() Qeustion

2013-08-14 Thread Joshua Landau
On 14 August 2013 09:30, Alister alister.w...@ntlworld.com wrote: On Tue, 13 Aug 2013 22:12:56 -0700, Gary Herron wrote: On 08/13/2013 09:51 PM, eschneide...@comcast.net wrote: How can I use the '.split()' method (am I right in calling it a method?) without instead of writing each comma

Re: .split() Qeustion

2013-08-14 Thread Joshua Landau
On 14 August 2013 12:45, Peter Otten __pete...@web.de wrote: Joshua Landau wrote: On 14 August 2013 09:30, Alister alister.w...@ntlworld.com wrote: I would agree with the last statement. Please write list definitions as lists rather than taking a short-cut to save a few key presses That's

Re: Am I not seeing the Error?

2013-08-14 Thread Joshua Landau
On 14 August 2013 13:07, Chris Angelico ros...@gmail.com wrote: On Wed, Aug 14, 2013 at 7:59 AM, Joshua Landau jos...@landau.ws wrote: What's wrong with cat? Sure it's superfluous but what makes it *bad*? Personally I often prefer the pipe cat x | y form to x y... or y x. What's the use

Re: .split() Qeustion

2013-08-15 Thread Joshua Landau
On 15 August 2013 16:43, Chris Angelico ros...@gmail.com wrote: A mole is as much a number (6e23) as the light year is a number (9.5e15). A mole is a number. A light year is a unit. -- http://mail.python.org/mailman/listinfo/python-list

Re: .split() Qeustion

2013-08-15 Thread Joshua Landau
On 15 August 2013 19:28, Chris Angelico ros...@gmail.com wrote: On Thu, Aug 15, 2013 at 5:54 PM, Joshua Landau jos...@landau.ws wrote: On 15 August 2013 16:43, Chris Angelico ros...@gmail.com wrote: A mole is as much a number (6e23) as the light year is a number (9.5e15). A mole is a number

Re: Check for the type of arguments

2013-08-17 Thread Joshua Landau
On 17 August 2013 13:34, Fernando Saldanha fsald...@gmail.com wrote: I am new to Python, with some experience in Java, C++ and R. Writing in other languages I usually check the type and values of function arguments. In the Python code examples I have seen this is rarely done. Questions:

Re: Encapsulation unpythonic?

2013-08-18 Thread Joshua Landau
On 17 August 2013 17:17, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sat, 17 Aug 2013 05:26:32 -0700, fsaldan1 wrote: how do I deal with the fact that other programmers can easily alter the values of members of my classes? ... If they insist on messing with your private

Re: Checking homogeneity of Array using List in Python

2013-08-26 Thread Joshua Landau
On 26 August 2013 14:49, Neil Cerutti ne...@norwich.edu wrote: On 2013-08-25, sahil301...@gmail.com sahil301...@gmail.com wrote: eg. my input is ['1', ' ', 'asdasd231231', '1213asasd', '43242'] I want it to be interpreted as: [1, [None], [None], [None], 43242] NOTE: NO INBUILT FUNCTION BE

Re: print function and unwanted trailing space

2013-08-31 Thread Joshua Landau
On 31 August 2013 23:08, Chris Angelico ros...@gmail.com wrote: On Sun, Sep 1, 2013 at 1:43 AM, Oscar Benjamin oscar.j.benja...@gmail.com wrote: On 31 August 2013 16:30, Chris Angelico ros...@gmail.com wrote: but doesn't solve all the cases (imagine a string or an iterator). Similar but

Re: Interface and duck typing woes

2013-08-31 Thread Joshua Landau
On 31 August 2013 01:13, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Fri, 30 Aug 2013 06:35:47 -0400, Roy Smith wrote: In article 52200699$0$6599$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: These days, it would be

Re: Language design

2013-09-11 Thread Joshua Landau
On 11 September 2013 11:38, Burak Arslan burak.ars...@arskom.com.tr wrote: On 09/10/13 09:09, Steven D'Aprano wrote: What design mistakes, traps or gotchas do you think Python has? My favourite gotcha is this: elt, = elts It's a nice and compact way to do both: assert len(elts)

Re: better and user friendly IDE recommended?

2013-09-12 Thread Joshua Landau
On 12 September 2013 00:44, Ben Finney ben+pyt...@benfinney.id.au wrote: mnish1...@gmail.com writes: My main advice: Avoid non-free (that is, proprietary) software for your development tools. Learning a set of development tools is a significant investment, and you should not tie that

Re: better and user friendly IDE recommended?

2013-09-12 Thread Joshua Landau
On 12 September 2013 09:04, Ben Finney ben+pyt...@benfinney.id.au wrote: Joshua Landau jos...@landau.ws writes: On 12 September 2013 00:44, Ben Finney ben+pyt...@benfinney.id.au wrote: mnish1...@gmail.com writes: My main advice: Avoid non-free (that is, proprietary) software for your

Re: better and user friendly IDE recommended?

2013-09-15 Thread Joshua Landau
On 12 September 2013 16:47, Paul Rudin paul.nos...@rudin.co.uk wrote: Joshua Landau jos...@landau.ws writes: If the time learning a set of tools is enough to make the choice between tools, I suggest avoiding, say, Vim. That's a big if. If you expect to spend a lot of time editing text

Re: Having both if() and for() statements in one liner

2013-09-17 Thread Joshua Landau
On 18 September 2013 03:10, Steven D'Aprano st...@pearwood.info wrote: On Tue, 17 Sep 2013 18:54:51 +, Dave Angel wrote: for times in range(0, 5 if person==George else 0): Oh that is evil. Truly evil. Thank you, I will treasure that piece of code forever. range(person == simon and 5)

Re: iterating over a file with two pointers

2013-09-19 Thread Joshua Landau
Although tee is most certainly preferable because IO is far slower than the small amounts of memory tee will use, you do have this option: def iterate_file_lines(file): Iterate over lines in a file, unlike normal iteration this allows seeking. while

Re: I am never going to complain about Python again

2013-10-11 Thread Joshua Landau
On 11 October 2013 03:08, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Your mistake here seems to be that you're assuming that if two numbers are equal, they must be in the same domain, but that's not the case. (Perhaps you think that 0.0 == 0+0j should return False?) It's

Re: I am never going to complain about Python again

2013-10-11 Thread Joshua Landau
On 11 October 2013 10:11, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Fri, 11 Oct 2013 09:17:37 +0100, Joshua Landau wrote: On 11 October 2013 03:08, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Given: x ∈ ℝ, x = 2 (reals) y ∈ ℕ, y = 2 (natural numbers

Re: datetime.timedelta.replace?

2013-10-11 Thread Joshua Landau
On 9 October 2013 16:15, Skip Montanaro s...@pobox.com wrote: Datetime objects have a replace method, but timedelta objects don't. If I take the diff of two datetimes and want to zero out the microseconds field, is there some way to do it more cleanly than this? delta = dt1 - dt2 zero_delta

Re: basic maze problem with turtle

2013-10-14 Thread Joshua Landau
On 13 October 2013 23:18, bauja...@gmail.com wrote: import turtle userTurtle = turtle.Turtle() draw = turtle.Turtle() scr = turtle.Screen() def drawMaze(): draw.pencolor(gold) [lots of lines] print(userTurtle.pos()) scr.onkeypress(m1, Up) scr.onkeypress(m2, Left)

Re: Sexism in the Ruby community: how does the Python community manage it?

2013-10-17 Thread Joshua Landau
On 17 October 2013 04:13, Owen Jacobson owen.jacob...@grimoire.ca wrote: Last week, Elad Maidar wrote a fairly short but readable opinion piece[0] illustrating some long-standing social problems in the Ruby community, ending with a very specific call to action around naming conventions for

Re: Sexism in the Ruby community: how does the Python community manage it?

2013-10-17 Thread Joshua Landau
On 17 October 2013 22:14, Joshua Landau jos...@landau.ws wrote: It's not our job to do anything. We can't clean the internet, so there's no point trying. Personally I think the common digressions into attacks on intellect and professionalism are much more socially regressed than the minute

Re: Obfuscated factorial

2013-10-26 Thread Joshua Landau
On 26 October 2013 12:55, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Just for fun: ... for i in range(16): print(i, FactorialBuilder(i).build().calculate()) Python already supports the factorial operator, -ⵘ. You just have to import it. # Import statement ⵘ =

Re: Algorithm that makes maximum compression of completly diffused data.

2013-10-30 Thread Joshua Landau
On 30 October 2013 19:18, Mark Lawrence breamore...@yahoo.co.uk wrote: On 30/10/2013 19:01, jonas.thornv...@gmail.com wrote: And your still a stupid monkey i dare you to go test your IQ. It's you're as in you are and not your as in belongs to me. I have no intention of getting my IQ tested,

Re: Possibly better loop construct, also labels+goto important and on the fly compiler idea.

2013-11-02 Thread Joshua Landau
On 1 November 2013 05:41, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thu, 31 Oct 2013 21:41:32 -0700, rurpy wrote: On 10/31/2013 02:41 AM, Steven D'Aprano wrote: On Wed, 30 Oct 2013 19:48:55 -0700, rurpy wrote: On 10/30/2013 04:22 AM, Steven D'Aprano wrote: Skybuck's

Re: Algorithm that makes maximum compression of completly diffused data.

2013-11-03 Thread Joshua Landau
On 3 November 2013 03:17, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sat, 02 Nov 2013 14:31:09 -0700, Tim Roberts wrote: jonas.thornv...@gmail.com wrote: Well then i have news for you. Well, then, why don't you share it? Let me try to get you to understand WHY what you

Re: Algorithm that makes maximum compression of completly diffused data.

2013-11-03 Thread Joshua Landau
On 3 November 2013 15:34, Joshua Landau jos...@landau.ws wrote: I can genuinely compress the whole structure by N log2 Y items. By which I mean 2N items. -- https://mail.python.org/mailman/listinfo/python-list

Re: New user's initial thoughts / criticisms of Python

2013-11-09 Thread Joshua Landau
On 9 November 2013 13:08, John von Horn j@btinternet.com wrote: I'm Mr. Noobie here, I've just started easing into Python (2.7.4) and am enjoying working along to some youtube tutorials. I've done a little programming in the past. I've just got a few thoughts I'd like to share and ask

Re: New user's initial thoughts / criticisms of Python

2013-11-11 Thread Joshua Landau
On 11 November 2013 10:39, Chris Angelico ros...@gmail.com wrote: On Mon, Nov 11, 2013 at 9:09 PM, lorenzo.ga...@gmail.com wrote: Regarding the select statement, I think the most Pythonic approach is using dictionaries rather than nested ifs. Supposing we want to decode abbreviated day names

Re: New user's initial thoughts / criticisms of Python

2013-11-11 Thread Joshua Landau
On 11 November 2013 22:21, Chris Angelico ros...@gmail.com wrote: On Tue, Nov 12, 2013 at 7:50 AM, Joshua Landau jos...@landau.ws wrote: The obvious way to me is a binary search: Which makes an O(log n) search where I have an O(1) lookup. The startup cost of denormalization doesn't scale, so

Re: How to print something only if it exists?

2012-09-06 Thread Joshua Landau
On 6 September 2012 18:59, tinn...@isbd.co.uk wrote: I want to print a series of list elements some of which may not exist, e.g. I have a line:- print day, fld[1], balance, fld[2] fld[2] doesn't always exist (fld is the result of a split) so the print fails when it isn't set. What I

Re: delay on windows when processing Pygame events

2012-09-10 Thread Joshua Landau
On 10 September 2012 23:25, Vojtěch Polášek krec...@gmail.com wrote: while running == True: for event in pygame.event.get(): if event.type == blahblahblah, #processing various events blahblahblah, contiuing the code after events are analysed I am looking mainly for keyboard

Double sided double underscored variable names

2012-09-11 Thread Joshua Landau
Were I to make a language to compile to Python, it is highly likely I would need to use hidden variable names to work constructs that Python alone does not have. This is the situation I face. If I were to use internal double-underscored names of the form __BS_* internalname*__, would the compiled

Re: Double sided double underscored variable names

2012-09-11 Thread Joshua Landau
On 11 September 2012 23:22, Chris Angelico ros...@gmail.com wrote: On Wed, Sep 12, 2012 at 8:09 AM, Joshua Landau joshua.landau...@gmail.com wrote: If I were to use internal double-underscored names of the form __BS_internalname__, would the compiled code be able to assume that no-one

Re: Double sided double underscored variable names

2012-09-11 Thread Joshua Landau
GMail, posting to python-list@python.org. If that is the wrong way, I would love to know what I should be doing. On Wed, 12 Sep 2012 08:22:17 +1000, Chris Angelico wrote: On Wed, Sep 12, 2012 at 8:09 AM, Joshua Landau joshua.landau...@gmail.com wrote: If I were to use internal double

Re: Double sided double underscored variable names

2012-09-11 Thread Joshua Landau
Angelico wrote: On Wed, Sep 12, 2012 at 8:48 AM, Joshua Landau joshua.landau...@gmail.com wrote: Well, the problem is that a lot of collisions aren't predictable. locals()['foo'] = 2, for example. If it weren't for Python's annoying flexibility* I can't see your footnote there, so

Re: Double sided double underscored variable names

2012-09-11 Thread Joshua Landau
This is an email address linked to my GMail account. If this works better, tell me and I'll switch. It's still sending through GMail though. -- http://mail.python.org/mailman/listinfo/python-list

Re: Double sided double underscored variable names

2012-09-12 Thread Joshua Landau
On 12/09/2012, Chris Angelico ros...@gmail.com wrote: On Wed, Sep 12, 2012 at 11:38 AM, Joshua Landau joshua.landau...@gmail.com wrote: On 12 September 2012 02:14, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Wed, 12 Sep 2012 08:52:10 +1000, Chris Angelico wrote: Inline

Re: Comparing strings from the back?

2012-09-13 Thread Joshua Landau
On 13 September 2012 20:53, Mark Lawrence breamore...@yahoo.co.uk wrote: On 13/09/2012 19:39, Prasad, Ramit wrote: Dwight Hutto wrote: Why don' you just time it,eit lops through incrementing thmax input/ What? Without context I have no idea what this means. You're wasting your time,

Re: Decorators not worth the effort

2012-09-14 Thread Joshua Landau
On 14 September 2012 18:30, Chris Angelico ros...@gmail.com wrote: On Sat, Sep 15, 2012 at 2:15 AM, andrea crotti andrea.crott...@gmail.com wrote: The poor algorithm is much more close to the mathematical definition than the smarter iterative one.. And in your second version you include

Re: splitting numpy array unevenly

2012-09-17 Thread Joshua Landau
On 17 September 2012 23:31, Wanderer wande...@dialup4less.com wrote: I need to divide a 512x512 image array with the first horizontal and vertical division 49 pixels in. Then every 59 pixels in after that. hsplit and vsplit want to start at the edges and create a bunch of same size arrays. Is

Re: Functional way to compare things inside a list

2012-09-21 Thread Joshua Landau
On 21 September 2012 21:49, Ian Kelly ian.g.ke...@gmail.com wrote: On Fri, Sep 21, 2012 at 1:54 PM, 8 Dihedral dihedral88...@googlemail.com wrote: I don't think functional aspects are only marked as lazy programming. He wrote lazy evaluation, not lazy programming. Two entirely

  1   2   3   4   5   >