Re: Advice for choosing correct architecture/tech for a hobby project

2014-05-22 Thread Ian Kelly
On Thu, May 22, 2014 at 1:28 PM, John Gordon wrote: > In <6a3c5b20-bce5-4c95-b27f-3840e9cc7...@googlegroups.com> Aseem Bansal > writes: > >> But I hit a snag today that webbrowser's won't allow client to open >> hyperlinks with file protocol. I have both offline and online bookmarks >> so that w

Re: Advice for choosing correct architecture/tech for a hobby project

2014-05-23 Thread Ian Kelly
On Thu, May 22, 2014 at 1:49 PM, Mark H Harris wrote: > On 5/22/14 1:54 PM, Aseem Bansal wrote: >> >> I am working on a hobby project - a Bookmarker{snip} > > > hi, no django is not really the correct tool-set. Django is for server-side > content management That's a common misconception. Django

Re: need help with this code please fix it or at least tell me what im doing wrong

2014-05-28 Thread Ian Kelly
On Wed, May 28, 2014 at 11:32 AM, funky wrote: > while done == False: > for event in pygame.event.get(): > if event.type == pygame.QUIT: > done == True Here is one fairly obvious bug; you used "==" where you presumably intended to do an assignment. As it stands it will ju

Re: Forking PyPI package

2014-05-29 Thread Ian Kelly
On Thu, May 29, 2014 at 1:40 AM, Chris Angelico wrote: > If you absolutely can't get in touch with him, the only option is to > go back to the original protocol and manually reimplement it, > completely ignoring this code. It's sad but true; some code dies > because of a trivial thing like "Oops,

Re: Binary data exchange

2014-05-29 Thread Ian Kelly
On Thu, May 29, 2014 at 5:09 PM, MRAB wrote: > On 2014-05-29 23:08, rasikasriniva...@gmail.com wrote: >> the received data for the messages 9 thru 13 are not as expected. >> >> I wonder if anyone can see what I am doing wrong? >> >> Appreciate any hints. thanks, srini >> > I don't understand why y

Re: Yet another "simple" headscratcher

2014-05-30 Thread Ian Kelly
On Fri, May 30, 2014 at 9:38 PM, Josh English wrote: > I am trying to whip up a quick matrix class that can handle multiplication. > > Should be no problem, except when it fails. > > [SNIP] > > def zero_matrix(rows, cols): > row = [0] * cols > data = [] > for r in range(rows): >

Re: Optparse to parsing Suggestions !!

2014-05-31 Thread Ian Kelly
On May 30, 2014 8:26 AM, "Ganesh Pal" wrote: > > > Hello Python world , > > > I wanted suggestion on how to modify the below code to help me accomodate the below two cases Your question was answered already, but I'd like to point out that optparse is deprecated. If possible, you should use argpar

Re: Python 3 is killing Python

2014-06-02 Thread Ian Kelly
On Jun 1, 2014 12:11 PM, wrote: > At least Py2 does not crash when using non ascii > (eg sticking with cp1252). > > I just noticed this last week, Thursday, when presenting > the absurdity of the Flexible String Representation. So have you reported this alleged crash bug to the bug tracker? If n

Re: Obfuscated Python hack

2014-06-02 Thread Ian Kelly
On Mon, Jun 2, 2014 at 9:38 AM, Steven D'Aprano wrote: > On Mon, 02 Jun 2014 23:23:53 +1000, Chris Angelico wrote: > >> On Mon, Jun 2, 2014 at 10:27 PM, Tim Chase >> wrote: >>> Stripping off the exec() call makes it pretty transparent that you're >>> attempting (successfully on some platforms) to

Re: Python 3 is killing Python

2014-06-02 Thread Ian Kelly
On Mon, Jun 2, 2014 at 10:15 AM, Steven D'Aprano wrote: > On Mon, 02 Jun 2014 09:01:01 -0600, Ian Kelly wrote: > >> On Jun 1, 2014 12:11 PM, wrote: >> >>> At least Py2 does not crash when using non ascii (eg sticking with >>> cp1252). >>>

Re: Benefits of asyncio

2014-06-02 Thread Ian Kelly
On Mon, Jun 2, 2014 at 11:40 AM, Aseem Bansal wrote: > I read in these groups that asyncio is a great addition to Python 3. I have > looked around and saw the related PEP which is quite big BTW but couldn't > find a simple explanation for why this is such a great addition. Any simple > example

Re: can someone explain the concept of "strings (or whatever) being immutable"

2014-06-02 Thread Ian Kelly
On Jun 2, 2014 10:41 PM, "Deb Wyatt" wrote: > > a_string = "This is a string" > a_string is pointing to the above string > > now I change the value of a_string > a_string = "This string is different" > I understand that now a_string is pointing to a different string than it was before, in a differ

Re: Lock Windows Screen GUI using python

2014-06-02 Thread Ian Kelly
On Mon, Jun 2, 2014 at 10:28 PM, Jaydeep Patil wrote: > Dear all, > Can we Lock Windows Screen GUI till program runs & unlock screen GUI when > program finishes? If you mean can you programmatically bring up the Windows lock screen, then you can do this: import ctypes ctypes.windll.user32.LockW

Re: Lock Windows Screen GUI using python

2014-06-03 Thread Ian Kelly
On Tue, Jun 3, 2014 at 12:40 AM, Jaydeep Patil wrote: > Hi Lan, > > Currently I am doing some automation in python excel. It read the data & > plots number of graphs. It took more than 20 minutes. So while running my > python program if user clicks on excel, error came. > > So just i want to loc

Re: Lock Windows Screen GUI using python

2014-06-03 Thread Ian Kelly
On Jun 3, 2014 1:56 AM, "Jaydeep Patil" wrote: > I have another query. > > We can now block user inputs. But in my automation three is copy & paste work going on continuously in Excel before plotting the graphs. > > During copy paste of excel data, if user by mistake doing some copy & paste opera

Re: Lock Windows Screen GUI using python

2014-06-03 Thread Ian Kelly
On Tue, Jun 3, 2014 at 9:55 PM, Jaydeep Patil wrote: > Hi lan, > > For plotting one graph, I need to use four to five excel files. Currently I > am reading excel files one by one and copy data of excel files to another > single master excel file. This master excel file consists of all data from

Re: Micro Python -- a lean and efficient implementation of Python 3

2014-06-03 Thread Ian Kelly
On Tue, Jun 3, 2014 at 10:40 PM, Rustom Mody wrote: >> 1) Most or all Chinese and Japanese characters > > Dont know how you count 'most' > > | One possible rationale is the desire to limit the size of the full > | Unicode character set, where CJK characters as represented by discrete > | ideograms

Re: Micro Python -- a lean and efficient implementation of Python 3

2014-06-03 Thread Ian Kelly
On Jun 3, 2014 11:27 PM, "Steven D'Aprano" wrote: > For technical reasons which I don't fully understand, Unicode only > uses 21 of those 32 bits, giving a total of 1114112 available code > points. I think mainly it's to accommodate UTF-16. The surrogate pair scheme is sufficient to encode up to

Re: Lock Windows Screen GUI using python

2014-06-03 Thread Ian Kelly
On Jun 3, 2014 11:46 PM, "Jaydeep Patil" wrote: > Below is the sample function which doing copy paste in my case. > I am copying data directly by column, not reading each & every value. > Data is too big in heavy. The approach I suggested also operates on ranges, not individual cells. -- https:/

Re: Having trouble in expressing constraints in Python

2014-06-04 Thread Ian Kelly
On Tue, Jun 3, 2014 at 7:44 AM, wrote: > I have a problem in writing a constraint in Python. Firstly, I wrote the code > in AMPL and it was working and I'm using Python for the reason that it is > more suitable to handle large data. I managed to write the code quite fine > except for one const

Re: Lambda function Turing completeness

2013-08-01 Thread Ian Kelly
On Wed, Jul 31, 2013 at 11:55 PM, Steven D'Aprano wrote: > On Wed, 31 Jul 2013 13:53:26 +0700, Musical Notation wrote: > >> Is it possible to write a Turing-complete lambda function (which does >> not depend on named functions) in Python? > > > lambda s: eval(s) eval is a named function. -- http

Re: Oddity with 'yield' as expression - parentheses demanded

2013-08-01 Thread Ian Kelly
On Thu, Aug 1, 2013 at 12:25 AM, Chris Angelico wrote: > Was playing around with yield inside a lambda and ran into a distinct oddity. > > Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 > 32 bit (Intel)] on win32 foo=lambda x: yield(x) > SyntaxError: invalid syntax

Re: Best practice for connections and cursors

2013-08-01 Thread Ian Kelly
On Thu, Aug 1, 2013 at 6:49 PM, Dennis Lee Bieber wrote: > On Thu, 1 Aug 2013 15:05:08 +, "Joseph L. Casale" > declaimed the following: > >> >>As the module opens a connection, wherever I import it I call a commit against >>the connection after invoking any methods that insert or change data.

Re: __iadd__ for a subclass of array - howto

2013-08-05 Thread Ian Kelly
On Mon, Aug 5, 2013 at 1:34 AM, Helmut Jarausch wrote: > Hi, > > I'd like to subclass array.array and implement operators like __iadd__ > How can this be accomplished. > > I'tried > > from array import array > > class Vec(array) : > def __new__(cls,Vinit) : > return array.__new__(cls,'d',Vin

Re: Bug? ( () == [] ) != ( ().__eq__([]) )

2013-08-05 Thread Ian Kelly
On Mon, Aug 5, 2013 at 8:58 AM, Markus Rother wrote: > Thanks for the good explanation. > > My intention was to pass a custom method/function as a comparator > to an object. My misconception was, that __eq__ is equivalent to > the '==' operator, and could be passed as a first class function. > Ap

Re: Newbie: static typing?

2013-08-05 Thread Ian Kelly
On Mon, Aug 5, 2013 at 2:46 PM, Rui Maciel wrote: > Is there any pythonic way to perform static typing? After searching the web > I've stumbled on a significant number of comments that appear to cover > static typing as a proof of concept , but in the process I've found no > tutorial on how to im

Enum vs OrderedEnum

2013-08-06 Thread Ian Kelly
Using the OrderedEnum recipe from the Python 3.4 docs, I have the following code: class Environment(OrderedEnum): gaia = 1 fertile = 2 terran, jungle, ocean, arid, steppe, desert, minimal = range(3, 10) barren, tundra, dead, inferno, toxic, radiated = range(10, 16) def is_st

Re: Enum vs OrderedEnum

2013-08-06 Thread Ian Kelly
On Aug 6, 2013 5:15 PM, "Ethan Furman" wrote: > > Use the .value attribute instead. You could also substitute self for Environment. It feels more natural and readable to compare the enum instances rather than their value attributes. If I am ordering the values then that seems to imply that the e

Re: Enum vs OrderedEnum

2013-08-07 Thread Ian Kelly
On Tue, Aug 6, 2013 at 7:55 PM, Ben Finney wrote: > Ian Kelly writes: > Terrain that is “radiated” would be terrain that has some kind of spokes > spreading out from its centre. I think you mean “irradiated”. > > Hope the game goes well :-) It's actually a reimplementation

Re: Enum vs OrderedEnum

2013-08-07 Thread Ian Kelly
On Tue, Aug 6, 2013 at 6:33 PM, Ethan Furman wrote: > class Environment(AutoNumber): > > gaia = 2.0 > fertile = 1.5 > terran = 1.0 > jungle = 1.0 > ocean = 1.0 > arid = 1.0 > steppe = 1.0 > desert = 1.0 > minimal = 1.0 > barren = 0.5 > tundra = 0.5 >

Re: Is a Metaclass the appropriate way to solve this problem?

2013-08-07 Thread Ian Kelly
On Wed, Aug 7, 2013 at 1:38 PM, Matthew Lefavor wrote: > I know that to create the DatabaseField objects I should be using a > descriptor. But I also want the DataSet to automatically gain methods that > will convert it into the expected JSON syntax (e.g., a __specifier__ method > that will create

Re: How Do I get my Python script to attach multiple files and send as a single email

2013-08-08 Thread Ian Kelly
On Thu, Aug 8, 2013 at 1:05 PM, wrote: > I have a dilemma I cant figure out how to send multiple files as an > attachment to my email using this script. I can only send a single file > attachment . Help!!! Here is my script. You just need to repeat part3 for each attachment. Also the content

Re: python and displaying on 10 bit monitors

2013-08-13 Thread Ian Kelly
On Tue, Aug 13, 2013 at 6:25 AM, wrote: > Are there any python libraries that read and display High Dynamic Range > images like this matlab code? > > http://www.mathworks.com/matlabcentral/fileexchange/27115-hdr-image-viewer-for-deep-color-monitor > > Or, asking another way, are there any python

Re: Local variable in a closure

2013-08-18 Thread Ian Kelly
f is nonlocal to times(), local to multiplier(). As the docs for the locals() function say, "Free variables are returned by locals() when it is called in function blocks, but not in class blocks." On Sun, Aug 18, 2013 at 3:41 AM, wrote: > Is f local or not? > http://pastebin.com/AKDJrbDs > -- >

Re: opposite of __init__.py

2013-08-19 Thread Ian Kelly
Yes, see the atexit module: http://docs.python.org/3/library/atexit.html On Mon, Aug 19, 2013 at 10:48 AM, Tamer Higazi wrote: > Hi people! > > I have asked myself a question, if there is a opposite of "__init__.py" > like "__del__.py" ?! > > I want, that when the application ends, certain funct

Re: Is this PEP-able? (syntax for functools.partial-like functionality)

2013-08-20 Thread Ian Kelly
On Tue, Aug 20, 2013 at 2:28 AM, Fábio Santos wrote: > I do realize that syntax in python is practically written in stone, but I > have seen changes come by if they have good reasons. For example, > keyword-only argument syntax was added. > > I suggested this because I thought it would be the most

Re: Encapsulation unpythonic?

2013-08-21 Thread Ian Kelly
On Aug 21, 2013 10:53 AM, wrote: > > On Mon, Aug 19, 2013, at 3:05, Steven D'Aprano wrote: > > In this toy example, both parties are at fault: the author of Parrot for > > unnecessary data-hiding of something which is so obviously a useful piece > > of information and should be part of the public

Re: Can a child access parent attributes if that child added post-hoc as an attribute to the parent?

2013-08-22 Thread Ian Kelly
On Thu, Aug 22, 2013 at 3:26 PM, Prasad, Ramit wrote: > Bitswapper wrote: >> >> So I have a parent and child class: >> >> >> class Map(object): >> def __init__(self, name=''): >> self.mapName = name >> self.rules = {} >> >> class Rule(Map): >> def __init__(self, number): >>

Re: c# async, await

2013-08-22 Thread Ian Kelly
On Thu, Aug 22, 2013 at 5:29 AM, Neal Becker wrote: > So my son is now spending his days on c# and .net. He's enthusiastic about > async and await, and said to me last evening, "I don't think python has > anything > like that". I'm not terribly knowledgeable myself regarding async programming >

Re: Fast conversion of numbers to numerator/denominator pairs

2013-08-24 Thread Ian Kelly
On Fri, Aug 23, 2013 at 9:30 PM, Steven D'Aprano wrote: > Is there a fast way to convert a Decimal into a pair of numbers numerator/ > denominator? It *must* be exact, but it doesn't have to be simplest form. > For example, Decimal("0.5") => (5, 10) would be okay, although (1, 2) > would be prefer

Re: Fast conversion of numbers to numerator/denominator pairs

2013-08-24 Thread Ian Kelly
On Sat, Aug 24, 2013 at 1:37 AM, Ian Kelly wrote: > > I time this function at about 33% faster than your version for a > six-digit decimal, and almost 50% faster for a 12-digit decimal. My > guess would be because it's not calling str() on every individual > digit. > >

Re: typeid(obj).name in C++ vs (python)

2013-08-25 Thread Ian Kelly
type(obj).__name__ On Sun, Aug 25, 2013 at 2:40 AM, Mohsen Pahlevanzadeh wrote: > Dear all, > > If you C++, I need to (typeid(obj).name) in python. Does python same > thing? > > --mohsen > > -- > http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/pytho

Re: Why is str(None) == 'None' and not an empty string?

2013-08-29 Thread Ian Kelly
On Wed, Aug 28, 2013 at 6:21 AM, Steven D'Aprano wrote: > On Wed, 28 Aug 2013 01:57:16 -0700, Piotr Dobrogost wrote: > >> Hi! >> >> Having repr(None) == 'None' is sure the right thing but why does >> str(None) == 'None'? Wouldn't it be more correct if it was an empty >> string? > > > Why do you th

Re: Rép : Why is str(None) == 'None' and not an empty string?

2013-08-29 Thread Ian Kelly
On Wed, Aug 28, 2013 at 5:42 AM, Fabrice POMBET wrote: > > On 8/28/2013 4:57 AM, Piotr Dobrogost wrote: > >> Having repr(None) == 'None' is sure the right thing but why does str(None) >> == 'None'? Wouldn't it be more correct if it was an empty string? > > the point of str(obj) is to return a str

Re: Chardet, file, ... and the Flexible String Representation

2013-09-09 Thread Ian Kelly
On Sep 9, 2013 12:36 PM, wrote: > > On Fri, Sep 6, 2013, at 13:04, Chris Angelico wrote: > > On Sat, Sep 7, 2013 at 2:59 AM, wrote: > > > Incidentally, how does all this interact with ctypes unicode_buffers, > > > which slice as strings and must be UTF-16 on windows? This was fine > > > pre-FSR

Python Developers

2013-09-17 Thread Kelly Lurz
interact with other members of the tools team to demonstrate designs, integrate with our existing tool chain, and iterate based on team feedback. The tool will be used throughout the engineering organization. **Contact Info:** * **Contact**: Kelly Lurz - Technical Recruiter * **E-mail contact**: kl

Re: Why does it have red squiggly lines under it if it works perfectly fine and no errors happen when I run it?

2013-09-19 Thread Ian Kelly
Syntactically, it looks fine. I would guess the problem is with whatever editor you are using. Or as John noted, it could be caused by the code above it. I do see an unrelated bug in there, though. You are using the name "restart" both for a string entered by the user and for the name of the fu

Re: Why does it have red squiggly lines under it if it works perfectly fine and no errors happen when I run it?

2013-09-19 Thread Ian Kelly
On Thu, Sep 19, 2013 at 1:22 PM, William Bryant wrote: > It was the other functions above it. Thanks. but I tried to do the while > loop - I don't think I did it right, I am novice in python and I am 13 years > old. It should be structured like this: while True: answer = input("Enter

Re: Tail recursion to while iteration in 2 easy steps

2013-10-04 Thread Ian Kelly
On Fri, Oct 4, 2013 at 4:16 AM, Duncan Booth wrote: > Neil Cerutti wrote: >> On 2013-10-03, Duncan Booth wrote: >>> It isn't hard to imagine adding a TAIL_CALL opcode to the >>> interpreter that checks whether the function to be called is >>> the same as the current function and if it is just up

Re: Tail recursion to while iteration in 2 easy steps

2013-10-04 Thread Ian Kelly
On Fri, Oct 4, 2013 at 4:41 AM, Ian Kelly wrote: > There is no doubt that it's a tail call. Whether it is recursion is > irrelevant to optimizing it. The reason we talk about "tail call > recursion" specifically is because the recursive case is the one that > makes

Re: Database statements via python but database left intact

2013-10-05 Thread Ian Kelly
On Sat, Oct 5, 2013 at 1:36 PM, Νίκος Αλεξόπουλος wrote: > Στις 5/10/2013 10:29 μμ, ο/η Zero Piraeus έγραψε: >> >> : >> >> On Sat, Oct 05, 2013 at 10:16:46PM +0300, Νίκος Αλεξόπουλος wrote: >>> >>> Excuse me for asking again today, but i see no error in the >>> following code, yes no isertion or u

Re: Strange extra f added to bytes object

2013-10-06 Thread Ian Kelly
On Sun, Oct 6, 2013 at 6:39 PM, Joel Goldstick wrote: >> "f" is the same as \x66; nothing has been changed. > > really? I would expect that \x66 = 0110 0110 and f = The f here is the ASCII character f, not the hex digit f: >>> bin(ord(b'f')) '0b1100110' -- https://mail.python.org/mailman/l

Re: Cookie gets changed when hit comes from a referrer

2013-10-08 Thread Ian Kelly
On Tue, Oct 8, 2013 at 4:04 AM, Νίκος Αλεξόπουλος wrote: > I use this code to retrive or set a cookie to the visitor's browser if > present and identify him bu it. > > All work well except the situation where the user visits my webpage by > clicking a backlink on another wbpage. > > Then for some

Re: Cookie gets changed when hit comes from a referrer

2013-10-08 Thread Ian Kelly
On Tue, Oct 8, 2013 at 8:18 AM, Νίκος Αλεξόπουλος wrote: > Also i have set: > ookie['ID']['expires'] = 60*60*24*365 #this cookie will expire in > a year The Expires attribute takes a date. If you're passing an interval in seconds then you should use the Max-Age attribute instead. That

Re: I am never going to complain about Python again

2013-10-10 Thread Ian Kelly
On Thu, Oct 10, 2013 at 11:48 AM, Neil Cerutti wrote: > On 2013-10-10, MRAB wrote: >> On 10/10/2013 16:57, Rotwang wrote: >>> On 10/10/2013 16:51, Neil Cerutti wrote: [...] Mixed arithmetic always promotes to the wider type (except in the case of complex numbers (Ha!)). >

Re: super in Python 3 and variadic arguments

2013-10-10 Thread Ian Kelly
On Thu, Oct 10, 2013 at 8:11 PM, Steven D'Aprano wrote: > One of the side-effects of this being a hack is that this doesn't work: > > class X(Y): > def method(self, arg): > f = super > f().method(arg) Actually, that works just fine. The compiler sees that super is accessed wi

Re: Unicode Objects in Tuples

2013-10-11 Thread Ian Kelly
On Fri, Oct 11, 2013 at 7:31 AM, Stephen Tucker wrote: > On the original question, well, I accept Ned's answer (at 10.22). I also > like the idea of a helper function given by Peter Otten at 09.51. It still > seems like a crutch to help poor old Python 2.X to do what any programmer > (or, at least

Re: What version of glibc is Python using?

2013-10-12 Thread Ian Kelly
On Sat, Oct 12, 2013 at 2:46 AM, Terry Reedy wrote: > On 10/12/2013 3:53 AM, Christian Gollwitzer wrote: >> >> That function is really bogus. It states itself, that it has "intimate >> knowledge of how different libc versions add symbols to the executable >> and thus is probably only useable for e

Re: What version of glibc is Python using?

2013-10-12 Thread Ian Kelly
On Sat, Oct 12, 2013 at 9:59 AM, Terry Reedy wrote: > On 10/12/2013 7:43 AM, Ian Kelly wrote: >> >> On Sat, Oct 12, 2013 at 2:46 AM, Terry Reedy wrote: >>> >>> On 10/12/2013 3:53 AM, Christian Gollwitzer wrote: >>>> >>>> >>>> T

Re: What version of glibc is Python using?

2013-10-13 Thread Ian Kelly
On Sun, Oct 13, 2013 at 11:43 AM, John Nagle wrote: >Ah, the apologist approach. I'm not trying to defend it. I'm saying that patching the function to fix the issue at hand risks breaking existing code that relies upon the function doing what the documentation says it does. >The documen

Re: PID tuning.

2013-10-14 Thread Ian Kelly
On Mon, Oct 14, 2013 at 2:37 PM, Renato Barbosa Pim Pereira wrote: > I am looking for some software for PID tuning that would take the result of > a step response, and calculates Td, Ti, Kp, any suggestion or hint of where > to start?, thanks. Googling for "python pid tuning" turns up some hits.

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

2013-10-17 Thread Ian Kelly
On Thu, Oct 17, 2013 at 11:16 AM, Roy Smith wrote: > On Thursday, October 17, 2013 11:07:48 AM UTC-4, Chris Angelico wrote: >> Module names should be descriptive, not fancy. > > Interesting comment, on a mailing list for a language named after a snake, > especially by a guy who claims to prefer

Re: Animated PNG Vs Gif: 120fr 3D Python Powered Logo

2013-10-22 Thread Ian Kelly
On Mon, Oct 21, 2013 at 11:28 PM, Metallicow wrote: > Here is links to the apng/gif on ImageShack uploaded with the "Do Not Resize" > option. > Checked/Views fine with default Firefox/Opera browsers. > > Animated 3D Python Powered Logo > apng - 120frames 1/60 sec > http://img34.imageshack.us/img3

Re: Animated PNG Vs Gif: 120fr 3D Python Powered Logo

2013-10-22 Thread Ian Kelly
On Tue, Oct 22, 2013 at 8:23 AM, Metallicow wrote: > Maybe there is an option with the browsers to disable gif 0 delay mangling...? Perhaps there is, but you couldn't rely on the user to have changed it. > So What did you use to increase the speed of the gif? ...Errm Program or > whatever used

Re: How to find where data files are installed for my Python program

2013-10-27 Thread Ian Kelly
On Sun, Oct 27, 2013 at 1:58 AM, Gregory Ewing wrote: > Ben Finney wrote: >> >> On systems conforming to the Filesystem Hierarchy Standard, it's >> forbidden: programs go in a platform-specific location >> >> http://refspecs.linuxfoundation.org/FHS_2.3/fhs-2.3.html#USRLIBLIBRARIESFORPROGRAMMINGAND

Re: zero argument member functions versus properties

2013-11-03 Thread Ian Kelly
On Sun, Nov 3, 2013 at 1:06 AM, Peter Cacioppi wrote: > Actually C# is mature enough for this idiom. C# and Python both support > getter/setter methods that present as direct attribute access to client code, > and thus allow you to refactor the class without breaking backwards > compatibility.

Re: zero argument member functions versus properties

2013-11-03 Thread Ian Kelly
On Sun, Nov 3, 2013 at 2:23 PM, Peter Cacioppi wrote: > Ian said : > > " Whereas in Python, an attribute access is just > compiled as an attribute access no matter what the underlying > implementation of that access may end up being at run-time. " > > Really? Very nice. Have a good link handy for

Re: To whoever hacked into my Database

2013-11-07 Thread Ian Kelly
On Thu, Nov 7, 2013 at 2:20 PM, Denis McMahon wrote: > I think the hacker is a figment of Nick's imagination, or rather a > consequence of his broken python code corrupting his data. Unless the Python installation on Nikos' system has become self-aware and is actively objecting to his code, I thi

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

2013-11-08 Thread Ian Kelly
On Fri, Nov 8, 2013 at 8:48 AM, wrote: > 3^2-2^2=5 How do you intend to encode 3**2 - 2**2 in such a way that it is more compact than simply encoding 5? If you actually have an algorithm, you should share it instead of dropping these cryptic one-line non-explanations and leaving us guessing abo

Re: OT: How to tell an HTTP client to limit parallel connections?

2013-11-08 Thread Ian Kelly
On Fri, Nov 8, 2013 at 10:25 AM, Grant Edwards wrote: > Yes, this off-topic, but after a fair amount of Googling and searching > in the "right" places, I'm running out of ideas. > > I've got a very feeble web server. The crypto handshaking involved in > opening an https: connection takes 2-3 seco

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

2013-11-10 Thread Ian Kelly
On Sun, Nov 10, 2013 at 2:22 AM, Chris Angelico wrote: > JavaScript has magic around the dot and function-call operators, as I > mentioned earlier. Lots of other languages have some little quirk > somewhere that breaks this rule; some have a LOT of quirks that break > this rule. Does Python have a

Re: Design thought for callbacks

2015-02-26 Thread Ian Kelly
On Feb 26, 2015 4:00 AM, "Cem Karan" wrote: > > > On Feb 26, 2015, at 12:36 AM, Gregory Ewing wrote: > > > Cem Karan wrote: > >> I think I see what you're talking about now. Does WeakMethod > >> (https://docs.python.org/3/library/weakref.html#weakref.WeakMethod) solve > >> this problem? > > > >

Re: Python Worst Practices

2015-02-27 Thread Ian Kelly
On Fri, Feb 27, 2015 at 2:21 PM, Travis Griggs wrote: > * Make your language have a lot of keywords. Enough to make memorizing them > ALL unlikely, requiring constant visits to your documentation > * Make sure said keywords are many of the obvious words programmers would use > in their applicati

Re: Python Worst Practices

2015-02-28 Thread Ian Kelly
On Fri, Feb 27, 2015 at 9:42 PM, Dan Sommers wrote: > I don't think I've ever used the builtin function id in a program. > Ever. Not even once. Honestly, what is a valid use case? If you have a dict that you want to key on object identity rather than equality, then you can use object ids as the

Re: Design thought for callbacks

2015-03-02 Thread Ian Kelly
On Mon, Mar 2, 2015 at 4:04 AM, Cem Karan wrote: > On Feb 26, 2015, at 2:54 PM, Ian Kelly wrote: >> On Feb 26, 2015 4:00 AM, "Cem Karan" wrote: >> > >> > >> > On Feb 26, 2015, at 12:36 AM, Gregory Ewing >> > wrote: >> > >>

Re: suggestions for functional style (singleton pattern?)

2015-03-02 Thread Ian Kelly
On Mon, Mar 2, 2015 at 8:59 AM, Michael Torrie wrote: > Now I don't know of any way of implementing class-style properties on a > module as you can do in a class, but if that were needed you would write > a standard class and instantiate a singleton inside the module itself > perhaps. This works,

Re: Sort list of dictionaries

2015-03-02 Thread Ian Kelly
On Mon, Mar 2, 2015 at 11:38 AM, Charles Heizer wrote: > Sorry, > > sortedlist = sorted(mylist , key=lambda elem: "%s %s" % (elem['name'], > LooseVersion(elem['version'])), reverse=True) > > This is what I was trying but LooseVersion() was not sorting version numbers > like I thought it would. Y

Re: Logging custom level not print module properly??

2015-03-03 Thread Ian Kelly
On Mar 3, 2015 8:16 AM, "Didymus" wrote: > I did find that if I changed the "self.log" to "self._log" it works correctly but gives me a pylint warning about acccess to a protected member _log.. > > def pwarning(self, message, *args, **kws): > """ Performance Warning Message Level """ > # Y

Re: Do not run this code.

2015-03-05 Thread Ian Kelly
On Thu, Mar 5, 2015 at 12:39 AM, Dave Farrance wrote: > Ben Finney wrote: > >>Chris Angelico writes: >> >>> import base64; exec(…) >> >>That's all I need to know. Code with ‘exec()’ calls, I consider unsafe >>by default. > > Indeed. replacing exec with print... > print(base64.b64decode(b"eD

Re: [Python 3.4] Rationale for readonly slice data attributes

2015-03-05 Thread Ian Kelly
On Thu, Mar 5, 2015 at 4:57 PM, Mario Figueiredo wrote: > What is the rationale behind making the slice class data attributes > readonly? > > I've built a __getitem__ method for a Map class that contains a list > of Cell instance objects. __getitem__ maps this list into a matrix:: > > # get ce

Re: Speeding up permutations generation

2015-03-06 Thread Ian Kelly
On Thu, Mar 5, 2015 at 11:44 PM, Abhiram R wrote: > Hi all, > Is there a way to generate permutations of large arrays of sizes say,in the > hundreds, faster than in the time itertools.permutations() can return? A list of 100 elements has approximately 9.33 x 10**157 permutations. If you could som

Re: HELP!! How to ask a girl out with a simple witty Python code??

2015-03-06 Thread Ian Kelly
On Fri, Mar 6, 2015 at 4:53 AM, alister wrote: > I have not seen one female poster on this site claim to be offended by > the comment or even consider it to be a slur. > > I doubt that the original poster of the comment intended it to be either > & most people reading it would have known that (reg

Re: Speeding up permutations generation

2015-03-06 Thread Ian Kelly
On Fri, Mar 6, 2015 at 1:24 AM, Abhiram R wrote: > >> >> A list of 100 elements has approximately 9.33 x 10**157 permutations. >> If you could somehow generate one permutation every yoctosecond, >> exhausting them would still take more than a hundred orders of >> magnitude longer than the age of t

Re: Use à Python 2 module with Python 3

2015-03-11 Thread Ian Kelly
On Wed, Mar 11, 2015 at 4:54 AM, Steven D'Aprano wrote: > Michael Parchet wrote: > >> Hello, >> >> The pyside project is ded. > > What makes you think that Pyside is dead? It seems to be active to me. The > latest update was just 29 days ago: > > https://github.com/PySide 4 days ago, even. Seems

Re: Use à Python 2 module with Python 3

2015-03-12 Thread Ian Kelly
On Wed, Mar 11, 2015 at 11:30 AM, Michael Parchet wrote: > Hello, > > Only one file of pyside project has update at 10 fob, > > What's your opinion > > Pyside is ded ? This thread has some discussion that would be useful in determining the current state of the project: https://groups.google.com/f

Re: Callbacks with concurrent.futures

2015-03-12 Thread Ian Kelly
On Wed, Mar 11, 2015 at 1:32 PM, Joseph L. Casale wrote: > I have a ProcessPoolExecutor for which I am attaching multiple callbacks. > As this must be process based and not thread based, I don't have the > luxury communication between threads. Without a queue, does something > inherent exist in co

Re: Google Code Shutting Down

2015-03-12 Thread Ian Kelly
On Thu, Mar 12, 2015 at 4:26 PM, Josh English wrote: > I've been hosting Python projects on Google Code, and they're shutting down. > > Damn. > > What is the recommended replacement for Code Hosting that works reliably with > PyPi and pip? Google has been migrating most of its own open source pr

Re: generator/coroutine terminology

2015-03-14 Thread Ian Kelly
On Sat, Mar 14, 2015 at 1:54 AM, Marko Rauhamaa wrote: > Steven D'Aprano : > >> Marko Rauhamaa wrote: >> >>> Your 'factory' is a: >>> >>> generator >>> A function which returns an iterator. >>> https://docs.python.org/3/glossary.html> >> >> That glossary entry is misleading, or at

Re: Help me please urgently!

2015-03-15 Thread Ian Kelly
On Sun, Mar 15, 2015 at 9:43 AM, Jenny Hale wrote: > Hi > > How would I do this? > The teacher wants to keep track of the scores each member of the class > obtains in the quiz. There are three classes in the school and the data > should be kept separately for each class. Is this a homework assi

Re: Dict comprehensions - improvement to docs?

2015-03-15 Thread Ian Kelly
On Sun, Mar 15, 2015 at 11:25 PM, Frank Millman wrote: > Hi all > > I like dict comprehensions, but I don't use them very often, so when I do I > need to look up the format. This surprises me, because I find the syntax very intuitive, at least if you regularly use other kinds of comprehensions. I

Re: generator/coroutine terminology

2015-03-16 Thread Ian Kelly
On Mon, Mar 16, 2015 at 1:12 AM, Marko Rauhamaa wrote: > I was actually referring to the offered API. It still seems to me like > all iterators could offer close(), send() and throw(). Why? To make all > iterators drop-in replacements of each other. The purpose of close, send and throw is to impl

Re: generator/coroutine terminology

2015-03-16 Thread Ian Kelly
On Mon, Mar 16, 2015 at 8:32 AM, Steven D'Aprano wrote: > On Tue, 17 Mar 2015 12:13 am, Marko Rauhamaa wrote: > >> If I get an iterator from a black box source, I don't know if I'm >> allowed/supposed to call close() on it. > > In no particular order: > > #1 > if hasattr(some_iterator, 'close'): >

Re: generator/coroutine terminology

2015-03-16 Thread Ian Kelly
On Mon, Mar 16, 2015 at 7:39 AM, Steven D'Aprano wrote: > On Mon, 16 Mar 2015 11:51 pm, Rustom Mody wrote: > >> It may help to read this 15 year old thread starting >> https://mail.python.org/pipermail/python-dev/2001-June/015478.html >> to see how many python stalwarts dont like the current state

Re: generator/coroutine terminology

2015-03-16 Thread Ian Kelly
On Mon, Mar 16, 2015 at 9:09 AM, Marko Rauhamaa wrote: > Ian Kelly : > >> For generators, the descriptive keyword ("yield") could be buried >> *anywhere* in that block. One can glance at a generator function and >> fail to notice that it is a generator functi

Re: Dict comprehensions - improvement to docs?

2015-03-16 Thread Ian Kelly
On Mon, Mar 16, 2015 at 3:01 AM, Frank Millman wrote: > C:\>python -m timeit -s "x = range(65, 91); y = (chr(z) for z in x)" > "dict(zip(x, y))" > 10 loops, best of 3: 11.9 usec per loop > > C:\>python -m timeit -s "x = range(65, 91); y = (chr(z) for z in x)" "{a: b > for a, b in zip(x, y)}" >

Re: Auto-completion: why not module name?

2015-03-16 Thread Ian Kelly
On Mon, Mar 16, 2015 at 10:40 AM, Chris Angelico wrote: > Looks to me like it's just doing the normal tab-completion of globals, > rather than having a special case for the 'import' statement. So what > you're talking about here is a feature request: > > When the input begins "import ", please can

Re: Dict comprehensions - improvement to docs?

2015-03-17 Thread Ian Kelly
On Tue, Mar 17, 2015 at 12:44 AM, Frank Millman wrote: > Thanks for the explanation. I'll try not to make that mistake again. > > However, to go back to the original example, we want to compare a dict > comprehension with a dict() constructor using a generator expression. > > Let's see if I have g

Re: Dict comprehensions - improvement to docs?

2015-03-18 Thread Ian Kelly
On Wed, Mar 18, 2015 at 2:01 AM, Frank Millman wrote: > > "Ian Kelly" wrote in message > news:CALwzidmNDcSvER7S6inEaVZA=DHUrDX1KzL-WRVwhd=o3_l...@mail.gmail.com... >> On Tue, Mar 17, 2015 at 12:44 AM, Frank Millman >> wrote: >>> Thanks for the explan

Re: Brilliant or insane code?

2015-03-18 Thread Ian Kelly
On Tue, Mar 17, 2015 at 7:14 PM, Dan Sommers wrote: > On Wed, 18 Mar 2015 00:35:42 +, Mark Lawrence wrote: > >> I've just come across this >> http://www.stavros.io/posts/brilliant-or-insane-code/ as a result of >> this http://bugs.python.org/issue23695 >> >> Any and all opinions welcomed, I'm

Re: Threading: execute a callback function in the parent thread

2015-03-20 Thread Ian Kelly
On Fri, Mar 20, 2015 at 11:29 AM, wrote: > Hi everyone, > > just like the title says I'm searching for a mechanism which allows to call a > callback function from a thread, being the callback executed in the parent > thread (it can also be the main thread). I'm basically looking for something

<    18   19   20   21   22   23   24   25   26   27   >