Re: python idioms : some are confusing
On Thu, Sep 20, 2012 at 10:34 PM, Vineet vineet.deod...@gmail.com wrote: Amongst the python idioms, how the below-mentioned make sense? These aren't idioms (that term has a specific technical meaning in programming); they're *way* too abstract to be idioms. Design principles or design guidelines would be a better description. ## There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. --- In programming, there can be a number of ways, equally efficient, to do certain thing. Yes, but that brings with it the cost of having to understand/learn them all, because you'll encounter them when reading/maintaining/modifying others' code. And you'll have to evaluate them all to choose which one you should use (which might even vary from moment to moment depending on the circumstances). And you'll have to watch out for subtle variants that actually do something significantly different. Better to keep things simple in the X% of cases where the differences don't matter enough, and save those brain cycles for other, more important things. See also: the so-called paradox of choice. Further reading: the criticisms on http://c2.com/cgi/wiki?ThereIsMoreThanOneWayToDoIt ## Although never is often better than *right* now. --- How come never is better that right now ? Because right now is so quick that it was likely hastily hacked together and thus of poor (or at least lesser) quality. Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list
Re: python idioms : some are confusing
I'm responding to the OP here, not to Alex, but I'm quoting his text to expand on it. :) On Fri, Sep 21, 2012 at 3:52 PM, alex23 wuwe...@gmail.com wrote: On Sep 21, 3:34 pm, Vineet vineet.deod...@gmail.com wrote: Amongst the python idioms, how the below-mentioned make sense? ## There should be one-- and preferably only one --obvious way to do it. --- In programming, there can be a number of ways, equally efficient, to do certain thing. This isn't talking about your Python code as much as about Python itself. The it in the zen there refers to some programming task. For instance, there's only one obvious way to increment an integer: spam += 1 Python's philosophy is to have just that, and to not trouble itself with spam++ and ++spam and the distinction between them. As a C programmer, I'm quite accustomed to them, and know what they mean, but not everyone does. And don't get me started on vs and in PHP... Python is a simpler and cleaner language for not having superfluous operators. ## Although never is often better than *right* now. --- How come never is better that right now ? It's better to not add a language feature than it is to add it poorly, especially when you endeavour to provide backwards compatibility as much as possible within major versions. The compatibility issue is the thing here. It's better to get something good now rather than dither for another fifty years, because the longer you dally, the more code will be written using third party libraries. But it's better to not put it into the standard library at all than to put in a messy API that now can't be changed because code's using it. The Zen of Python is a whole lot of tradeoffs and ideas. Several of them balance each other directly. Some, while not contradicted in the Zen itself, are still violated at times in the language and/or stdlib. They're principles, not laws, and need to be read with the understanding that people who write code are intelligent, thinking beings (though a quick look at TheDailyWTF.com proves that this is not universal). ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: python idioms : some are confusing
Oh I see ! On these lines mentioned by you, I can now sense the sense. Thanks. On Friday, 21 September 2012 11:22:45 UTC+5:30, alex23 wrote: On Sep 21, 3:34 pm, Vineet vineet.deod...@gmail.com wrote: Amongst the python idioms, how the below-mentioned make sense? ## There should be one-- and preferably only one --obvious way to do it. --- In programming, there can be a number of ways, equally efficient, to do certain thing. This isn't talking about your Python code as much as about Python itself. For example, in Python 2.x you can use either `open` or `file` to open a file, with `file` being a factory function for creating file objects, and `open` using it internally. In Python 3.x, `file` is no longer a built-in, as it produced a point of confusion as to which was the one obvious way to open a file. ## Although never is often better than *right* now. --- How come never is better that right now ? It's better to not add a language feature than it is to add it poorly, especially when you endeavour to provide backwards compatibility as much as possible within major versions. -- http://mail.python.org/mailman/listinfo/python-list
Is there a public API equvalent for urllib2.parse_http_list?
I'm porting my code to python3, and found there is no parse_http_list in any module of urllib of python3. So, is there a public API equvalent for urllib2.parse_http_list? Thanks. Cosmia Luna -- http://mail.python.org/mailman/listinfo/python-list
Re: python idioms : some are confusing
On Thu, 20 Sep 2012 22:34:48 -0700, Vineet wrote: Amongst the python idioms, how the below-mentioned make sense? They're not Python idioms. Idioms are common pieces of code, like looping: for item in sequence: do_something What you have quoted are parts of the Zen of Python, which is deliberately named. Zen koans are notorious for being contradictory and impossible to understand. As Terry Pratchett wrote: In the second scroll of Wen the Eternally Surprised a story is written concerning one day when the apprentice Clodpool, in a rebellious mood, approached Wen and spake thusly: Master, what is the difference between a humanistic, monastic system of belief in which wisdom is sought by means of an apparently nonsensical system of questions and answers, and a lot of mystic gibberish made up on the spur of the moment? Wen considered this for some time, and at last said: A fish! And Clodpool went away, satisfied. -- (Terry Pratchett, Thief of Time) So be careful about over-interpreting the Zen of Python. Half of it is meant to followed seriously, half is meant as a joke, and half is meant as a guideline only. ## There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. This tells us that for any task you might want to do in Python, there should be some way to do it which is obvious. It is not enough that there is some (hard to find, convoluted) way to do it, it should be obvious. And while it isn't forbidden to be two or more obvious ways, it is better if there is only one. The joke is that even this single sentence goes against its own advice. There are at least three obvious ways to put a parenthetical aside in a sentence: There should be one--and preferably only one--obvious way to do it. There should be one -- and preferably only one -- obvious way to do it. There should be one (and preferably only one) obvious way to do it. The author of the Zen deliberately choose a fourth, non-obvious way. Finally, the second line warns that although Python has many obvious ways to solve things, they may only be obvious to the creator of Python, Guido van Rossum, who is Dutch. --- In programming, there can be a number of ways, equally efficient, to do certain thing. The Zen refers to the philosophy that Python the language should provide an obvious way to solve a problem. The emphasis is on the *obvious* part, not the *one* part. ## Although never is often better than *right* now. --- How come never is better that right now ? Solving a problem in the language -- adding a new language feature such as a keyword, new syntax, a library, etc. -- should only be done when that new feature brings more benefit than problems. But sometimes a new feature might bring more problems than benefits. In this case, it is better to *never* solve that problem *in the language* than to add a feature that solves the problem badly and causes more problems than it solves. E.g. multi-line lambdas. The problem is that once you add a feature to the language, it becomes almost impossible to remove it. You are stuck with it nearly forever, or at least for many years. So better to not add it than to be stuck with a bad feature. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Storing of folder structure in SQL DB
folderid name parentid 1 cricket 0 2 india 1 3 sachin 2 4 tennis 0 5 saniamirza 4 i need coding for this table..folder id 'll automatically populate.. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a public API equvalent for urllib2.parse_http_list?
On Friday, September 21, 2012 2:22:08 PM UTC+8, Cosmia Luna wrote: I'm porting my code to python3, and found there is no parse_http_list in any module of urllib of python3. So, is there a public API equvalent for urllib2.parse_http_list? Thanks. Cosmia Luna I'm sorry, but I found it at urllib.request.parse_http_list. But I still want to know where is a DOCUMENTED equivalent of this function, or the python team forgot to document it? Thanks. Cosmia Luna -- http://mail.python.org/mailman/listinfo/python-list
Re: python idioms : some are confusing
On Thu, 20 Sep 2012 22:52:45 -0700, alex23 wrote: On Sep 21, 3:34 pm, Vineet vineet.deod...@gmail.com wrote: Amongst the python idioms, how the below-mentioned make sense? ## There should be one-- and preferably only one --obvious way to do it. --- In programming, there can be a number of ways, equally efficient, to do certain thing. This isn't talking about your Python code as much as about Python itself. For example, in Python 2.x you can use either `open` or `file` to open a file, with `file` being a factory function for creating file objects, and `open` using it internally. In Python 3.x, `file` is no longer a built-in, as it produced a point of confusion as to which was the one obvious way to open a file. I don't think that's the reason. I think the reason is that moving the built-in file into the _io library gives the developers a lot more flexibility in how they handle text and binary files. E.g.: py open('junk', 'w') _io.TextIOWrapper name='junk' mode='w' encoding='UTF-8' py open('junk', 'wb') _io.BufferedWriter name='junk' py open('junk', 'wb', buffering=0) _io.FileIO name='junk' mode='wb' The open() function now can return three (or more?) types instead of having a single built-in type handle all cases. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Storing of folder structure in SQL DB
On Friday, September 21, 2012 11:57:05 AM UTC+5:30, santhosh.s...@gmail.com wrote: folderid name parentid 1 cricket 0 2 india 1 3 sachin 2 4 tennis 0 5 saniamirza 4 i need coding for this table..folder id 'll automatically populate.. in asp.net or sql -- http://mail.python.org/mailman/listinfo/python-list
Re: [Q] How to exec code object with local variables specified?
Makoto Kuwata wrote: On Thu, Sep 20, 2012 at 10:15 PM, Peter Otten __pete...@web.de wrote: loc = {} exec(x = 1; y = 2, globals(), loc) loc {'y': 2, 'x': 1} However, this won't work with the code object taken from a function which uses a different a bytecode (STORE_FAST instead of STORE_NAME): Is there any way to use STORE_FAST instead of STORE_NAME? exec(string, ...) is not a solution for me. Can you describe your use-case? Perhaps we can suggest an alternative approach. # What is different between fn.func_code and compile(string)? func_code has faster bytecode at the expense of flexibility. -- http://mail.python.org/mailman/listinfo/python-list
Functional way to compare things inside a list
Hi, list = [{'1': []}, {'2': []}, {'3': ['4', '5']}] I want to check for a value (e.g. '4'), and get the key of the dictionary that contains that value. (Yep, this is bizarre.) some_magic(list, '4') = '3' What's the functional way to do it? Is it possible to do it with a one-liner? -- http://mail.python.org/mailman/listinfo/python-list
Re: portable way of locating an executable (like which)
On 9/21/12 1:59 AM, Nobody wrote: On Thu, 20 Sep 2012 23:06:46 +0200, Gelonida N wrote: I'd like to implement the equivalent functionality of the unix command /usr/bin/which The function should work under Linux and under windows. Note that which attempts to emulate the behaviour of execvp() etc. The exec(3) manpage will explain the precise algorithm used (e.g. they skip files for which the process lacks execute permission). Also, note that the shell has built-in commands, functions, and aliases in addition to programs. The type built-in command performs a similar function to which but using the shell's semantics. On some systems, the default configuration may alias which to type. On Windows, there's a host of different execute program interface, all with subtly different semantics: which extensions they will run, which extensions can be omitted, which paths are used (e.g. %PATH%, paths from the registry, current directory). You can also look at shutil.which http://hg.python.org/cpython/file/aa153b827d17/Lib/shutil.py#l974 Mmmm I wonder why it's removed in the last revs.. -- http://mail.python.org/mailman/listinfo/python-list
Re: Functional way to compare things inside a list
On Fri, Sep 21, 2012 at 8:58 AM, thorso...@lavabit.com wrote: Hi, list = [{'1': []}, {'2': []}, {'3': ['4', '5']}] I want to check for a value (e.g. '4'), and get the key of the dictionary that contains that value. (Yep, this is bizarre.) some_magic(list, '4') = '3' What's the functional way to do it? Is it possible to do it with a one-liner? I'm thinking here of a list comprehension, filter(), and next() to grab the first element. Let's see... By the way, I wouldn't use 'list' as a variable name; you shadow the built-in type. lst = [{'1': []}, {'2': []}, {'3': ['4', '5']}] def find_n(n,dic): for key,searchme in dic.items(): if n in searchme: return key next(filter(None,[find_n('4',x) for x in lst])) That gets the result, but probably not in the cleanest way. I'm not sure off-hand if Python has a convenient way to curry a function, but if so, you could make the filter call rather simpler. Note that this is written for Python 3, where filter() returns an iterator, thus the algorithm is lazy and thus efficient (a very Australian way to do things). ChrisA Proudly Australian, proudly lazy! -- http://mail.python.org/mailman/listinfo/python-list
Re: Functional way to compare things inside a list
On Fri, Sep 21, 2012 at 1:23 AM, Chris Angelico ros...@gmail.com wrote: On Fri, Sep 21, 2012 at 8:58 AM, thorso...@lavabit.com wrote: snip That gets the result, but probably not in the cleanest way. I'm not sure off-hand if Python has a convenient way to curry a function, http://docs.python.org/library/functools.html#functools.partial Cheers, Chris of the Northern Hemisphere -- http://mail.python.org/mailman/listinfo/python-list
Re: Functional way to compare things inside a list
On Fri, Sep 21, 2012 at 6:28 PM, Chris Rebert c...@rebertia.com wrote: On Fri, Sep 21, 2012 at 1:23 AM, Chris Angelico ros...@gmail.com wrote: On Fri, Sep 21, 2012 at 8:58 AM, thorso...@lavabit.com wrote: snip That gets the result, but probably not in the cleanest way. I'm not sure off-hand if Python has a convenient way to curry a function, http://docs.python.org/library/functools.html#functools.partial Thanks, that'd be it; didn't come up in a quick search for 'curry' (for obvious reason). So it would probably be possible to do it as a one-liner with a honking big lambda, but if code clarity is what you want, I'd go with the externally-defined function. Cheers, Chris of the Northern Hemisphere :) ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Functional way to compare things inside a list
On 21.09.2012 00:58, thorso...@lavabit.com wrote: Hi, list = [{'1': []}, {'2': []}, {'3': ['4', '5']}] I want to check for a value (e.g. '4'), and get the key of the dictionary that contains that value. (Yep, this is bizarre.) some_magic(list, '4') = '3' What's the functional way to do it? Is it possible to do it with a one-liner? Yes: [key for d in list for key in d if '4' in d[key]] -- http://mail.python.org/mailman/listinfo/python-list
Re: Functional way to compare things inside a list
On Thu, Sep 20, 2012 at 3:58 PM, thorso...@lavabit.com wrote: Hi, list = [{'1': []}, {'2': []}, {'3': ['4', '5']}] Are the dictionaries each guaranteed to only contain a single key-value pair? (Or is your example just simplistic?) I want to check for a value (e.g. '4'), and get the key of the dictionary that contains that value. And what if there is no such dictionary? Or what if there are multiple such dictionaries? (Yep, this is bizarre.) some_magic(list, '4') = '3' What's the functional way to do it? Why do you care about the paradigm used? Is it possible to do it with a one-liner? Who cares? It's possible to implement more complicated things in one line of APL, but most people probably wouldn't recommend it. Regards, Chris R. -- http://mail.python.org/mailman/listinfo/python-list
Re: Functional way to compare things inside a list
On 21.09.2012 00:58, thorso...@lavabit.com wrote: Hi, list = [{'1': []}, {'2': []}, {'3': ['4', '5']}] I want to check for a value (e.g. '4'), and get the key of the dictionary that contains that value. (Yep, this is bizarre.) some_magic(list, '4') = '3' What's the functional way to do it? Is it possible to do it with a one-liner? simple, but possibly slow solution: import itertools def some_magic(list, search): return (key for key, val in itertools.chain(*(d.iteritems() for d in list)) if search in val).next() one-liner, yeah... -- http://mail.python.org/mailman/listinfo/python-list
Re: Development mode
On 9/20/12 9:02 PM, py_lrnr wrote: I am new to python and I have come across the following command and its description: Now to be able to run the project you will need to install it and its dependencies. python setup.py develop I looked up what the 'develop' argument does and found: Extra commands: develop install package in 'development mode' I searched for a description of 'development mode' but could not find a good description. Can anyone (very briefly) explain to me, in a sentence or two: what 'development mode' is? how 'development mode' differs from other 'modes'? why/when I would use 'development mode'? what 'development mode' does or does not allow me to do? Many thanks in advance. This a setuptools / distribute feature that allows you to add a project to your Python environment without installing it - so you can continue its development In other words, when you call python setup.py develop, setuptools will compile the metadata and hook your project into Python's site-package, but the packages and modules that will be used are the one in the directory where you've run that command. This is useful to continue working on your code and testing it without having to run python setup.py install on every run see http://packages.python.org/distribute/setuptools.html#develop-deploy-the-project-source-in-development-mode -- http://mail.python.org/mailman/listinfo/python-list
Algorithms using Python?
Is there a good book on foundational as well as advanced algorithms using Python? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Python 3.3 and .pyo files
I was trying to import a pyo module in Python 3.3, but Python does not find it: $ echo print(__file__) foo.py $ python3.3 -O -m foo /home/marco/temp/foo.py $ ls foo.py __pycache__ $ rm foo.py $ mv __pycache__/foo.cpython-33.pyo foo.pyo $ rm __pycache__ -r $ ls foo.pyo # The following works in Python3.2, but not in 3.3 $ python3.3 -O -m foo /usr/local/bin/python3.3: No module named foo How come? Thanks in advance, Marco -- Marco -- http://mail.python.org/mailman/listinfo/python-list
Seome kind of unblocking input
Hello! I'm building small console like program for embedded system control over serial port. Naturally I need to be able to recieve commands from user and print reply's from embedded device. Since I'm using threads and pipes everything works ok, except that when i call input() there is no way that I could print something, is there any workaround for this?? Note: I don't need to catch any key's before enter or smtng, just be able to print while input() is waiting. I'm thinking that maybe there is a way for two threads to share one stdout, which should resolve this, but I can't make it work, since U can't pickle file like object(stdout) to pass it to other thread. Note 2: I've readed about ways to make nonblocking input by reading single char etc. but that's is all messy and very platform dependent, I would love to have platform independent solution. Thanks in advance! --JJ -- http://mail.python.org/mailman/listinfo/python-list
Re: Functional way to compare things inside a list
Am 21.09.2012 00:58, schrieb thorso...@lavabit.com: list = [{'1': []}, {'2': []}, {'3': ['4', '5']}] I want to check for a value (e.g. '4'), and get the key of the dictionary that contains that value. Note: 1. list is a built-in type, who's name is rebound above 2. The list above contains dictionaries that all only contain a single key? 3. You have strings containing decimal representations of numbers? (Yep, this is bizarre.) The data are really stored in a strange way and you might be able to make things clearer by reorganizing them a bit. some_magic(list, '4') = '3' What's the functional way to do it? Functional as in functional programming and an emphasis on lazy evaluation? In that case I'd write a generator that emits the keys where the values contain the requested string. Is it possible to do it with a one-liner? Yep, filter(), lambda and the 'in' operator. Question remains if this is readable. Note that you can use a local function, too, if you just want to reduce the scope/visibility. Good luck! Uli -- http://mail.python.org/mailman/listinfo/python-list
Re: portable way of locating an executable (like which)
On 21/09/12 04:31:17, Dave Angel wrote: On 09/20/2012 06:04 PM, Jason Swails wrote: On Thu, Sep 20, 2012 at 5:06 PM, Gelonida N gelon...@gmail.com wrote: I'd like to implement the equivalent functionality of the unix command /usr/bin/which The function should work under Linux and under windows. Did anybody already implement such a function. If not, is there a portable way of splitting the environment variable PATH? I've used the following in programs I write: def which(program): def is_exe(fpath): return os.path.exists(fpath) and os.access(fpath, os.X_OK) fpath, fname = os.path.split(program) if fpath: if is_exe(program): return program else: for path in os.getenv(PATH).split(os.pathsep): On Posix systems, you need to insert at this point: if not path: path = . exe_file = os.path.join(path, program) if is_exe(exe_file): return exe_file return None IIRC, I adapted it from StackOverflow. I know it works on Linux and Mac OS X, but not sure about windows (since I don't know if PATH works the same way there). I don't have a Windows machine set up right now, but I believe there are two more directories to search, besides the ones described in the PATH variable. One is the current directory, and the other is the Windows directory (maybe also the xxx/system32 or something). They don't have analogues in Linux or Mac, as far as I know. On Posix system (inlcuding Linux and Mac OS X), the current directory is not searched by default. If there's an empty string in os.getenv(PATH).split(os.pathsep), then the current directory will be searched at that point in the part. Hope this helps, -- HansM -- http://mail.python.org/mailman/listinfo/python-list
[WSGI] FCGID + Flup vs. mod_wsgi?
Hello The shared host I intend to use to run a small Python web app only supports mod_fcgid on its Apache server. If I understood what I read on the Net, the ideal solution would be to have mod_wsgi installed and have it run either as a module within Apache or a stand-alone process to talk to the Python app, but it's N.A. so that's out. As for FCGID, am I correct in understanding that this is the way things work: Apache - mod_fcgid - Flup (or some other wrapper) - WSGI application? www.stackoverflow.com/questions/1747266/is-there-a-speed-difference-between-wsgi-and-fcgi Would I miss a lot by using the mod_fcgid+Flup solution instead of mod_wsgi? Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: Does python have built command for package skeleton creation?
On 9/21/12 12:07 PM, xliiv wrote: Like the topic.. . I found this: http://learnpythonthehardway.org/book/ex46.html it seems fine, but shouldn't be an interactive (with CLI API) script creating that? It's a lot of effort for common work. I can contribute but i have to know that i'm not reinvent a wheel. Python Paste is probably what you are looking for - see http://lucasmanual.com/mywiki/PythonPaste for example -- http://mail.python.org/mailman/listinfo/python-list
Re: Does python have built command for package skeleton creation?
On Friday, September 21, 2012 1:08:23 PM UTC+2, Tarek Ziadé wrote: On 9/21/12 12:07 PM, xliiv wrote: Like the topic.. . I found this: http://learnpythonthehardway.org/book/ex46.html it seems fine, but shouldn't be an interactive (with CLI API) script creating that? It's a lot of effort for common work. I can contribute but i have to know that i'm not reinvent a wheel. Python Paste is probably what you are looking for - see http://lucasmanual.com/mywiki/PythonPaste for example It's a nice beast but: - it's not built in. Should it be? I think it should. - about readme and manifest.in: You could add to your template a file called readme.rst . Inside of it you can add the following code that will generate this: i dont want to add, i want it already added :).. readme is something typical, it's not rare habit for some geeks how wants to customize it all!! the same with manifest.in.. what do you think? iteractive creation is big plus.. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 3.3 and .pyo files
On Fri, 21 Sep 2012 11:10:07 +0200, Marco wrote: I was trying to import a pyo module in Python 3.3, but Python does not find it: $ echo print(__file__) foo.py $ python3.3 -O -m foo /home/marco/temp/foo.py $ ls foo.py __pycache__ $ rm foo.py $ mv __pycache__/foo.cpython-33.pyo foo.pyo I cannot duplicate the creation of the foo.cpython-33.pyo file using just the -m option. I believe that you created the foo*.pyo file some other way. Nevertheless, moving along: $ rm __pycache__ -r $ ls foo.pyo # The following works in Python3.2, but not in 3.3 $ python3.3 -O -m foo /usr/local/bin/python3.3: No module named foo I can confirm that (1) it works using Python 3.2; (2) it doesn't work using Python 3.3; and (3) it does work in Python 3.3 if you don't use the -O option. I believe that is a bug. (Tested using Python 3.2.2 and Python 3.3.0a1) -- Steven -- http://mail.python.org/mailman/listinfo/python-list
How to apply the user's HTML environment in a Python programme?
I'd like to write a programme that will be offered as a web service (Django), in which the user will point to a specific URL and the programme will be used to read the text of that URL. This text can be behind a username/password, but for several reasons, I don't want to know those. So I would like to set up a situation where the user logs in (if/when appropriate), points out the URL to my programme and my programme would then be able to read that particular text. I'm aware this may sound fishy. It should not be: I want the user to be fully aware and in control of this process. Any thoughts on how to approach this? Best regards, Bob -- http://mail.python.org/mailman/listinfo/python-list
Re: Does python have built command for package skeleton creation?
On 9/21/12 2:14 PM, xliiv wrote: Python Paste is probably what you are looking for - see http://lucasmanual.com/mywiki/PythonPaste for example It's a nice beast but: - it's not built in. Should it be? I think it should. You can suggest this to python-ideas but I really doubt you will get any traction. The sdtlib don't get new features these days because it's a burden to maintain high level tool on a 2 years release cycle - about readme and manifest.in: You could add to your template a file called readme.rst . Inside of it you can add the following code that will generate this: i dont want to add, i want it already added :).. readme is something typical, it's not rare habit for some geeks how wants to customize it all!! the same with manifest.in.. what do you think? iteractive creation is big plus.. I am not sure I get your remark on this. I pointed to this page to show a typical use case of building Paster Templates, so you can bootstrap your projects boiler-plate code So IOW everyone's free to create any kind of template :) Cheers Tarek -- http://mail.python.org/mailman/listinfo/python-list
Re: Does python have built command for package skeleton creation?
On Friday, September 21, 2012 3:04:02 PM UTC+2, Tarek Ziadé wrote: On 9/21/12 2:14 PM, xliiv wrote: Python Paste is probably what you are looking for - see http://lucasmanual.com/mywiki/PythonPaste for example It's a nice beast but: - it's not built in. Should it be? I think it should. You can suggest this to python-ideas but I really doubt you will get any traction. The sdtlib don't get new features these days because it's a burden to maintain high level tool on a 2 years release cycle Why is this '2 years release cycle'? -- http://mail.python.org/mailman/listinfo/python-list
Re: How to apply the user's HTML environment in a Python programme?
On Fri, Sep 21, 2012 at 8:57 AM, BobAalsma overhaalsgang_24_...@me.com wrote: I'd like to write a programme that will be offered as a web service (Django), in which the user will point to a specific URL and the programme will be used to read the text of that URL. This text can be behind a username/password, but for several reasons, I don't want to know those. So I would like to set up a situation where the user logs in (if/when appropriate), points out the URL to my programme and my programme would then be able to read that particular text. I'm aware this may sound fishy. It should not be: I want the user to be fully aware and in control of this process. Any thoughts on how to approach this? There are several python modules to get web pages. urllib, urllib2 and another called requests. (http://kennethreitz.com/requests-python-http-module.html) Check those out Best regards, Bob -- http://mail.python.org/mailman/listinfo/python-list -- Joel Goldstick -- http://mail.python.org/mailman/listinfo/python-list
Re: How to apply the user's HTML environment in a Python programme?
Op vrijdag 21 september 2012 15:23:14 UTC+2 schreef Joel Goldstick het volgende: On Fri, Sep 21, 2012 at 8:57 AM, BobAalsma wrote: I'd like to write a programme that will be offered as a web service (Django), in which the user will point to a specific URL and the programme will be used to read the text of that URL. This text can be behind a username/password, but for several reasons, I don't want to know those. So I would like to set up a situation where the user logs in (if/when appropriate), points out the URL to my programme and my programme would then be able to read that particular text. I'm aware this may sound fishy. It should not be: I want the user to be fully aware and in control of this process. Any thoughts on how to approach this? There are several python modules to get web pages. urllib, urllib2 and another called requests. (http://kennethreitz.com/requests-python-http-module.html) Check those out Best regards, Bob -- http://mail.python.org/mailman/listinfo/python-list -- Joel Goldstick Thanks, Joel, yes, but as far as I'm aware these would all require the Python programme to have the user's username and password (or credentials), which I wanted to avoid. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to apply the user's HTML environment in a Python programme?
On Fri, Sep 21, 2012 at 9:31 AM, BobAalsma overhaalsgang_24_...@me.com wrote: Thanks, Joel, yes, but as far as I'm aware these would all require the Python programme to have the user's username and password (or credentials), which I wanted to avoid. No matter what you do, your web service is going to have to authenticate with the remote web site. The details of that authentication are going to vary with each remote web site you want to connect to. -- Jerry -- http://mail.python.org/mailman/listinfo/python-list
how to do draw pattern with python?
may i know how to shift the bits using only looping and branching?? xx .x..x. ..xx.. ..xx.. .x..x. xx xx ..x..x ...xx. ...xx. ..x..x xx .xx... x..x.. xx xx x..x.. .xx... etc.. -- http://mail.python.org/mailman/listinfo/python-list
Re: Does python have built command for package skeleton creation?
On 21/09/2012 14:13, xliiv wrote: On Friday, September 21, 2012 3:04:02 PM UTC+2, Tarek Ziadé wrote: On 9/21/12 2:14 PM, xliiv wrote: Python Paste is probably what you are looking for - see http://lucasmanual.com/mywiki/PythonPaste for example It's a nice beast but: - it's not built in. Should it be? I think it should. You can suggest this to python-ideas but I really doubt you will get any traction. The sdtlib don't get new features these days because it's a burden to maintain high level tool on a 2 years release cycle Why is this '2 years release cycle'? Because there aren't enough volunteers to get it done any faster? -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list
Re: how to do draw pattern with python?
On 2012-09-21 15:36, echo.hp...@gmail.com wrote: may i know how to shift the bits using only looping and branching?? xx .x..x. ..xx.. ..xx.. .x..x. xx What kinds of bits? What are these points and x-es anyway? Are they strings? Or binary data? I recommend this for reading: http://www.catb.org/esr/faqs/smart-questions.html -- http://mail.python.org/mailman/listinfo/python-list
Re: how to do draw pattern with python?
On 21/09/2012 14:36, echo.hp...@gmail.com wrote: may i know how to shift the bits using only looping and branching?? xx .x..x. ..xx.. ..xx.. .x..x. xx xx ..x..x ...xx. ...xx. ..x..x xx .xx... x..x.. xx xx x..x.. .xx... etc.. You write some code and test it. If it doesn't work you cut and paste the smallest sample of code that can reproduce the problem, together with the full traceback if applicable, and you're likely to get plenty of answers. -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to apply the user's HTML environment in a Python programme?
Op vrijdag 21 september 2012 15:36:11 UTC+2 schreef Jerry Hill het volgende: On Fri, Sep 21, 2012 at 9:31 AM, BobAalsma wrote: Thanks, Joel, yes, but as far as I'm aware these would all require the Python programme to have the user's username and password (or credentials), which I wanted to avoid. No matter what you do, your web service is going to have to authenticate with the remote web site. The details of that authentication are going to vary with each remote web site you want to connect to. -- Jerry Hmm, from the previous posts I get the impression that I could best solve this by asking the user for the specific combination of username, password and URL + promising not to keep any of that... OK, that does sound doable - thank you all Bob -- http://mail.python.org/mailman/listinfo/python-list
Re: how to do draw pattern with python?
On 09/21/2012 09:36 AM, echo.hp...@gmail.com wrote: may i know how to shift the bits using only looping and branching?? Yes, show us your code, and what isn't working, and we'll try to help you complete the assignment. It'd probably also be good to specify the rest of the homework, like what version of what language it has to be implemented in. I don't see any bits, only strings of characters. And it seems to me that using slices is the most obvious mechanism for rotating fixed-length strings. xx .x..x. ..xx.. ..xx.. .x..x. xx xx ..x..x ...xx. ...xx. ..x..x xx .xx... x..x.. xx xx x..x.. .xx... etc.. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Blue Screen Python
Hallo to all, I'm using Python 2.7.3 with Windows 7 @ 64 bit and an Intel Core i3 -2350M CPU @2.30GHz 2.3GHz. Sometimes, when I'm programming in Python on my screen compare this blue screen: http://imageshack.us/a/img228/8352/48579647436249494527021.jpg Can you help on what is the issue, and how I can solve it? If you need more info I'm available. Thank you so much, Michele -- http://mail.python.org/mailman/listinfo/python-list
Re: How to apply the user's HTML environment in a Python programme?
On Fri, Sep 21, 2012 at 9:58 AM, BobAalsma overhaalsgang_24_...@me.com wrote: Op vrijdag 21 september 2012 15:36:11 UTC+2 schreef Jerry Hill het volgende: On Fri, Sep 21, 2012 at 9:31 AM, BobAalsma wrote: Thanks, Joel, yes, but as far as I'm aware these would all require the Python programme to have the user's username and password (or credentials), which I wanted to avoid. No matter what you do, your web service is going to have to authenticate with the remote web site. The details of that authentication are going to vary with each remote web site you want to connect to. -- Jerry Hmm, from the previous posts I get the impression that I could best solve this by asking the user for the specific combination of username, password and URL + promising not to keep any of that... OK, that does sound doable - thank you all I recommend that you write your program to read pages that are not protected. Once you get that working, you can go back and figure out how you want to get the username/password from your 'friends' and add that in. Also look up Beautiful Soup (version 4) for a great library to parse the pages that you retrieve Bob -- http://mail.python.org/mailman/listinfo/python-list -- Joel Goldstick -- http://mail.python.org/mailman/listinfo/python-list
Re: how to do draw pattern with python?
echo.hp...@gmail.com wrote: may i know how to shift the bits using only looping and branching?? import time data = \ xx .x..x. ..xx.. ..xx.. .x..x. xx .splitlines() data = [line * 12 for line in data] # optional while True: print \x1b[2J\x1b[0;0H # optional for i, line in enumerate(data): print line data[i] = line[1:] + line[:1] time.sleep(.1) Doing your homework since 2001 ;) -- http://mail.python.org/mailman/listinfo/python-list
Re: Blue Screen Python
On Sat, Sep 22, 2012 at 12:04 AM, mikcec82 michele.cec...@gmail.com wrote: Hallo to all, I'm using Python 2.7.3 with Windows 7 @ 64 bit and an Intel Core i3 -2350M CPU @2.30GHz 2.3GHz. Sometimes, when I'm programming in Python on my screen compare this blue screen: http://imageshack.us/a/img228/8352/48579647436249494527021.jpg Can you help on what is the issue, and how I can solve it? If you need more info I'm available. Ouch, that's not fun. I've never actually seen Python bsod by itself. My first guesses are: 1) It's a buggy library that you're using with Python. Do you know what modules your code calls on? Mainly ones that aren't part of the standard library. 2) It's unrelated, but maybe triggered somehow. For instance, your Python program might be consuming a lot of RAM, which causes a problem when you make use of a faulty bit of memory somewhere in the higher addresses. Have you run a RAM test on that machine? This is a well-respected one: http://www.memtest.org/ Alternatively, can you narrow the problem down to a particular script that will repeatedly cause the BSOD? ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Reading a file in IDLE 3 on Mac-Lion
Hello, I create a text file utf-8 encoded in Python 3 with IDLE (Mac Lion). It runs fine and creates the disk file, visible with TextWrangler or another. But I can't open it with IDLE (its name is greyed). IDLE is supposed to read utf-8 files, no ? This works on Windows-7. Thanks for the tip, franck -- http://mail.python.org/mailman/listinfo/python-list
Re: Algorithms using Python?
On Fri, Sep 21, 2012 at 4:56 AM, Mayuresh Kathe mayur...@kathe.in wrote: Is there a good book on foundational as well as advanced algorithms using Python? Thanks. -- http://mail.python.org/mailman/listinfo/python-list There is one on Apress that I've seen http://www.amazon.com/Python-Algorithms-Mastering-Language-Experts/dp/1430232374 -- Joel Goldstick -- http://mail.python.org/mailman/listinfo/python-list
Re: How to apply the user's HTML environment in a Python programme?
BobAalsma wrote: Hmm, from the previous posts I get the impression that I could best solve this by asking the user for the specific combination of username, password and URL + promising not to keep any of that... OK, that does sound doable - thank you all Hmm, promising seems doable, but keeping? -- http://mail.python.org/mailman/listinfo/python-list
Re: Obnoxious postings from Google Groups (was: datetime issue)
On 2012-09-16, Ben Finney ben+pyt...@benfinney.id.au wrote: nikos.gr...@gmail.com writes: Iam sorry i didnt do that on purpose and i dont know how this is done. Iam positng via google groups using chrome, thats all i know. It is becoming quite clear that some change has happened recently to Google Groups that makes posts coming from there rather more obnoxious than before. Well, that's certainly something of an accomplishment. I've become somewhat suspicious that Google Groups is Google's deliberate attempt to kill off Usenet and non-Google-controlled mailing lists. Nothing can be that bad by accident. Except perhaps certain Microsoft products make that most Microsoft products. And there doesn't seem to be much its users can do except use something else. Using Google Groups for posting to Usenet has been a bad idea for a long time, but now it just seems to be a sure recipe for annoying the rest of us. Again, not something you have much control over, except to stop using Google Groups. I told my news client years ago to filter out anything posted from Google Groups -- and I know I'm not alone. If one wants the best chance of getting a question answered, using something other than Google Groups is indeed a good idea. -- Grant Edwards grant.b.edwardsYow! The PILLSBURY DOUGHBOY at is CRYING for an END to gmail.comBURT REYNOLDS movies!! -- http://mail.python.org/mailman/listinfo/python-list
Re: Blue Screen Python
On 2012-09-21, mikcec82 michele.cec...@gmail.com wrote: Hallo to all, I'm using Python 2.7.3 with Windows 7 @ 64 bit and an Intel Core i3 -2350M CPU @2.30GHz 2.3GHz. Sometimes, when I'm programming in Python on my screen compare this blue screen: http://imageshack.us/a/img228/8352/48579647436249494527021.jpg Can you help on what is the issue, and how I can solve it? IMO, the easiest waht to avoid those is by not running Windows. ;) Python is a user-space application. User-space applications can't cause blue-screens unless they manage to trigger a bug in hardware, OS kernel, or device driver. The solution is usually to fix the hardware, OS, or device driver. -- Grant Edwards grant.b.edwardsYow! I'm having an at emotional outburst!! gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Re: How to apply the user's HTML environment in a Python programme?
On 2012-09-21 08:57, BobAalsma wrote: This text can be behind a username/password, but for several reasons, I don't want to know those. So I would like to set up a situation where the user logs in (if/when appropriate), points out the URL to my programme and my programme would then be able to read that particular text. I do this from a bat file that I will later translate to Python. I tell my work wiki which file I want. I use chrome, so for every new session I'm asked for my credentials. However, that is all transparent to my bat file. For that matter, when I download a new build from part of another bat file, I use Firefox and never see the credential exchange. I wouldn't expect any different behavior using Python. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 3.3 and .pyo files
On 09/21/2012 02:55 PM, Steven D'Aprano wrote: $ ls foo.pyo # The following works in Python3.2, but not in 3.3 $ python3.3 -O -m foo /usr/local/bin/python3.3: No module named foo I can confirm that (1) it works using Python 3.2; (2) it doesn't work using Python 3.3; and (3) it does work in Python 3.3 if you don't use the -O option. It doesn't work with Python 3.3.0rc2 too. -- Marco -- http://mail.python.org/mailman/listinfo/python-list
Re: Does python have built command for package skeleton creation?
On Fri, 21 Sep 2012 14:50:36 +0100, Mark Lawrence wrote: On 21/09/2012 14:13, xliiv wrote: Why is this '2 years release cycle'? Because there aren't enough volunteers to get it done any faster? Because if it were any faster, it would piss off a lot of people. Python's release cycle is actually closer to 18 months for minor releases (3.2 - 3.3, for example), and 10 years for major releases (2.x - 3.x). But consider, C and C++ don't have minor releases *at all*. The last versions of those two languages are C99 and C+98 -- that's FOURTEEN YEARS since the last version of C++. And Java hasn't had a major feature update since 2006. For a programming language with a lot of corporate use, Python already seems like it changes at the drop of a hat. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Blue Screen Python
On Fri, 21 Sep 2012 15:14:53 +, Grant Edwards wrote: On 2012-09-21, mikcec82 michele.cec...@gmail.com wrote: Hallo to all, I'm using Python 2.7.3 with Windows 7 @ 64 bit and an Intel Core i3 -2350M CPU @2.30GHz 2.3GHz. Sometimes, when I'm programming in Python on my screen compare this Python is a user-space application. User-space applications can't cause blue-screens unless they manage to trigger a bug in hardware, OS kernel, or device driver. But Windows does not have any true concept of user-space (although it does make an almost convincing pretence) it has been hacked up from an operating system that's original security model was Lock the door when you leave the office -- Watch all-night Donna Reed reruns until your mind resembles oatmeal. -- http://mail.python.org/mailman/listinfo/python-list
Re: Blue Screen Python
On Fri, 21 Sep 2012 16:01:16 +, Alister wrote: On Fri, 21 Sep 2012 15:14:53 +, Grant Edwards wrote: On 2012-09-21, mikcec82 michele.cec...@gmail.com wrote: Hallo to all, I'm using Python 2.7.3 with Windows 7 @ 64 bit and an Intel Core i3 -2350M CPU @2.30GHz 2.3GHz. Sometimes, when I'm programming in Python on my screen compare this Python is a user-space application. User-space applications can't cause blue-screens unless they manage to trigger a bug in hardware, OS kernel, or device driver. But Windows does not have any true concept of user-space (although it does make an almost convincing pretence) it has been hacked up from an operating system that's original security model was Lock the door when you leave the office on a slightly more helpful front try adding break points to your code to see what part is actually causing the crash -- Whenever I feel like exercise, I lie down until the feeling passes. -- http://mail.python.org/mailman/listinfo/python-list
Re: how to do draw pattern with python?
2012/9/21 Peter Otten __pete...@web.de: echo.hp...@gmail.com wrote: print \x1b[2J\x1b[0;0H # optional Nice code : ) Could you dissect that weird string for us? It isn't returning the cursor to (0,0), it's just like executing clear(1), and looks like those line coloring scape sequences for bash. Ismael -- Do not let me induce you to satisfy my curiosity, from an expectation, that I shall gratify yours. What I may judge proper to conceal, does not concern myself alone. -- http://mail.python.org/mailman/listinfo/python-list
Re: Does python have built command for package skeleton creation?
On 09/21/2012 11:54 AM, Steven D'Aprano wrote: On Fri, 21 Sep 2012 14:50:36 +0100, Mark Lawrence wrote: On 21/09/2012 14:13, xliiv wrote: Why is this '2 years release cycle'? Because there aren't enough volunteers to get it done any faster? Because if it were any faster, it would piss off a lot of people. Python's release cycle is actually closer to 18 months for minor releases (3.2 - 3.3, for example), and 10 years for major releases (2.x - 3.x). But consider, C and C++ don't have minor releases *at all*. The last versions of those two languages are C99 and C+98 -- that's FOURTEEN YEARS since the last version of C++. And Java hasn't had a major feature update since 2006. C++0x was the working name of a new ISO C++ standard, which was then released in 2011 as C++11 ... according to http://gcc.gnu.org/projects/cxx0x.html And it replaced C++03, released in 2003. For a programming language with a lot of corporate use, Python already seems like it changes at the drop of a hat. Correct. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: how to do draw pattern with python?
Ismael Farfán wrote: 2012/9/21 Peter Otten __pete...@web.de: echo.hp...@gmail.com wrote: print \x1b[2J\x1b[0;0H # optional Nice code : ) Could you dissect that weird string for us? It isn't returning the cursor to (0,0), it's just like executing clear(1), and looks like those line coloring scape sequences for bash. \x1b[2J or ESC [2J should clear the screen and \x1b[1;1H or ESC [1;1H should move the cursor to the origin (I got that wrong in the previous post) There may be other problems -- I stopped reading http://en.wikipedia.org/wiki/ANSI_escape_code as soon as I got the desired effect (scrolling) in konsole. -- http://mail.python.org/mailman/listinfo/python-list
Exact integer-valued floats
Python floats can represent exact integer values (e.g. 42.0), but above a certain value (see below), not all integers can be represented. For example: py 1e16 == 1e16 + 1 # no such float as 10001.0 True py 1e16 + 3 == 1e16 + 4 # or 10003.0 True So some integers are missing from the floats. For large enough values, the gap between floats is rather large, and many numbers are missing: py 1e200 + 1e10 == 1e200 True The same applies for large enough negative values. The question is, what is the largest integer number N such that every whole number between -N and N inclusive can be represented as a float? If my tests are correct, that value is 9007199254740992.0 = 2**53. Have I got this right? Is there a way to work out the gap between one float and the next? (I haven't tried to exhaustively check every float because, even at one nanosecond per number, it will take over 200 days.) -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: how to do draw pattern with python?
On Fri, Sep 21, 2012 at 10:50 AM, Ismael Farfán sulfur...@gmail.com wrote: 2012/9/21 Peter Otten __pete...@web.de: echo.hp...@gmail.com wrote: print \x1b[2J\x1b[0;0H # optional Nice code : ) Could you dissect that weird string for us? It isn't returning the cursor to (0,0), it's just like executing clear(1), and looks like those line coloring scape sequences for bash. They're called ANSI escape codes. :-) CSI 2J clears the screen. CSI 0;0H means move the cursor to row 0, column 0. However, I don't think that's valid ANSI, as the coordinates are 1-based. Probably it should have been \x1b[2J\x1b[1;1H. -- http://mail.python.org/mailman/listinfo/python-list
Re: how to do draw pattern with python?
On Sat, Sep 22, 2012 at 2:50 AM, Ismael Farfán sulfur...@gmail.com wrote: 2012/9/21 Peter Otten __pete...@web.de: echo.hp...@gmail.com wrote: print \x1b[2J\x1b[0;0H # optional Nice code : ) Could you dissect that weird string for us? It isn't returning the cursor to (0,0), it's just like executing clear(1), and looks like those line coloring scape sequences for bash. It's an ANSI escape sequence, or rather two of them. The first one clears the screen, the second returns you to 0,0. (Isn't that implicit in the 2J code? Maybe I'm misremembering.) But it depends on the terminal responding to them, and not all terminals do. For instance, most MUD clients parse only a very small subset of ANSI codes, eg color codes only. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Does python have built command for package skeleton creation?
On Fri, 21 Sep 2012 13:26:32 -0400, Dave Angel wrote: On 09/21/2012 11:54 AM, Steven D'Aprano wrote: Python's release cycle is actually closer to 18 months for minor releases (3.2 - 3.3, for example), and 10 years for major releases (2.x - 3.x). But consider, C and C++ don't have minor releases *at all*. The last versions of those two languages are C99 and C+98 -- that's FOURTEEN YEARS since the last version of C++. And Java hasn't had a major feature update since 2006. C++0x was the working name of a new ISO C++ standard, which was then released in 2011 as C++11 ... according to http://gcc.gnu.org/projects/cxx0x.html And it replaced C++03, released in 2003. I stand corrected, thank you. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: how to do draw pattern with python?
On Sat, Sep 22, 2012 at 3:31 AM, Chris Angelico ros...@gmail.com wrote: It's an ANSI escape sequence, or rather two of them. The first one clears the screen, the second returns you to 0,0. (Isn't that implicit in the 2J code? Maybe I'm misremembering.) Ah. From Wikipedia: If n is two, clear entire screen (and moves cursor to upper left on MS-DOS ANSI.SYS). So adding \e[H is necessary. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Does python have built command for package skeleton creation?
On Sat, Sep 22, 2012 at 1:54 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: But consider, C and C++ don't have minor releases *at all*. The last versions of those two languages are C99 and C+98 -- that's FOURTEEN YEARS since the last version of C++. And Java hasn't had a major feature update since 2006. For a programming language with a lot of corporate use, Python already seems like it changes at the drop of a hat. Hang on, you're conflating the language and its implementation. C and C++ don't have minor releases, because you're looking only at the language. On the other hand, gcc has major.minor.revision releases, because it's possible for the compiler to have trivial bugs that merit a small bugfix, or minor changes that perhaps enhance the stdlib. The way I see it, a Python minor release shouldn't normally be a problem to an active developer, but is too big a change to push quietly to active scripts. That's a lot smaller than a release of a new C/C++ spec; more akin to the next version of Microsoft Visual C++, which comes out every couple of years ish. And as DaveA (no relation to me, but I love the coincidence of surname AND signature style) pointed out, there have been C++ spec updates since 98. Python's release schedule is plenty fast enough. It's already outstripping the packagers in Debian and Red Hat. Fortunately it's pretty easy to whip up your own Python straight from source and 'make altinstall' to keep things happily parallel. You want faster releases? You got 'em. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Exact integer-valued floats
On Fri, Sep 21, 2012 at 11:29 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: The question is, what is the largest integer number N such that every whole number between -N and N inclusive can be represented as a float? If my tests are correct, that value is 9007199254740992.0 = 2**53. Have I got this right? Is there a way to work out the gap between one float and the next? That looks mathematically correct. The gap between floats is the equivalent of a difference of 1 bit in the significand. For a floating point number represented as (sign * c * 2 ** q), where c is an integer, the gap between floats is equal to 2 ** q. There are 53 bits of precision in a double-precision float (technically an implicit 1 followed by 52 bits), so q becomes greater than 0 at 2 ** 53. Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list
One of my joomla webpages has been hacked. Please help.
Hello, One webpage of mine, http://www.varsa.gr/ has been *hacked* 15 mins ago. I logged into CPanel but the joomla files seem ok. but when i view page code with chrome i get the source code, i dont knwo of which file thaty contains javascript inside. Please visit my web page varsa.gr and view the source code and maybe you can tell me what has happened. I would be gratefull for any help you provide me. I know this is not a python question but you guyshave high knowledge of web sites programming and i though you wouldnt mind helping me out. Thank you very much. -- http://mail.python.org/mailman/listinfo/python-list
Re: Exact integer-valued floats
Steven D'Aprano writes: Python floats can represent exact integer values (e.g. 42.0), but above a certain value (see below), not all integers can be represented. For example: py 1e16 == 1e16 + 1 # no such float as 10001.0 True py 1e16 + 3 == 1e16 + 4 # or 10003.0 True So some integers are missing from the floats. For large enough values, the gap between floats is rather large, and many numbers are missing: py 1e200 + 1e10 == 1e200 True The same applies for large enough negative values. The question is, what is the largest integer number N such that every whole number between -N and N inclusive can be represented as a float? If my tests are correct, that value is 9007199254740992.0 = 2**53. Have I got this right? Is there a way to work out the gap between one float and the next? There is a way to find the distance between two IEEE floats in ulps, or units in the last position, computable from the bit pattern using integer arithmetic. I think it's then also possible to find the next float by adding one. I don't have a link at hand, I'm too tired to search at the moment, and I'm no expert on floats, but you might find an answer by looking for ulps. (I haven't tried to exhaustively check every float because, even at one nanosecond per number, it will take over 200 days.) Come to think of it, the difference between adjacent floats is exactly one ulp. Just use the right unit :) -- http://mail.python.org/mailman/listinfo/python-list
Re: how to do draw pattern with python?
On 21/09/2012 15:29, Peter Otten wrote: echo.hp...@gmail.com wrote: may i know how to shift the bits using only looping and branching?? import time data = \ xx .x..x. ..xx.. ..xx.. .x..x. xx .splitlines() data = [line * 12 for line in data] # optional while True: print \x1b[2J\x1b[0;0H # optional for i, line in enumerate(data): print line data[i] = line[1:] + line[:1] time.sleep(.1) Doing your homework since 2001 ;) I tried running your code but got this:- c:\Users\Markpattern.py File C:\Users\Mark\pattern.py, line 22 Doing your homework since 2001 ^ SyntaxError: invalid syntax What am I doing wrong? -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list
Re: Functional way to compare things inside a list
Ulrich Eckhardt於 2012年9月21日星期五UTC+8下午5時15分03秒寫道: Am 21.09.2012 00:58, schrieb thorso...@lavabit.com: list = [{'1': []}, {'2': []}, {'3': ['4', '5']}] I want to check for a value (e.g. '4'), and get the key of the dictionary that contains that value. Note: 1. list is a built-in type, who's name is rebound above 2. The list above contains dictionaries that all only contain a single key? 3. You have strings containing decimal representations of numbers? (Yep, this is bizarre.) The data are really stored in a strange way and you might be able to make things clearer by reorganizing them a bit. some_magic(list, '4') = '3' What's the functional way to do it? Functional as in functional programming and an emphasis on lazy evaluation? In that case I'd write a generator that emits the keys where the values contain the requested string. Is it possible to do it with a one-liner? Yep, filter(), lambda and the 'in' operator. Question remains if this is readable. Note that you can use a local function, too, if you just want to reduce the scope/visibility. Good luck! Uli I don't think functional aspects are only marked as lazy programming. It just means when one is experimenting something the efficient execution in speed is not on focus yet. -- http://mail.python.org/mailman/listinfo/python-list
Re: Exact integer-valued floats
On Fri, 21 Sep 2012 17:29:13 +, Steven D'Aprano wrote: The question is, what is the largest integer number N such that every whole number between -N and N inclusive can be represented as a float? If my tests are correct, that value is 9007199254740992.0 = 2**53. Have I got this right? Is there a way to work out the gap between one float and the next? CPython's float type uses C's double. For a system where C's double is IEEE-754 double precision, N=2**53 is the correct answer. An IEEE-754 double precision value consists of a 53-bit integer whose first bit is a 1, multiplied or divided by a power of two. http://en.wikipedia.org/wiki/IEEE_754-1985 The largest 53-bit integer is 2**53-1. 2**53 can be represented as 2**52 * 2**1. 2**53+1 cannot be represented in this form. 2**53+2 can be represented as (2**52+1) * 2**1. For values x where 2**52 = x 2**53, the the interval between representable values (aka Unit in the Last Place or ULP) is 1.0. For 2**51 = x 2**52, the ULP is 0.5. For 2**53 = x 2**54, the ULP is 2.0. And so on. -- http://mail.python.org/mailman/listinfo/python-list
Re: Algorithms using Python?
On Fri, Sep 21, 2012 at 1:45 PM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: You can probably implement them, but they're not going to be very efficient. (And never remove an element from the linked-list implementation because Python would shift all the other elements, hence your links become invalid). I'm not sure what you mean by that last comment. class Node(object): def __init__(self, data, next): self.data = data self.next = next class LinkedList(object): def __init__(self): self._head = None def __iter__(self): node = self._head while node: yield node.data node = node.next def insert_front(self, value): self._head = Node(value, self._head) def remove(self, value): prior, node = None, self._head while node: if node.data == value: if prior: prior.next = node.next else: self._head = node.next break prior, node = node, node.next else: raise ValueError(value not found) li = LinkedList() for char in 'edcba': ... li.insert_front(char) ... print ''.join(li) abcde li.remove('c') print ''.join(li) abde It seems to work fine to me. -- http://mail.python.org/mailman/listinfo/python-list
Re: [Q] How to exec code object with local variables specified?
Makoto Kuwata於 2012年9月20日星期四UTC+8下午7時27分40秒寫道: Hi, Is it possible to run code object with local variables specified? I'm trying the following code but not work: def fn(): x = 1 y = 2 localvars = {'x': 0} exec(fn.func_code, globals(), localvars) print(localvars) ## what I expected is: {'x': 1, 'y': 2} ## but actual is: {'x': 0} Python: 2.7.3 OS: MacOS X -- regards, makoto kuwata Do you plan to write an IDE for python scrits ? I have seen a lot abusiosns of spawns or pipes of mutlti-processes, and now the exec part again. I think the sources of Doctor Python and IDLE were available years ago for showing off python's capabilities in developing an IDE. -- http://mail.python.org/mailman/listinfo/python-list
Print Function
Hello , I am currently using Python 3.2.3 . WHen I use the print function by typing print Game Over , it mentions SyntaxError : invalid syntax . Any ideas on what the problem is and how to resolve it ? Thanks a lot . GengYang -- http://mail.python.org/mailman/listinfo/python-list
Re: Print Function
On 9/21/12 10:20 PM, gengyang...@gmail.com wrote: Hello , I am currently using Python 3.2.3 . WHen I use the print function by typing print Game Over , it mentions SyntaxError : invalid syntax . Any ideas on what the problem is and how to resolve it ? Thanks a lot . print was a statement in python 2.x, it is now a function so you need parenthesis: print(Game Over) Game Over GengYang -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading a file in IDLE 3 on Mac-Lion
On 21/09/12 16:29:55, Franck Ditter wrote: I create a text file utf-8 encoded in Python 3 with IDLE (Mac Lion). It runs fine and creates the disk file, visible with TextWrangler or another. But I can't open it with IDLE (its name is greyed). IDLE is supposed to read utf-8 files, no ? This works on Windows-7. There's a little pop-menu below the list of files. It allows you to choose which kind of files you want to open. By default, it is set to Python files, which greys out all files, except those with a '.py' or '.pyw' extension. Setting it to Text files should help, or else try All files. Hope this helps -- HansM -- http://mail.python.org/mailman/listinfo/python-list
Re: Print Function
Go away troll! Sent from my iPhone On Sep 21, 2012, at 4:27 PM, gengyang...@gmail.com gengyang...@gmail.com wrote: Hello , I am currently using Python 3.2.3 . WHen I use the print function by typing print Game Over , it mentions SyntaxError : invalid syntax . Any ideas on what the problem is and how to resolve it ? Thanks a lot . GengYang -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Re: Algorithms using Python?
On 09/21/2012 02:45 PM, Dennis Lee Bieber wrote: On Fri, 21 Sep 2012 14:26:04 +0530, Mayuresh Kathe mayur...@kathe.in declaimed the following in gmane.comp.python.general: Is there a good book on foundational as well as advanced algorithms using Python? Depends on what you mean by foundational... Since Python has dynamic lists and dictionaries, I suspect you won't find any textbook focusing on linked-list or hashed lookup algorithms using Python. I wouldn't be so sure; C++ and Java both have standard libraries with dictionaries (and thus are mostly lacking a literal syntax). But it's easy to find books talking about the simple stuff. I'd suggest looking at the books used in MIT's intro classes: 6.000 (Intro to CS and programming): http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00sc-introduction-to-computer-science-and-programming-spring-2011/Syllabus/ Zelle, John M. Python Programming: An Introduction to Computer Science Budd, Timothy. Exploring Python Shaw, Zed A. Learn Python the Hard Way [online] Swaroop, CH. A Byte of Python 6.006 (Intro to algorithms): http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-spring-2008/syllabus/ Miller and Ranum. Problem Solving with Algorithms and Data Structures Using Python. [CLRS isn't Python] and see if they have anything to offer. (I didn't actually look.) You can probably implement them, but they're not going to be very efficient. (And never remove an element from the linked-list implementation because Python would shift all the other elements, hence your links become invalid). Huh? Evan signature.asc Description: OpenPGP digital signature -- http://mail.python.org/mailman/listinfo/python-list
Re: Functional way to compare things inside a list
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 different things. It just means when one is experimenting something the efficient execution in speed is not on focus yet. No, what you're describing is a prototype. It has nothing to do with functional programming at all. -- http://mail.python.org/mailman/listinfo/python-list
Re: Print Function
On Fri, Sep 21, 2012 at 2:28 PM, Rodrick Brown rodrick.br...@gmail.com wrote: Go away troll! Troll? It looked like a sincere question to me. -- http://mail.python.org/mailman/listinfo/python-list
Re: Exact integer-valued floats
On 21/09/12 22:26:26, Dennis Lee Bieber wrote: On 21 Sep 2012 17:29:13 GMT, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info declaimed the following in gmane.comp.python.general: The question is, what is the largest integer number N such that every whole number between -N and N inclusive can be represented as a float? Single precision commonly has 7 significant (decimal) digits. Double precision runs somewhere between 13 and 15 (decimal) significant digits If my tests are correct, that value is 9007199254740992.0 = 2**53. The expression 2 / sys.float_info.epsilon produces exactly that number. That's probably not a coincidence. For an encoding of a double precision using one sign bit and an 8-bit exponent, you have 53 bits available for the mantissa. If your floats have 64 bits, and you use 1 bit for the sign and 8 for the exponent, you'll have 55 bits available for the mantissa. This ignores the possibility of an implied msb in the mantissa (encodings which normalize to put the leading 1-bit at the msb can on some machines remove that 1-bit and shift the mantissa one more place; effectively giving a 54-bit mantissa). My machine has 64-bits floats, using 1 bit for the sign, 11 for the exponent, leaving 52 for the mantissa. The mantissa has an implied leading 1, so it's nominally 53 bits. You can find this number in sys.float_info.mant_dig Something like an old XDS Sigma-6 used non-binary exponents (exponent was in power of 16 2^4) and used non-normalized mantissa -- the mantissa could have up to three leading 0-bits); this affected the decimal significance... Your Sigma-6 must have sys.float_info.radix == 16 then. Hope this helps, -- HansM -- http://mail.python.org/mailman/listinfo/python-list
Re: Print Function
On Fri, 21 Sep 2012 14:54:14 -0600, Ian Kelly wrote: On Fri, Sep 21, 2012 at 2:28 PM, Rodrick Brown rodrick.br...@gmail.com wrote: Go away troll! Troll? It looked like a sincere question to me. but one that page 1 of the documentation would answer. -- Waste not, get your budget cut next year. -- http://mail.python.org/mailman/listinfo/python-list
Re: Exact integer-valued floats
On Fri, 21 Sep 2012 17:29:13 +, Steven D'Aprano wrote: Python floats can represent exact integer values (e.g. 42.0), but above a certain value (see below), not all integers can be represented. For example: py 1e16 == 1e16 + 1 # no such float as 10001.0 True py 1e16 + 3 == 1e16 + 4 # or 10003.0 True So some integers are missing from the floats. For large enough values, the gap between floats is rather large, and many numbers are missing: py 1e200 + 1e10 == 1e200 True The same applies for large enough negative values. The question is, what is the largest integer number N such that every whole number between -N and N inclusive can be represented as a float? If my tests are correct, that value is 9007199254740992.0 = 2**53. Have I got this right? Is there a way to work out the gap between one float and the next? (I haven't tried to exhaustively check every float because, even at one nanosecond per number, it will take over 200 days.) technically this would be implementation dependant, although the other responses are probably accurate for most (if not all) current implementations :-) -- Well, I'm a classic ANAL RETENTIVE!! And I'm looking for a way to VICARIOUSLY experience some reason to LIVE!! -- http://mail.python.org/mailman/listinfo/python-list
Re: Print Function
In db8c7111-8fc7-4884-8c58-987399f77...@googlegroups.com gengyang...@gmail.com writes: I am currently using Python 3.2.3 . WHen I use the print function by typing print Game Over , it mentions SyntaxError : invalid syntax . Any ideas on what the problem is and how to resolve it ? Thanks a lot . In python version 3, print was changed into a function. Use this and it will work: print(Game Over) -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, The Gashlycrumb Tinies -- http://mail.python.org/mailman/listinfo/python-list
Re: Functional way to compare things inside a list
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 different things. It just means when one is experimenting something the efficient execution in speed is not on focus yet. No, what you're describing is a prototype. It has nothing to do with functional programming at all. -- http://mail.python.org/mailman/listinfo/python-list I am pretty sure dihedral8 is a bot. -- http://mail.python.org/mailman/listinfo/python-list
Re: Functional way to compare things inside a list
A Ian於 2012年9月22日星期六UTC+8上午4時50分49秒寫道: 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 different things. It just means when one is experimenting something the efficient execution in speed is not on focus yet. No, what you're describing is a prototype. It has nothing to do with functional programming at all. A function with varaible arguments can be stored as a variable to functions called decorators in python to return enhanced functions. A function mapps a decorator to another decorator can be called a decorator map or a decorator maker in python. The closure level is guaranteed for decorators to be mapped by multi-levels of decorator mappers trivially in python. What do you want else for functional prgramming in python? -- http://mail.python.org/mailman/listinfo/python-list
Re: Obnoxious postings from Google Groups (was: datetime issue)
On Fri, 21 Sep 2012 15:07:09 +, Grant Edwards wrote: I told my news client years ago to filter out anything posted from Google Groups -- and I know I'm not alone. If one wants the best chance of getting a question answered, using something other than Google Groups is indeed a good idea. +1 -- http://mail.python.org/mailman/listinfo/python-list
technologies synergistic with Python
Greetings! What is the consensus... okay, okay -- what are some wide ranging opinions on technologies that I should know if my dream job is one that consists mostly of Python, and might allow telecommuting? (Please don't say Java, please don't say Java, please don't say... ;) ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list
Re: Exact integer-valued floats
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: Have I got this right? Is there a way to work out the gap between one float and the next? Yes, 53-bit mantissa as people have mentioned. That tells you what ints can be exactly represented. But, arithmetic in some situations can have a 1-ulp error. So I wonder if it's possible that if n is large enough, you might have something like n+1==n even if the integers n and n+1 have distinct floating point representations. -- http://mail.python.org/mailman/listinfo/python-list
Re: technologies synergistic with Python
On Sep 21, 2012, at 5:59 PM, Ethan Furman et...@stoneleaf.us wrote: Greetings! What is the consensus... okay, okay -- what are some wide ranging opinions on technologies that I should know if my dream job is one that consists mostly of Python, and might allow telecommuting? (Please don't say Java, please don't say Java, please don't say... ;) Django, JavaScript, HTML 5, JQuery, , SQL, Redis, Twisted ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Client Needs---QA Manual Tester at Sacramento, CA
Good Day, We have an urgent Contract Openings in Folsom, CA Looking forward to submit your resume for below mentioned Requirement… If you are interested, Please forward your latest resume along with location and pay rate details to r...@tech-netinc.com Job Title: QA Engineer(Strong Web services Experience Needed) Location: Sacramento, CA Duration: 2 Years Required: • Strong knowledge of SDLC • Manual testing experience should be 6+ years • Web services exp must be more than 4+ years • Solid background of software testing methods, processes, tools • Strong in XML,UNIX and SQL • Advance level knowledge and hands-on experience with Test Planning, Test Development, Test Data Setup, Test Execution and Test Reporting. • Knowledge of variety of testing methods and direct experience in test development and execution of functionality, integration, security, transaction, error handling, performance of web applications. • Expertise in testing web services API using Parasoft SOA Test or SOAP UI. • Hands-on experience with Quality Center/ALM 11. • Experience working in Windows and Unix (Linux) environments. • Team player with good mentoring and presentation skills Desired: • ISO or Electricity Industry experience • GUI and API test automation using HP Quick Test Pro • Load/performance test automation using HP Load Runner • Experience in integrating QTP, SOA Test, Load Runner or other test automation tools with HP Quality Center • Advance level experience in using and administering Quality Center, developing workflows to customize QC using VB Script. • Strong programming/scripting background in Java and Python. Able to code review and develop unit test if needed. Environment: JBoss, Groovy and Grails, Oracle 11g, SQL, XNL, Actuate, Reporting Services, SharePoint, Quality Center, Quick Test Pro, Load Runner, SOA Test, Windows, Linux. Thanks, Ram Dev Recruiter Tech-Net Inc. Tel: 916-458-4390 Ext 102 Email: r...@tech-netinc.com URL: www.tech-netinc.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Print Function
On Fri, Sep 21, 2012 at 3:11 PM, Alister alister.w...@ntlworld.com wrote: On Fri, 21 Sep 2012 14:54:14 -0600, Ian Kelly wrote: On Fri, Sep 21, 2012 at 2:28 PM, Rodrick Brown rodrick.br...@gmail.com wrote: Go away troll! Troll? It looked like a sincere question to me. but one that page 1 of the documentation would answer. So point the asker to the documentation, don't just dismiss them as a troll. This newsgroup has a reputation for being friendly. Let's keep it that way. -- http://mail.python.org/mailman/listinfo/python-list
Re: Blue Screen Python
On 09/21/2012 12:01 PM, Alister wrote: On Fri, 21 Sep 2012 15:14:53 +, Grant Edwards wrote: On 2012-09-21, mikcec82 michele.cec...@gmail.com wrote: Hallo to all, I'm using Python 2.7.3 with Windows 7 @ 64 bit and an Intel Core i3 -2350M CPU @2.30GHz 2.3GHz. Sometimes, when I'm programming in Python on my screen compare this Python is a user-space application. User-space applications can't cause blue-screens unless they manage to trigger a bug in hardware, OS kernel, or device driver. True. Too bad there are so many of those bugs. But Windows does not have any true concept of user-space (although it does make an almost convincing pretence) it has been hacked up from an operating system that's original security model was Lock the door when you leave the office That's not true at all. You're thinking of Windows 3, Windows 95, 98, and ME, which were hacked on top of MSDOS. But Windows NT3.5, 4, 2000, XP, Vista and Windows 7 have an entirely different bloodline. NT 3.51 was actually very robust, but in 4.0 to gain better performance, they apparently did some compromising in the video driver's isolation. And who knows what's happened since then. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: technologies synergistic with Python
i Rodrick Brown於 2012年9月22日星期六UTC+8上午6時33分59秒寫道: On Sep 21, 2012, at 5:59 PM, Ethan Furman et...@stoneleaf.us wrote: Greetings! What is the consensus... okay, okay -- what are some wide ranging opinions on technologies that I should know if my dream job is one that consists mostly of Python, and might allow telecommuting? (Please don't say Java, please don't say Java, please don't say... ;) Django, JavaScript, HTML 5, JQuery, , SQL, Redis, Twisted ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list I always prefer a computer language with a lot examples in the sources for all kinds of nontrivial applications. I am not interested in those trivial batches or shell programming scripts for novices. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to limit CPU usage in Python
On 20Sep2012 12:53, Terry Reedy tjre...@udel.edu wrote: | On 9/20/2012 12:46 PM, Terry Reedy wrote: | On 9/20/2012 11:12 AM, Rolando Cañer Roblejo wrote: | Is it possible for me to put a limit in the amount of processor usage (% | CPU) that my current python script is using? Is there any module useful | for this task? I saw Resource module but I think it is not the module I | am looking for. Some people recommend to use nice and cpulimit unix | tools, but those are external to python and I prefer a python solution. | I am working with Linux (Ubuntu 10.04). | | Call the external tools with subprocess.open. | | I meant to end that with ? as I don't know how easy it is to get the | external id of the calling process that is to be limited. I presume that | can be done by first calling ps (with subprocess) and searching the | piped-back output. If you're limiting yourself, os.getpid(). -- Cameron Simpson c...@zip.com.au -- http://mail.python.org/mailman/listinfo/python-list
Re: technologies synergistic with Python
On 09/21/12 17:33, Rodrick Brown wrote: What is the consensus... okay, okay -- what are some wide ranging opinions on technologies that I should know if my dream job is one that consists mostly of Python, and might allow telecommuting? Django, JavaScript, HTML 5, JQuery, , SQL, Redis, Twisted The only thing I might tweak in Rodrick's list is to broaden entries like Django to a web framework such as Django, Pyramid, web.py, or ... and Redis to a NoSQL database such as Redis, CouchDB, ... The others are pretty solid, even if I dislike JavaScript/ECMAScript as a language, jQuery makes it tolerable, it's the lingua-franca of the web. -tkc -- http://mail.python.org/mailman/listinfo/python-list
Re: Obnoxious postings from Google Groups (was: datetime issue)
On 2012-09-21 15:07:09 +, Grant Edwards said: I told my news client years ago to filter out anything posted from Google Groups -- and I know I'm not alone. If one wants the best chance of getting a question answered, using something other than Google Groups is indeed a good idea. What's that filter look like? --Hank -- http://mail.python.org/mailman/listinfo/python-list
Re: Print Function
On Fri, 21 Sep 2012 13:20:09 -0700, gengyangcai wrote: I am currently using Python 3.2.3 . WHen I use the print function by typing print Game Over , it mentions SyntaxError : invalid syntax . Any ideas on what the problem is and how to resolve it ? No, none what so ever. Perhaps you are the first person in the world to have come across this error. If you ever solve it, please write up the solution and put it on a blog or a website somewhere so that if it ever happens again, googling for python print SyntaxError will return a useful result. Tongue-firmly-in-cheek-ly y'rs, -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Functional way to compare things inside a list
On Fri, 21 Sep 2012 14:49:55 -0600, Ian Kelly 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 different things. For the record, the consensus here is that 8 Dihedral is probably a bot. It appears to be a pretty good bot, I haven't spotted it making any egregious or obvious grammatical mistakes, but the semantics of its posts don't seem quite human. 8 Dihedral, if you're not a bot, you can go a long way towards proving that by telling us what colour a purple elephant is. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Algorithms using Python?
On Fri, 21 Sep 2012 17:14:14 -0400, Dennis Lee Bieber wrote: On Fri, 21 Sep 2012 14:07:01 -0600, Ian Kelly ian.g.ke...@gmail.com declaimed the following in gmane.comp.python.general: It seems to work fine to me. You are working with dynamically allocated memory for the nodes; Doesn't everybody? :) I was envisioning the implementation of linked lists in what would have been statically allocated arrays (or one large dynamic memory block with all data tracking kept internally) (ie; a naive attempt using a Python list where nodes are [nxtIndex, data], and accidently removing a node from that list). Writing Fortran77 in Python! :) -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: One of my joomla webpages has been hacked. Please help.
On Sat, Sep 22, 2012 at 4:45 AM, Νίκος Γκρεεκ nikos.gr...@gmail.com wrote: One webpage of mine, http://www.varsa.gr/ has been *hacked* 15 mins ago. I know this is not a python question but you guyshave high knowledge of web sites programming and i though you wouldnt mind helping me out. No, this is not a Python question. I would recommend looking for Joomla-specific help. And when you do, you'll find out that these sorts of web frameworks have vulnerabilities just like every other big program seems to, with Joomla looking like a happy member of the Windows family. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Exact integer-valued floats
On Fri, 21 Sep 2012 15:23:41 -0700, Paul Rubin wrote: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: Have I got this right? Is there a way to work out the gap between one float and the next? Yes, 53-bit mantissa as people have mentioned. That tells you what ints can be exactly represented. But, arithmetic in some situations can have a 1-ulp error. So I wonder if it's possible that if n is large enough, you might have something like n+1==n even if the integers n and n+1 have distinct floating point representations. I don't think that is possible for IEEE 754 floats, where integer arithmetic is exact. But I'm not entirely sure, which is why I asked. For non IEEE 754 floating point systems, there is no telling how bad the implementation could be :( -- Steven -- http://mail.python.org/mailman/listinfo/python-list