TypeError: write_png() takes at most 3 arguments (5 given)

2016-03-19 Thread Hongyi Zhao
Hi all, I learn the DFT based the dft-book here: http://kitchingroup.cheme.cmu.edu/dft-book/dft.html I use anaconda, and installed the ase + pygtk as follows: conda install -c https://conda.anaconda.org/ska pygtk conda install -c https://conda.anaconda.org/jochym python-ase Now, I use iptyon

Re: How to waste computer memory?

2016-03-19 Thread Rustom Mody
On Sunday, March 20, 2016 at 10:32:07 AM UTC+5:30, Steven D'Aprano wrote: > On Sun, 20 Mar 2016 03:12 am, Marko Rauhamaa wrote: > > > Steven D'Aprano : > > > >> On Sun, 20 Mar 2016 02:02 am, Marko Rauhamaa wrote: > >>> Yes, but UTF-16 produces 16-bit values that are outside Unicode. > >> > >> Sho

Re: Beginner Python Help

2016-03-19 Thread Terry Reedy
On 3/18/2016 3:04 AM, Alan Gabriel wrote: Hey there, I just started out python and I was doing a activity > where im trying to find the max and min of a list of numbers i inputted. This is my code.. num=input("Enter list of numbers") input returns a string list1=(num.split()) list1 is

Re: sobering observation, python vs. perl

2016-03-19 Thread Marko Rauhamaa
"Charles T. Smith" : > I need the second check to also be a RE because it's not > separate tokens. The string "in" check doesn't care about tokens. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: How to waste computer memory?

2016-03-19 Thread Steven D'Aprano
On Sun, 20 Mar 2016 03:12 am, Marko Rauhamaa wrote: > Steven D'Aprano : > >> On Sun, 20 Mar 2016 02:02 am, Marko Rauhamaa wrote: >>> Yes, but UTF-16 produces 16-bit values that are outside Unicode. >> >> Show me. >> >> Before you answer, if your answer is "surrogate pairs", that is >> incorrect.

Re: How to waste computer memory?

2016-03-19 Thread sohcahtoa82
On Thursday, March 17, 2016 at 7:34:46 AM UTC-7, wxjm...@gmail.com wrote: > Very simple. Use Python and its (buggy) character encoding > model. > > How to save memory? > It's also very simple. Use a programming language, which > handles Unicode correctly. *looks at the other messages in this thre

Re: Case Statements

2016-03-19 Thread Steven D'Aprano
On Thursday 17 March 2016 16:45, Gregory Ewing wrote: > Steven D'Aprano wrote: >> On Thu, 17 Mar 2016 11:31 am, Chris Angelico wrote: >> >>>orig = globals()[cls.__name__] >> >> I wouldn't want to rely on it working with decorator syntax either. Even >> if it does now, I'm not sure that's a l

Re: Bash-like pipes in Python

2016-03-19 Thread Sivan Greenberg
If I understand correctly, the binary right or overloading that's seen here can be applied to any other computational objects. I could also think of implementing it for input / output pipes overloading the __ror__ method with .communicate() method of the Popen object [0]. -Sivan [0]: https://doc

Re: sobering observation, python vs. perl

2016-03-19 Thread BartC
On 17/03/2016 18:53, Marko Rauhamaa wrote: BartC : sub replacewith{ $s = $_[0]; $t = $_[1]; $u = $_[2]; $s =~ s/$t/$u/; return $s; } Although once done, the original task now looks a proper language: print (replacewith("I have a dream","have","had")); Now try your funct

Re: Case Statements

2016-03-19 Thread Chris Angelico
On Thu, Mar 17, 2016 at 8:23 PM, Antoon Pardon wrote: > Op 17-03-16 om 03:02 schreef Chris Angelico: >> On Thu, Mar 17, 2016 at 12:54 PM, Steven D'Aprano >> wrote: >> >>> I wouldn't want to rely on it working with decorator syntax either. Even if >>> it does now, I'm not sure that's a language g

Re: monkey patching __code__

2016-03-19 Thread Ian Kelly
On Mar 18, 2016 8:33 AM, "Sven R. Kunze" wrote: > > On 18.03.2016 14:47, Ian Kelly wrote: >> >> Your patched version takes two extra arguments. Did you add the >> defaults for those to the function's __defaults__ attribute? > > > That's it! :-) Thanks a lot. > > Just to understand this better: why

Re: Case Statements

2016-03-19 Thread Steven D'Aprano
On Thu, 17 Mar 2016 12:15 am, l0r0m0a0...@gmail.com wrote: > What hath I wrought? Dr Ray Stantz: Fire and brimstone coming down from the skies! Rivers and seas boiling! Dr Egon Spengler: Forty years of darkness! Earthquakes, volcanoes... Winston Zeddemore: The dead rising from the grave! Dr P

Re: submodules

2016-03-19 Thread Peter Otten
ast wrote: > Hello > > Since in python3 ttk is a submodule of tkinter, I was expecting this > to work: > > from tkinter import * > > root = Tk() > nb = ttk.Notebook(root) > > but it doesnt, ttk is not known. > > I have to explicitely import ttk with > > from tkinter import ttk > > why ? If

Re: sobering observation, python vs. perl

2016-03-19 Thread Charles T. Smith
On Thu, 17 Mar 2016 10:52:30 -0500, Tim Chase wrote: >> Not saying this will make a great deal of difference, but these two > items jumped out at me. I'd even be tempted to just use string > manipulations for the isready aspect as well. Something like > (untested) well, I don't want to forgo RE

Re: Bash-like pipes in Python

2016-03-19 Thread Marko Rauhamaa
Sivan Greenberg : > If I understand correctly, the binary right or overloading that's seen > here can be applied to any other computational objects. > > I could also think of implementing it for input / output pipes > overloading the __ror__ method with .communicate() method of the Popen > object

Re: sobering observation, python vs. perl

2016-03-19 Thread Marko Rauhamaa
"Charles T. Smith" : > well, I don't want to forgo REs in order to have python's numbers be > better http://stackoverflow.com/questions/12793562/text-processing-pytho n-vs-perl-performance> Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: How to waste computer memory?

2016-03-19 Thread Random832
On Fri, Mar 18, 2016, at 11:17, Ian Kelly wrote: > > Just to play devil's advocate, here, why is it so bad for indexing to be > > O(n)? Some simple caching is all that's needed to prevent it from making > > iteration O(n^2), if that's what you're worried about. > > What kind of caching do you ha

Re: empty clause of for loops

2016-03-19 Thread Chris Angelico
On Sat, Mar 19, 2016 at 7:49 AM, Sven R. Kunze wrote: > On 18.03.2016 20:10, Palpandi wrote: >> >> You can do like this. >> >> if not my_iterable: >> >> for x in my_iterable: >> > > > Thanks for you help here, however as already pointed out, my_iterable is not > necessarily a list but

Re: empty clause of for loops

2016-03-19 Thread Peter Otten
alister wrote: > On Wed, 16 Mar 2016 11:47:31 +0100, Peter Otten wrote: >> I'm kidding, of course. Keep it simple and use a flag like you would in >> any other language: >> >> empty = True: >> for item in items: >> empty = False ... >> if empty: >> ... > > or even use the loop variabl

Re: WP-A: A New URL Shortener

2016-03-19 Thread Daniel Wilcox
I dare say I'm with Rick on this point -- keep it up, go learn stuff, put things together and see how they break -- I think it's the best way to get feel for how things fit together and, somewhat inevitably, fall over (when the conditions they were designed in no longer apply). *quick glance at so

Re: How to waste computer memory?

2016-03-19 Thread Chris Angelico
On Fri, Mar 18, 2016 at 8:08 AM, Grant Edwards wrote: > On 2016-03-17, Chris Angelico wrote: >> On Fri, Mar 18, 2016 at 7:31 AM, wrote: >>> Rick Johnson wrote: In the event that i change my mind about Unicode, and/or for the sake of others, who may want to know, please provide a

Any sqledit/sqlkit users here?

2016-03-19 Thread cl
Does anyone here use sqledit/sqlkit? It's a sqlite database browser/editor which does most of its work by introspection (at least I think that's the right name for it). Thus it's trivially simple to write a gui program to edit data in a database:- #!/usr/bin/python from sqlkit.widgets i

Re: empty clause of for loops

2016-03-19 Thread Random832
On Wed, Mar 16, 2016, at 13:01, Sven R. Kunze wrote: > On 16.03.2016 17:56, Sven R. Kunze wrote: > > On 16.03.2016 17:37, Random832 wrote: > >> for item in collection: > >> if good(item): > >>thing = item > >>break > >> else: > >> thing = default # or raise an exception, etc

Re: How to waste computer memory?

2016-03-19 Thread Steven D'Aprano
On Sat, 19 Mar 2016 02:31 am, Random832 wrote: > On Fri, Mar 18, 2016, at 11:17, Ian Kelly wrote: >> > Just to play devil's advocate, here, why is it so bad for indexing to >> > be O(n)? Some simple caching is all that's needed to prevent it from >> > making iteration O(n^2), if that's what you're

Re: WP-A: A New URL Shortener

2016-03-19 Thread Thomas 'PointedEars' Lahn
Daniel Wilcox wrote: > Cool thanks, highly recommended to use an ORM to deter easy SQL > injections. That is to crack a nut with a sledgehammer. SQL injection can be easily and more efficiently prevented with prepared statements. While an Object- Relational Mapper (ORM) can use those, and the

Re: Descriptors vs Property

2016-03-19 Thread Ethan Furman
On 03/11/2016 09:59 PM, Veek. M wrote: A property uses the @property decorator and has @foo.setter @foo.deleter. A descriptor follows the descriptor protocol and implements the __get__ __set__ __delete__ methods. `property` is a descriptor combined with a decorator, so is a little more compl

Re: Case Statements

2016-03-19 Thread l0r0m0a0i0l
What hath I wrought? -- https://mail.python.org/mailman/listinfo/python-list

Re: How to waste computer memory?

2016-03-19 Thread Terry Reedy
On 3/18/2016 7:58 AM, Steven D'Aprano wrote: On Fri, 18 Mar 2016 10:46 pm, Steven D'Aprano wrote: I think it is typical of JMF that his idea of a language where Unicode "just works" is one where it *does work at all* (at least not as strings). Er, does NOT work at all. Python 1.5 strings su

RE: pdf version of python tutorial

2016-03-19 Thread Joaquin Alzola
Den 13-03-2016 kl. 14:45 skrev kamaraju kusumanchi: > Is there a pdf version of the python tutorial > https://docs.python.org/3/tutorial/index.html that I can download? The > idea is to have everything in one file so I can search easily, be able > to work offline. > > thanks > raju > >Try here: ht

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 16:02, Tim Chase wrote: On 2016-03-16 15:29, Sven R. Kunze wrote: I would re-use the "for-else" for this. Everything I thought I could make use of the "-else" clause, I was disappointed I couldn't. Hmm...this must be a mind-set thing. I use the "else" clause with for/while loops

Re: Bash-like pipes in Python

2016-03-19 Thread Omar Abou Mrad
On Wed, Mar 16, 2016 at 4:57 PM, Steven D'Aprano wrote: > There's a powerful technique used in shell-scripting languages like bash: > pipes. The output of one function is piped in to become the input to the > next function. > > According to Martin Fowler, this was also used extensively in Smallta

Re: Experimenting with PyPyJS

2016-03-19 Thread Salvatore DI DIO
Le samedi 19 mars 2016 19:52:45 UTC+1, Terry Reedy a écrit : > On 3/19/2016 1:06 PM, Salvatore DI DIO wrote: > > Le samedi 19 mars 2016 18:00:05 UTC+1, Vincent Vande Vyvre a écrit : > >> Le 19/03/2016 16:32, Salvatore DI DIO a écrit : > >>> Le samedi 19 mars 2016 16:28:36 UTC+1, Salvatore DI DIO a

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2016-03-19 Thread Ben Finney
anyanwuchukwueme...@gmail.com writes: > What was the final answer for the create class bankaccount question? The final answer is: homework entails that you do the work, not us. -- \ “I tell you the truth: some standing here will not taste death | `\before they see the Son of Man com

Re: Case Statements

2016-03-19 Thread BartC
On 16/03/2016 12:21, Marko Rauhamaa wrote: BartC : That's the first time I've heard a language feature common in C described as sexy. Scheme has a "switch" statement (a "case" form). However, it is slightly better equipped for it than Python: * Scheme has an atom type ("symbol"). It corre

Re: Bash-like pipes in Python

2016-03-19 Thread Stefan Otte
I use the pipe style a lot, but one of the annoyances is that many functions in the python standardlib expect the first argument to be a callable and the second an iterable. I tend to write a lot of "p-functions" (functions which switch that order and make them compatible to `pipe`). from pelper

Re: DSLs in perl and python (Was sobering observation)

2016-03-19 Thread Peter Otten
Rustom Mody wrote: > On Friday, March 18, 2016 at 4:17:06 AM UTC+5:30, MRAB wrote: >> Stick an "x" on the end of the regex: /something/x or s/old/new/x. > > Thanks! > > Is there somewhere a regexp 'introspection' API/capability available? > > ie if the re looks like > rexp = r""" > # DSL (insta

Re: monkey patching __code__

2016-03-19 Thread Matt Wheeler
On 18 March 2016 at 11:49, Sven R. Kunze wrote: > Hi, > > we got an interesting problem. We need to monkeypatch Django's reverse > function: > > > First approach: > > urlresolvers.reverse = patched_reverse > > > Problem: some of Django's internal modules import urlresolvers.reverse > before we can

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 18:08, Random832 wrote: Yeah, well, you can *almost* get there with: try: thing = next(item for item in collection if good(item)) except StopIteration: thing = default But the for/else thing seems like a more natural way to do it. Plus, this is a toy example, if the body

Re: Beginner Python Help

2016-03-19 Thread Martin A. Brown
Greetings Alan and welcome to Python, >I just started out python and I was doing a activity where im >trying to find the max and min of a list of numbers i inputted. > >This is my code.. > >num=input("Enter list of numbers") >list1=(num.split()) > >maxim= (max(list1)) >minim= (min(list1)) > >pri

Re: WP-A: A New URL Shortener

2016-03-19 Thread Chris Warrick
On 15 March 2016 at 20:56, Vinicius Mesel wrote: > Hey guys, > > I'm a 16 year old Python Programmer that wanted to do something different. > But, like we know, ideas are quite difficult to find. > So I decided to develop a URL Shortener to help the Python community out and > share my coding know

Re: monkey patching __code__

2016-03-19 Thread Ian Kelly
On Fri, Mar 18, 2016 at 9:01 AM, Sven R. Kunze wrote: > On 18.03.2016 15:48, Ian Kelly wrote: >> >> Well I didn't design it, so I'm not really sure. But it could be argued >> that the defaults are intrinsic to the function declaration, not the code >> object, as not all code objects even have argu

Re: monkey patching __code__

2016-03-19 Thread Sven R. Kunze
On 18.03.2016 14:47, Ian Kelly wrote: Your patched version takes two extra arguments. Did you add the defaults for those to the function's __defaults__ attribute? That's it! :-) Thanks a lot. Just to understand this better: why is that not part of the code object but part of the function?

Re: empty clause of for loops

2016-03-19 Thread Tim Chase
On 2016-03-16 11:23, Sven R. Kunze wrote: > for x in my_iterable: > # do > empty: > # do something else > > What's the most Pythonic way of doing this? If you can len() on it, then the obvious way is if my_iterable: for x in my_iterable: do_something(x) else: somethin

Re: Beautifulsoap

2016-03-19 Thread Joel Goldstick
On Wed, Mar 16, 2016 at 9:36 AM, wrote: > Greetings NG > > please I need a little help. > > I have this bs object tag: > > > > I want extract 5.69 > > Some have pity of me :-) > > Thanks > > > Show the code you have, and what isn't working. Which verision of python and BS > -- > https://mail.p

Python directory

2016-03-19 Thread Xerma Palmares
Hello, I have just downloaded Python latest version on to PC running windows 10. Unfortunately, after the completion of the download the Python icon was not showing up on the Desktop and could not found the Python files on the Programs folder either. I uninstalled Python, I will try it again. Thank

Re: Case Statements

2016-03-19 Thread Marko Rauhamaa
l0r0m0a0...@gmail.com: > Gratified to see that with all this back-and-forth this thread still > has a sense of humor. Perhaps, we can all just agree to disagree? :) I might agree with you if you tell me what we disagree about. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: sobering observation, python vs. perl

2016-03-19 Thread Marko Rauhamaa
"Charles T. Smith" : > Here's the programs: > > #!/usr/bin/env python > # vim: tw=0 > import sys > import re > > isready = re.compile ("(.*) is ready") > relreq = re.compile (".*release_req") > for fn in sys.argv[1:]: # logfile name > tn = None > with open (

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 11:47, Peter Otten wrote: What would you expect? A keyword filling the missing functionality? Some Python magic, I haven't seen before. ;-) class Empty(Exception): pass ... def check_empty(items): ... items = iter(items) ... try: ... yield next(items) ...

Re: sobering observation, python vs. perl

2016-03-19 Thread Charles T. Smith
On Thu, 17 Mar 2016 18:30:29 +0200, Marko Rauhamaa wrote: > "Charles T. Smith" : > >> I need the second check to also be a RE because it's not >> separate tokens. > > The string "in" check doesn't care about tokens. > > > Marko Ah, yes. Okay. -- https://mail.python.org/mailman/listinfo/pyt

Is this an error in python-babel or am I missing something?

2016-03-19 Thread cl
I am getting the following error when running some code that uses python-sqlkit. This uses python-babel to handle dates for different locales. Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/sqlkit-0.9.6.1-py2.7.egg/sqlkit/widgets/table/columns.py", lin

Re: What is the common technique used to cross-reference in module's method?

2016-03-19 Thread Peter Otten
jf...@ms4.hinet.net wrote: > There are two modules (say model.py and piece.py) which has methods need > to refer to each other module's methods. I saw in a book using the way > below, by assigning one (the Model) object to an attribute of the other > (the Piece) bject. - > ##model.py >

retrieve key of only element in a dictionary (Python 3)

2016-03-19 Thread Fillmore
I must be missing something simple, but... Python 3.4.0 (default, Apr 11 2014, 13:05:11) [GCC 4.8.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> d = dict() >>> d['squib'] = "007" >>> # I forget that 'squib' is my key to retrieve the only element in d ... >

Re: from a module return a class

2016-03-19 Thread Laurent Pointal
John Gordon wrote: > In > kevind0...@gmail.com writes: > >> ## prompt the user for a User name a& pWord >> user_pword = promptUser_PWord() > >> I get the error >> File "H:\dev\eclipse\workspace\genXls\src\genXls\promptUser_PWord.py", >> line 58 >> return user_pword >> SyntaxErr

Re: from a module return a class

2016-03-19 Thread kevind0718
On Thursday, March 17, 2016 at 1:21:16 PM UTC-4, John Gordon wrote: > In > kevind0...@gmail.com writes: > > > ## prompt the user for a User name a& pWord > > user_pword = promptUser_PWord() > > > I get the error > > File "H:\dev\eclipse\workspace\genXls\src\genXls\promptUser_PWor

Re: retrieve key of only element in a dictionary (Python 3)

2016-03-19 Thread Tim Chase
On 2016-03-18 17:33, Fillmore wrote: > >>> d = dict() > >>> d['squib'] = "007" > >>> key = d.items()[0] I posted a similar question about 1-element-sets[1] a while back and Peter Otten & Rene Pijlman both suggested >>> s = set(["hello"]) >>> element, = s which, in your case would translate t

Re: Replace weird error message?

2016-03-19 Thread Chris Angelico
On Thu, Mar 17, 2016 at 5:39 AM, Joel Goldstick wrote: > can you show the complete code? It doesn't start with "{:02} I don't think Actually, yes it does; I can confirm the OP's concern: $ python3 Python 3.6.0a0 (default:ae76a1046bb9, Mar 17 2016, 05:45:31) [GCC 5.3.1 20160121] on linux Type "h

Re: sobering observation, python vs. perl

2016-03-19 Thread Marko Rauhamaa
BartC : > On 17/03/2016 18:53, Marko Rauhamaa wrote: >> BartC : > >>> sub replacewith{ >>> $s = $_[0]; >>> $t = $_[1]; >>> $u = $_[2]; >>> $s =~ s/$t/$u/; >>> return $s; >>> } >>> >>> Although once done, the original task now looks a proper language: >>> >>> print (replacewith(

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 18.03.2016 20:10, Palpandi wrote: You can do like this. if not my_iterable: for x in my_iterable: Thanks for you help here, however as already pointed out, my_iterable is not necessarily a list but more likely an exhaustible iterator/generator. Best, Sven -- https://mail.pyth

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2016-03-19 Thread Mark Lawrence
On 19/03/2016 21:40, anyanwuchukwueme...@gmail.com wrote: What was the final answer for the create class bankaccount question? 42. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listi

Re: empty clause of for loops

2016-03-19 Thread Peter Otten
André Roberge wrote: > On Wednesday, 16 March 2016 07:23:48 UTC-3, Sven R. Kunze wrote: >> Hi, >> >> a colleague of mine (I write this mail because I am on the list) has the >> following issue: >> >> >> for x in my_iterable: >> # do >> empty: >> # do something else >> >> >> What's

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2016-03-19 Thread Joel Goldstick
On Sat, Mar 19, 2016 at 5:40 PM, wrote: > What was the final answer for the create class bankaccount question? > -- > https://mail.python.org/mailman/listinfo/python-list > Was it 14? -- Joel Goldstick http://joelgoldstick.com/ http://cc-baseballstat

Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

2016-03-19 Thread anyanwuchukwuemeka9
What was the final answer for the create class bankaccount question? -- https://mail.python.org/mailman/listinfo/python-list

Re: WP-A: A New URL Shortener

2016-03-19 Thread Mark Lawrence
On 17/03/2016 22:34, Daniel Wilcox wrote: +list You will be far more welcome here if you intersperse your replies or bottom post. Top posting is very heavily frowned upon. Thanks. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Ma

Re: Bash-like pipes in Python

2016-03-19 Thread Chris Angelico
On Thu, Mar 17, 2016 at 4:04 AM, Marko Rauhamaa wrote: > Question: Could the generators define __repr__ so you wouldn't need to > terminate the pipeline with "List" in interactive use? No no no no. You do NOT want __repr__ to fundamentally change the state of the object (which it would in that ca

Re: AIX build and (potentially missing modules

2016-03-19 Thread Terry Reedy
On 3/17/2016 7:02 PM, Michael Felt wrote: I have been packaging python for AIX - and wanting minimal dependancies I have been ignoring the final messages from make. You must be packaging 2.x rathar than 3.x Personally, I do not see any real harm in the missing *audio "bits", but how terrible

Re: How to waste computer memory?

2016-03-19 Thread Mark Lawrence
On 17/03/2016 21:13, Chris Angelico wrote: You can pretend that only 1 and 0 are enough. Good luck making THAT work. ChrisA The sales and marketing "thing", for lack of a better expression, that was used in the UK by Racal Telecommunications during the 1990s. Well I'm telling a fib, IIRC

Re: Case Statements

2016-03-19 Thread Steven D'Aprano
On Wed, 16 Mar 2016 09:34 pm, BartC wrote: > (BTW why does Python have 'elif' when if-else is all that is really > needed?) To save indentation. if condition: block else: if other: block else: if third: block else: block versus: if

Re: How to waste computer memory?

2016-03-19 Thread Mark Lawrence
On 18/03/2016 21:02, Marko Rauhamaa wrote: Chris Angelico : On Sat, Mar 19, 2016 at 2:26 AM, Marko Rauhamaa wrote: It may be that Python's Unicode abstraction is an untenable illusion because the underlying reality is 8-bit and there's no way to hide it completely. The underlying reality is

file -SAS

2016-03-19 Thread Val Krem via Python-list
Hi all, I am trying to read sas7bdat file using the following from sas7bdat import SAS7BDAT with SAS7BDAT('test.sas7bdat') as f: for row in f: print row ### I want print the first 10 row. how can I do that? I got error message of from sas7bdat import SAS7BDAT ImportError: No mo

Re: Simple exercise

2016-03-19 Thread boffi
Rodrick Brown writes: > BANANA FRIES 12 > POTATO CHIPS 30 > APPLE JUICE 10 > CANDY 5 > APPLE JUICE 10 > CANDY 5 > CANDY 5 > CANDY 5 > POTATO CHIPS 30 > > I'm expecting the following output > BANANA FRIES 12 > POTATO CHIPS 60 > APPLE JUICE 20 > CANDY 20 >>> data =["BANANA FRIES 12", ..."P

Re: empty clause of for loops

2016-03-19 Thread Sven R. Kunze
On 16.03.2016 13:57, Peter Otten wrote: I'd put that the other way round: syntactical support for every pattern would make for a rather unwieldy language. You have to choose carefully, and this requirement could easily be fulfilled by a function, first in your personal toolbox, then in a public

Re: WP-A: A New URL Shortener

2016-03-19 Thread Rick Johnson
On Thursday, March 17, 2016 at 1:28:05 PM UTC-5, Thomas 'PointedEars' Lahn wrote: > BTW and JFTR, this thread has gone *way* off topic. Who cares? Python-list is not a "strictly moderated group". So long as the discussion is informative, or heck, even entertaining, no crime has been committed.

Re: from a module return a class

2016-03-19 Thread John Gordon
In <56eaecc8$0$3658$426a7...@news.free.fr> Laurent Pointal writes: > >> user_pword = promptUser_PWord() > > > > Show us the complete definition of promptUser_PWord(). > AFAIU It looks to be the module… If it were a module, it wouldn't be callable. It has to be a function or a class. -

Re: Case Statements

2016-03-19 Thread Mark Lawrence
On 16/03/2016 19:41, BartC wrote: On 16/03/2016 09:51, Mark Lawrence wrote: On 16/03/2016 09:35, Antoon Pardon wrote: So I guess those who would like a case statement in Python can only hope a core developer gets bitten by a nasty bug while using one of those ways of simulating switches. S

Re: Case Statements

2016-03-19 Thread Steven D'Aprano
On Thu, 17 Mar 2016 10:14 am, Chris Angelico wrote: > On Thu, Mar 17, 2016 at 5:31 AM, Antoon Pardon > wrote: >> It can be yes. Look at decorators. They don't provide functionality >> we wouldn't have without them. > > Really? Okay, try implementing this without decorators: [...] > @monkeypatc

Enc: Re: WP-A: A New URL Shortener

2016-03-19 Thread Vinicius Mesel
Hi Chris, Thanks for giving me the tip to reply to everyone in the list. So, I'll be implementing the anti-injection code in this next version that is going to come out. The SQL Schema is going to be shown in the README.md when it gets ready I'll tell to you. Thanks for getting involved with t

Re: Encapsulation in Python

2016-03-19 Thread BartC
On 16/03/2016 00:39, BartC wrote: On 15/03/2016 21:02, Christian Gollwitzer wrote: Nevertheless, why don't you setup a repository on an open source server, say github, and post your language implementation there? Actually I would try it out to see how it compares to other dynamic languages, es

Re: Case Statements

2016-03-19 Thread Chris Angelico
On Thu, Mar 17, 2016 at 11:19 AM, Steven D'Aprano wrote: > On Thu, 17 Mar 2016 10:14 am, Chris Angelico wrote: > >> On Thu, Mar 17, 2016 at 5:31 AM, Antoon Pardon >> wrote: >>> It can be yes. Look at decorators. They don't provide functionality >>> we wouldn't have without them. >> >> Really? Oka

Re: Case Statements

2016-03-19 Thread Marko Rauhamaa
BartC : > On 16/03/2016 11:07, Mark Lawrence wrote: >> but I still very much doubt we'll be adding a switch statement -- >> it's a "sexy" language design issue > > That's the first time I've heard a language feature common in C > described as sexy. Scheme has a "switch" statement (a "case" form).

Re: How to waste computer memory?

2016-03-19 Thread cl
Gene Heskett wrote: > On Thursday 17 March 2016 17:37:02 alister wrote: > > > On Fri, 18 Mar 2016 07:42:30 +1100, Chris Angelico wrote: > > > On Fri, Mar 18, 2016 at 7:31 AM, wrote: > > >> Rick Johnson wrote: > > >>> In the event that i change my mind about Unicode, and/or for the > > >>> sake

Re: How to waste computer memory?

2016-03-19 Thread Marko Rauhamaa
Chris Angelico : > On Sat, Mar 19, 2016 at 2:26 AM, Marko Rauhamaa wrote: >> It may be that Python's Unicode abstraction is an untenable illusion >> because the underlying reality is 8-bit and there's no way to hide it >> completely. > > The underlying reality is 1-bit. Or maybe the underlying rea

Re: empty clause of for loops

2016-03-19 Thread Peter Otten
Tim Chase wrote: > On 2016-03-16 16:53, Peter Otten wrote: >> > item=None >> > for item in items: >> > #do stuff >> if item is None: >> > #do something else >> >> I like that better now I see it. > > The only problem with that is if your iterable returns None as the > last item

ANN: zerodb Google Hangout on March 22nd. End-to-end DB encryption

2016-03-19 Thread MacLane & Michael
The ZeroDB team will be hosting an OpenSource Community Google Hangout on March 22, 2016 ZeroDB: An end-to-end encrypted database based on ZODB & written in Python. == 1) Introduction to ZeroDB Founders & Developer community 2) Reca

Re: Case Statements

2016-03-19 Thread BartC
On 16/03/2016 21:43, Mark Lawrence wrote: On 16/03/2016 19:41, BartC wrote: That article appears to try to do without using a new switch byte-code, as the author doesn't see the point. My code to implement a 'switch' byte-code (for integer expression and constant integer case-expressions) is b

Re: Case Statements

2016-03-19 Thread l0r0m0a0i0l
Gratified to see that with all this back-and-forth this thread still has a sense of humor. Perhaps, we can all just agree to disagree? :) -- https://mail.python.org/mailman/listinfo/python-list

Re: sobering observation, python vs. perl

2016-03-19 Thread Steven D'Aprano
On Fri, 18 Mar 2016 03:08 am, Charles T. Smith wrote: > On Thu, 17 Mar 2016 10:52:30 -0500, Tim Chase wrote: > >>> Not saying this will make a great deal of difference, but these two >> items jumped out at me. I'd even be tempted to just use string >> manipulations for the isready aspect as well

Re: sobering observation, python vs. perl

2016-03-19 Thread Marko Rauhamaa
BartC : > I was going to suggest just using a function. But never having coded in > Perl before, I wasn't expecting something this ugly: > > sub replacewith{ >$s = $_[0]; >$t = $_[1]; >$u = $_[2]; >$s =~ s/$t/$u/; >return $s; > } > > Although once done, the original task now lo

Re: Case Statements

2016-03-19 Thread Gregory Ewing
Chris Angelico wrote: So maybe it's a language guarantee that hasn't been written down somewhere, The Language Reference says: [the decorator] is invoked with the function object as the only argument. The returned value is bound to the function name instead of the function object. The "

Re: Beginner Python Help

2016-03-19 Thread Jussi Piitulainen
Terry Reedy writes: > On 3/18/2016 3:04 AM, Alan Gabriel wrote: ... >> list1=(num.split()) > > list1 is a list of strings > >> maxim= (max(list1)) >> minim= (min(list1)) > > min and max compare the strings as strings, lexicographically > >> print(minim, maxim) ... > You failed to convert strin

Re: How to waste computer memory?

2016-03-19 Thread cl
Grant Edwards wrote: > On 2016-03-17, Chris Angelico wrote: > > On Fri, Mar 18, 2016 at 7:31 AM, wrote: > >> Rick Johnson wrote: > >>> > >>> In the event that i change my mind about Unicode, and/or for > >>> the sake of others, who may want to know, please provide a > >>> list of languages tha

Re: Is this an error in python-babel or am I missing something?

2016-03-19 Thread Rick Johnson
On Thursday, March 17, 2016 at 5:48:12 PM UTC-5, c...@isbd.net wrote: > So, my mistake, but python-babel should have caught it. Yeah, errors like that are a real pisser, and the further away from the source that they break, the more headache they become to resolve. They send you on a wild goose

Usenet Message-ID (was Re: How to waste computer memory?)

2016-03-19 Thread Random832
On Fri, Mar 18, 2016, at 15:46, Tim Golden wrote: > Speaking for a moment as the list owner. Posts by this OP are usually > blatant provocation and I usually filter them out before they hit the > list. (They'll still appear if you're reading via Usenet). In this case > I approved a post thinking

Re: Experimenting with PyPyJS

2016-03-19 Thread Terry Reedy
On 3/19/2016 1:06 PM, Salvatore DI DIO wrote: Le samedi 19 mars 2016 18:00:05 UTC+1, Vincent Vande Vyvre a écrit : Le 19/03/2016 16:32, Salvatore DI DIO a écrit : Le samedi 19 mars 2016 16:28:36 UTC+1, Salvatore DI DIO a écrit : Hy all, I am experimenting PyPyJS and found it not so bad at all

Re: Another python question

2016-03-19 Thread sohcahtoa82
On Friday, March 18, 2016 at 3:46:44 PM UTC-7, Alan Gabriel wrote: > Sorry for the multiple questions but my while loop is not working as intended. > > Here is the code : > n = 1 > list1 = [] > count = 0 #amount of times program repeats > steps = 0 # amount of steps to reach 1 > step_list = [] >

Re: How to waste computer memory?

2016-03-19 Thread Grant Edwards
On 2016-03-17, Chris Angelico wrote: > On Fri, Mar 18, 2016 at 7:31 AM, wrote: >> Rick Johnson wrote: >>> >>> In the event that i change my mind about Unicode, and/or for >>> the sake of others, who may want to know, please provide a >>> list of languages that *YOU* think handle Unicode better

Re: Bash-like pipes in Python

2016-03-19 Thread Steven D'Aprano
On Thu, 17 Mar 2016 04:04 am, Marko Rauhamaa wrote: > Steven D'Aprano : > >> Here is a way to do functional-programming-like pipelines to collect >> and transform values from an iterable: >> >> https://code.activestate.com/recipes/580625-collection-pipeline-in-python/ > > Nice. The other day we

Re: Bash-like pipes in Python

2016-03-19 Thread Random832
On Wed, Mar 16, 2016, at 10:57, Steven D'Aprano wrote: > For instance, we can take a string, extract all the digits, convert them > to > ints, and finally multiply the digits to give a final result: > > py> from operator import mul > py> "abcd12345xyz" | Filter(str.isdigit) | Map(int) | Reduce(m

Re: Case Statements

2016-03-19 Thread Antoon Pardon
Op 17-03-16 om 03:02 schreef Chris Angelico: > On Thu, Mar 17, 2016 at 12:54 PM, Steven D'Aprano wrote: > >> I wouldn't want to rely on it working with decorator syntax either. Even if >> it does now, I'm not sure that's a language guarantee. > That's the thing, though. It's not a guarantee, yet i

Re: empty clause of for loops

2016-03-19 Thread Peter Otten
Sven R. Kunze wrote: > On 16.03.2016 11:47, Peter Otten wrote: >> >> What would you expect? > > A keyword filling the missing functionality? Some Python magic, I > haven't seen before. ;-) > >> > class Empty(Exception): pass >> ... > def check_empty(items): >> ... items = iter(items)

Bug in embeddable code or in my code?

2016-03-19 Thread Sgoodman
Hi, When I run the code below, I manage to execute certain python code but not some simple imports. For example, the code below... (I removed some error checking/reference checks for brevity) // ... Py_SetProgramName(L"A"); Py_SetPath(L"path\\to\\python35.zip"); // embeddable

  1   2   3   >