Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-10 Thread nagia . retsina
Τη Κυριακή, 9 Ιουνίου 2013 3:31:44 μ.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε: > py> c = 'α' > py> ord(c) > 945 The number 945 is the characters 'α' ordinal value in the unicode charset correct? The command in the python interactive session to show me how many bytes this character will take u

Re: Re-using copyrighted code

2013-06-10 Thread Chris Angelico
On Mon, Jun 10, 2013 at 4:42 PM, Malte Forkel wrote: > Had I known in the beginning how convoluted things would become, I might > have considered two other options: Just publish or keep the code to > myself. But I still think, first understanding the legal aspects and > then publishing (to give b

Re: Re-using copyrighted code

2013-06-10 Thread Mark Janssen
>>> Can you provide any citations for your interpretation? Besides "that's >>> what the law should be", I mean. >> >> I don't think I even have to: the legal code you're citing above is >> not very clear, consistent, or well-defined at all. As such, it shows >> that this area remains an area that

Re: problem with if then

2013-06-10 Thread Jean Dubois
On 9 jun, 23:35, Roy Smith wrote: > In article > <20165c85-4cc3-4b79-943b-82443e4a9...@w7g2000vbw.googlegroups.com>, >  Jean Dubois wrote: > > > But, really, > > > once you've done all that (and it's worth doing as an exercise), rewrite > > > your code to use urllib2 or requests.  It'll be a lot

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-10 Thread Larry Hudson
On 06/09/2013 03:37 AM, Νικόλαος Κούρας wrote: I mean utf-8 could use 1 byte for storing the 1st 256 characters. I meant up to 256, not above 256. NO!! 0 - 127, yes. 128 - 255 -> one byte of a multibyte code. That's why the decode fails, it sees it as incomplete data so it can't do anythi

Re: Redirecting to a third party site with injected HTML

2013-06-10 Thread Fábio Santos
On 10 Jun 2013 07:58, "Guy Tamir" wrote: > since i wrote some extensions in the past that allowed me to change the DOM easily i thought there might be an way to do so from the server before redirecting the user.. There could be a way to do that, but some of the features in the target site would n

Re: Redirecting to a third party site with injected HTML

2013-06-10 Thread Denis McMahon
On Sun, 09 Jun 2013 10:09:17 -0700, guytamir1 wrote: > i'm not really sure how to approach this problem.. > hints :) Let me restate the problem for you: You want to display a web page to a visitor that exists on a third party website, with some of your own html inserted into it. Setting aside

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-10 Thread Νικόλαος Κούρας
Τη Δευτέρα, 10 Ιουνίου 2013 10:51:34 π.μ. UTC+3, ο χρήστης Larry Hudson έγραψε: > > I mean utf-8 could use 1 byte for storing the 1st 256 characters. I meant > > up to 256, not above 256. > 0 - 127, yes. > 128 - 255 -> one byte of a multibyte code. you mean that in utf-8 for 1 character to be s

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-10 Thread Andreas Perstinger
On 10.06.2013 09:10, nagia.rets...@gmail.com wrote: Τη Κυριακή, 9 Ιουνίου 2013 3:31:44 μ.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε: py> c = 'α' py> ord(c) 945 The number 945 is the characters 'α' ordinal value in the unicode charset correct? Yes, the unicode character set is just a big li

Re: Sorting a set works, sorting a dictionary fails ?

2013-06-10 Thread Νικόλαος Κούρας
What if i wanted to sort it out if alphabetically and not by the values? Thsi worked: for item in sorted(months.items(),key=lambda num : num[1]): but this failed: for item in sorted(months.items()): why? -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting a set works, sorting a dictionary fails ?

2013-06-10 Thread Νικόλαος Κούρας
Τη Δευτέρα, 10 Ιουνίου 2013 11:16:37 π.μ. UTC+3, ο χρήστης Νικόλαος Κούρας έγραψε: > What if i wanted to sort it out if alphabetically and not by the values? > > > > Thsi worked: > > > > for item in sorted(months.items(),key=lambda num : num[1]): > > > > but this failed: > > > > for it

Re: Sorting a set works, sorting a dictionary fails ?

2013-06-10 Thread Νικόλαος Κούρας
Trying this: months = { 'Ιανουάριος':1, 'Φεβρουάριος':2, 'Μάρτιος':3, 'Απρίλιος':4, 'Μάϊος':5, 'Ιούνιος':6, \ 'Ιούλιος':7, 'Αύγουστος':8, 'Σεπτέμβριος':9, 'Οκτώβριος':10, 'Νοέμβριος':11, 'Δεκέμβριος':12 } for key in sorted( months.values() ): print(''' %s

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-10 Thread Νικόλαος Κούρας
Τη Δευτέρα, 10 Ιουνίου 2013 11:15:38 π.μ. UTC+3, ο χρήστης Andreas Perstinger έγραψε: What is the difference between len('nikos') and len(b'nikos') First beeing the length of string nikos in characters while the second being the length of an ??? > The python interpreter will represent all valu

Re: Sorting a set works, sorting a dictionary fails ?

2013-06-10 Thread Fábio Santos
On 10 Jun 2013 09:34, "Νικόλαος Κούρας" wrote: > > Trying this: > > months = { 'Ιανουάριος':1, 'Φεβρουάριος':2, 'Μάρτιος':3, 'Απρίλιος':4, 'Μάϊος':5, 'Ιούνιος':6, \ >'Ιούλιος':7, 'Αύγουστος':8, 'Σεπτέμβριος':9, 'Οκτώβριος':10, 'Νοέμβριος':11, 'Δεκέμβριος':12 } > > for key in sorted( mo

Re: Sorting a set works, sorting a dictionary fails ?

2013-06-10 Thread Νικόλαος Κούρας
After many tried this did the job: for key in sorted(months.items(),key=lambda num : num[1]): print(''' %s ''' % (key[1], key[0]) ) but its really frustrating not being able to: for key in sorted( months.values() ): print(''' %s

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-10 Thread Νικόλαος Κούρας
> s = 'α' > s.encode('utf-8') > > b'\xce\xb1' 'b' stands for binary right? b'\xce\xb1' = we are looking at a byte in a hexadecimal format? if yes how could we see it in binary and decimal represenation? > > I see that the encoding of this char takes 2 bytes. But why two exactly

Re: Sorting a set works, sorting a dictionary fails ?

2013-06-10 Thread Fábio Santos
On 10 Jun 2013 10:53, "Νικόλαος Κούρας" wrote: > > After many tried this did the job: > > for key in sorted(months.items(),key=lambda num : num[1]): > print(''' > %s > ''' % (key[1], key[0]) ) > > > but its really frustrating not being able to: > > for key in sort

Re: Sorting a set works, sorting a dictionary fails ?

2013-06-10 Thread Ulrich Eckhardt
Am 10.06.2013 10:29, schrieb Νικόλαος Κούρας: for key in sorted( months.values() ): ^^^ ^^ KeyError 1 ??!! All i did was to tell python to sort the dictionary values, which are just integers. ...and which you then proceed to use as key, which is obviously wrong.

Re: Sorting a set works, sorting a dictionary fails ?

2013-06-10 Thread Ulrich Eckhardt
Am 10.06.2013 10:04, schrieb Νικόλαος Κούρας: months = { 'Ιανουάριος':1, 'Φεβρουάριος':2, 'Μάρτιος':3, 'Απρίλιος':4, 'Μάϊος':5, 'Ιούνιος':6, \ 'Ιούλιος':7, 'Αύγουστος':8, 'Σεπτέμβριος':9, 'Οκτώβριος':10, 'Νοέμβριος':11, 'Δεκέμβριος':12 } for key in sorted( months.keys() ): =

Re: Sorting a set works, sorting a dictionary fails ?

2013-06-10 Thread Νικόλαος Κούρας
Τη Δευτέρα, 10 Ιουνίου 2013 12:40:01 μ.μ. UTC+3, ο χρήστης Ulrich Eckhardt έγραψε: > Am 10.06.2013 10:29, schrieb Νικόλαος Κούρας: > > > for key in sorted( months.values() ): > >^^^ ^^ > > > > > KeyError 1 ??!! All i did was to tell python to sort the dictionary

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-10 Thread Andreas Perstinger
On 10.06.2013 11:59, Νικόλαος Κούρας wrote: s = 'α' s.encode('utf-8') > b'\xce\xb1' 'b' stands for binary right? No, here it stands for bytes: http://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals b'\xce\xb1' = we are looking at a byte in a hexadecim

Re: Reply to post 'Tryign to add a valkue to a set'

2013-06-10 Thread Νικόλαος Κούρας
>Τη Δευτέρα, 10 Ιουνίου 2013 12:40:01 μ.μ. UTC+3, ο χρήστης Ulrich Eckhardt έγραψε: for key in sorted( months.keys() ): print(''' %s ''' % (months[key], key) ) this in fact works, it sorts the dict by its keys() was mistaken before but the sorting aint correct

Encoding questions (continuation)

2013-06-10 Thread Νικόλαος Κούρας
Τη Δευτέρα, 10 Ιουνίου 2013 1:42:25 μ.μ. UTC+3, ο χρήστης Andreas Perstinger έγραψε: > >>> s = b'\xce\xb1' > > >>> s[0] > > 206 's' is a byte object, how can you treat it as a string asking to present you its first character? > > >>> s[1] > > 177 's' is a byte object, how can you treat i

Re: Encoding questions (continuation)

2013-06-10 Thread Steven D'Aprano
On Mon, 10 Jun 2013 14:13:00 +0300, Νικόλαος Κούρας wrote: > Τη Δευτέρα, 10 Ιουνίου 2013 1:42:25 μ.μ. UTC+3, ο χρήστης Andreas > Perstinger έγραψε: > > > >>> s = b'\xce\xb1' > > > > >>> s[0] > > > > 206 > > 's' is a byte object, how can you treat it as a string asking to present > you its

Re: Sorting a set works, sorting a dictionary fails ?

2013-06-10 Thread Steven D'Aprano
On Mon, 10 Jun 2013 03:42:38 -0700, Νικόλαος Κούρας wrote: > for key in sorted( months.values() ): > please tell me Uli why this dont work as expected to. Because values are not keys. You are looking at the values, and trying to use them as keys. months = {'Φεβρουάριος':2, 'Ιανουάριος':1} prin

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-10 Thread Steven D'Aprano
On Mon, 10 Jun 2013 00:10:38 -0700, nagia.retsina wrote: > Τη Κυριακή, 9 Ιουνίου 2013 3:31:44 μ.μ. UTC+3, ο χρήστης Steven D'Aprano > έγραψε: > >> py> c = 'α' >> py> ord(c) >> 945 > > The number 945 is the characters 'α' ordinal value in the unicode > charset correct? Correct. > The command i

Re: Re-using copyrighted code

2013-06-10 Thread Robert Kern
On 2013-06-08 22:31, Malte Forkel wrote: Hello, I have written a small utility to locate errors in regular expressions that I want to upload to PyPI. Before I do that, I would like to learn a litte more about the legal aspects of open-source software. What would be a good introductory reading?

Re: Reply to post 'Tryign to add a valkue to a set'

2013-06-10 Thread Ulrich Eckhardt
Am 10.06.2013 12:57, schrieb Νικόλαος Κούρας: >Τη Δευτέρα, 10 Ιουνίου 2013 12:40:01 μ.μ. UTC+3, ο χρήστης Ulrich Eckhardt έγραψε: for key in sorted( months.keys() ): print(''' %s ''' % (months[key], key) ) this in fact works, it sorts the dict by its keys()

Re: Sorting a set works, sorting a dictionary fails ?

2013-06-10 Thread Ulrich Eckhardt
Am 10.06.2013 11:48, schrieb Νικόλαος Κούρας: After many tried this did the job: for key in sorted(months.items(),key=lambda num : num[1]): print(''' %s ''' % (key[1], key[0]) ) This code is still sending a misleading message. What you are referring to as "ke

Newbie: question regarding references and class relationships

2013-06-10 Thread Rui Maciel
Let: - class Point be a data type which is used to define points in space - class Line be a data type which possesses an aggregate relationship with objects of type Point - class Model be a container class which stores collections of Point and Line objects Essentially, a Model object stores lis

Re: Reply to post 'Tryign to add a valkue to a set'

2013-06-10 Thread Νικόλαος Κούρας
Τη Δευτέρα, 10 Ιουνίου 2013 4:14:33 μ.μ. UTC+3, ο χρήστης Ulrich Eckhardt έγραψε: > Am 10.06.2013 12:57, schrieb Νικόλαος Κούρας: > > > >Τη Δευτέρα, 10 Ιουνίου 2013 12:40:01 μ.μ. UTC+3, ο χρήστης Ulrich > > > Eckhardt έγραψε: > > > > > > for key in sorted( months.keys() ): > > > pri

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Roy Smith
In article , Rui Maciel wrote: > Essentially, a Model object stores lists of Point objects and Line objects, > and Line objects include references to Point objects which represent the > starting and ending point of a line. > > class Point: > position = [] > > def __init__(sel

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Peter Otten
Rui Maciel wrote: > Let: > - class Point be a data type which is used to define points in space > - class Line be a data type which possesses an aggregate relationship with > objects of type Point > - class Model be a container class which stores collections of Point and > Line objects > > > Ess

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Rui Maciel
Roy Smith wrote: > Have you tried running the code you wrote? It does that already! When > you do something like: > > my_list = [obj1, obj2] > > in Python, the objects are stored by reference (not just lists, all > assignments are by reference). I've tested the following: model = Model() mo

Re: Encoding questions (continuation)

2013-06-10 Thread Νικόλαος Κούρας
Τη Δευτέρα, 10 Ιουνίου 2013 2:41:07 μ.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε: > On Mon, 10 Jun 2013 14:13:00 +0300, Νικόλαος Κούρας wrote: > > > > > Τη Δευτέρα, 10 Ιουνίου 2013 1:42:25 μ.μ. UTC+3, ο χρήστης Andreas > > > Perstinger έγραψε: > > > > > > > >>> s = b'\xce\xb1' > > > > >

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Rui Maciel
Peter Otten wrote: > Don't add > >>position = [] > > to your code. That's not a declaration, but a class attribute and in the > long run it will cause nothing but trouble. Why's that? Rui Maciel -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Rui Maciel
Rui Maciel wrote: > # Case B: this doesn't work > test.model.points[0] = test.Point(5,4,7) Disregard the "test." bit. I was testing the code by importing the definitions as a module. Rui Maciel -- http://mail.python.org/mailman/listinfo/python-list

Re: Reply to post 'Tryign to add a valkue to a set'

2013-06-10 Thread Νικόλαος Κούρας
Τη Δευτέρα, 10 Ιουνίου 2013 4:14:33 μ.μ. UTC+3, ο χρήστης Ulrich Eckhardt έγραψε: > Am 10.06.2013 12:57, schrieb Νικόλαος Κούρας: > > > >Τη Δευτέρα, 10 Ιουνίου 2013 12:40:01 μ.μ. UTC+3, ο χρήστης Ulrich > > > Eckhardt έγραψε: > > > > > > for key in sorted( months.keys() ): > > > pri

Re: Re-using copyrighted code

2013-06-10 Thread Ethan Furman
On 06/10/2013 05:57 AM, Robert Kern wrote: On 2013-06-08 22:31, Malte Forkel wrote: Hello, I have written a small utility to locate errors in regular expressions that I want to upload to PyPI. Before I do that, I would like to learn a litte more about the legal aspects of open-source software.

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Peter Otten
Rui Maciel wrote: > Peter Otten wrote: > >> Don't add >> >>>position = [] >> >> to your code. That's not a declaration, but a class attribute and in the >> long run it will cause nothing but trouble. > > Why's that? Especially with mutable attributes it's hard to keep track whether you are o

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-10 Thread Νικόλαος Κούρας
Τη Δευτέρα, 10 Ιουνίου 2013 2:59:03 μ.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε: > On Mon, 10 Jun 2013 00:10:38 -0700, nagia.retsina wrote: > > > > > Τη Κυριακή, 9 Ιουνίου 2013 3:31:44 μ.μ. UTC+3, ο χρήστης Steven D'Aprano > > > έγραψε: > > > > > >> py> c = 'α' > > >> py> ord(c) > > >> 9

Re: Reply to post 'Tryign to add a valkue to a set'

2013-06-10 Thread Νικόλαος Κούρας
Since dict.keys() return a list of the keys in the dict and the keys are associated with the dict's values why doesnt it work the other way around too? I'm talking about this: [code] for key in sorted( months.keys() ): print(''' %s ''' % (months[key], key)

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Rui Maciel
Peter Otten wrote: > Rui Maciel wrote: > >> Peter Otten wrote: >> >>> Don't add >>> position = [] >>> >>> to your code. That's not a declaration, but a class attribute and in the >>> long run it will cause nothing but trouble. >> >> Why's that? > > Especially with mutable attributes it's

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Peter Otten
Rui Maciel wrote: > How do you guarantee that any object of a class has a specific set of > attributes? You don't. Such a guarantee is like the third wheel on a bike -- it doesn't improve the overall experience. PS: I'd rather not mention the memory-saving technique that is sometimes abused,

testfixtures 3.0.1 Released!

2013-06-10 Thread Chris Withers
Hi All, I'm pleased to announce the release of testfixtures 3.0.1. This is a bug fix release featuring the following changes: - Some documentation tweaks and clarifications. - Fixed a bug which masked exceptions when using compare() with a broken generator. - Fixed a bug when comparing a g

Re: Reply to post 'Tryign to add a valkue to a set'

2013-06-10 Thread Ulrich Eckhardt
Am 10.06.2013 15:37, schrieb Νικόλαος Κούρας: Τη Δευτέρα, 10 Ιουνίου 2013 4:14:33 μ.μ. UTC+3, ο χρήστης Ulrich Eckhardt έγραψε: Am 10.06.2013 12:57, schrieb Νικόλαος Κούρας: Τη Δευτέρα, 10 Ιουνίου 2013 12:40:01 μ.μ. UTC+3, ο χρήστης Ulrich Eckhardt έγραψε: for key in sorted( months.ke

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Rui Maciel
Peter Otten wrote: > Rui Maciel wrote: > >> How do you guarantee that any object of a class has a specific set of >> attributes? > > You don't. What's your point regarding attribute assignments in class declarations, then? Rui Maciel -- http://mail.python.org/mailman/listinfo/python-list

py_compile vs. built-in compile, with __future__

2013-06-10 Thread dhyams
The built-in compile() function has a "flags" parameter that one can use to influence the "__future__" mechanism. However, py_compile.compile, which I'm using to byte-compile code, doesn't have an equivalent means to do this. Is this by design, or would this be considered a bug? I'm just wantin

Re: Reply to post 'Tryign to add a valkue to a set'

2013-06-10 Thread russ . pobox
for key, value in sorted(months.items(), key=lambda x:x[1]): print("""'\t%s'\n""" % (value, key)) Explanation: - - - - - - dict.items is a method associated with dicts just like dict.keys or dict.values, and returns a list of (key, value) pairs. sorted and some other builtin functions have

Questions on "import" and "datetime"

2013-06-10 Thread Yunfei Dai
Hi all, I have some questions on "import": 1."from datetime import datetime" works well. But I am confused why "import datetime.datetime" leads to importerror. "from xlrd import open_workbook" could be replaced by "from xlrd.open_workbook" without any problem. The only difference here is that

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Peter Otten
Rui Maciel wrote: > Peter Otten wrote: > >> Rui Maciel wrote: >> >>> How do you guarantee that any object of a class has a specific set of >>> attributes? >> >> You don't. > > > What's your point regarding attribute assignments in class declarations, > then? I don't understand the question.

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Rui Maciel
Peter Otten wrote: > I don't understand the question. My original point was that you should > omit class attributes that don't fulfill a technical purpose. > You've said the following: > class Point: Don't add > position = [] to your code. That's not a declaration, but a class attr

Re: Re-using copyrighted code

2013-06-10 Thread llanitedave
On Sunday, June 9, 2013 2:08:54 PM UTC-7, zipher wrote: > > > > Fair use has nothing to do with money. It depends on how the work is > > > used and how you've changed it. Weird Al's song parodies are fair use, > > > even though he sells them. > > > > That can't really be claimed without a ca

Re: Encoding questions (continuation)

2013-06-10 Thread Fábio Santos
On 10 Jun 2013 15:04, "Νικόλαος Κούρας" wrote: > > Τη Δευτέρα, 10 Ιουνίου 2013 2:41:07 μ.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε: > > On Mon, 10 Jun 2013 14:13:00 +0300, Νικόλαος Κούρας wrote: > > > > > > > > > Τη Δευτέρα, 10 Ιουνίου 2013 1:42:25 μ.μ. UTC+3, ο χρήστης Andreas > > > > > Persting

PDF in a Bottle - creating PDF using xtopdf, ReportLab, Bottle and Python

2013-06-10 Thread vasudevram
Hi list, Might be of interest: PDF in a Bottle - creating PDF using xtopdf, ReportLab, Bottle and Python http://jugad2.blogspot.in/2013/05/pdf-in-bottle-creating-pdf-using-xtopdf.html - Vasudev Ram Python, Linux and open source training and development www.dancingbison.com -- http://mail.py

Re: Questions on "import" and "datetime"

2013-06-10 Thread Zachary Ware
On Mon, Jun 10, 2013 at 10:37 AM, Yunfei Dai wrote: > Hi all, Hi Yunfei, > > I have some questions on "import": > > 1."from datetime import datetime" works well. But I am confused why "import > datetime.datetime" leads to importerror. "from xlrd import open_workbook" > could be replaced by "fr

Re: Simple converter of files into their hex components... but i can't arrange utf-8 parts!

2013-06-10 Thread blatt447477
Hi Chris, your critics are welcome! But perhaps the majority of them has been caused by font problems in my posting. Google should put as default a "mono" font! Or perhaps it has been a mistake on my part to not configure correctly the output of my post (I even didn't change my nickname... so you r

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Peter Otten
Rui Maciel wrote: > Peter Otten wrote: > >> I don't understand the question. My original point was that you should >> omit class attributes that don't fulfill a technical purpose. >> > > You've said the following: > > >> class Point: > > Don't add > >> position = [] > > to your cod

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Rui Maciel
Peter Otten wrote: > Have you read the code in the interpreter session I posted? > > If you do not agree that the demonstrated behaviour is puzzling I'll have > to drop my claim... I don't see how it should be puzzling. You've deleted the attribute, so it ceassed to exist. > Likewise if you

Build Python 2.7.5 - Modules missing

2013-06-10 Thread Walter Hurry
On building Python 2.7.5 I got the following message: Python build finished, but the necessary bits to build these modules were not found: dl imageoplinuxaudiodev spwd sunaudiodev To find the necessary bits, look in setup.py in

Re: Build Python 2.7.5 - Modules missing

2013-06-10 Thread Skip Montanaro
> It carried on with the installation OK, but I don't understand the last > sentence in the message. How can I find out exactly what modules are > missing, and what I need to do to make sure they are built next time? Some of them won't ever build, as they are platform-dependent. For example, if y

Popen and reading stdout in windows

2013-06-10 Thread Joseph L. Casale
I have a use where writing an interim file is not convenient and I was hoping to iterate through maybe 100k lines of output by a process as its generated or roughly anyways. Seems to be a common question on ST, and more easily solved in Linux. Anyone currently doing this with Python 2.7 in windows

Re: Questions on "import" and "datetime"

2013-06-10 Thread Dave Angel
On 06/10/2013 01:01 PM, Zachary Ware wrote: On Mon, Jun 10, 2013 at 10:37 AM, Yunfei Dai wrote: Hi all, Hi Yunfei, I have some questions on "import": 1."from datetime import datetime" works well. But I am confused why "import datetime.datetime" leads to importerror. "from xlrd import ope

Re: Popen and reading stdout in windows

2013-06-10 Thread Grant Edwards
On 2013-06-10, Joseph L. Casale wrote: > I have a use where writing an interim file is not convenient and I > was hoping to iterate through maybe 100k lines of output by a process > as its generated or roughly anyways. > > Seems to be a common question on ST, and more easily solved in Linux. > An

Re: Re-using copyrighted code

2013-06-10 Thread Joshua Landau
On 10 June 2013 17:29, llanitedave wrote: > However, I have yet to see an example of source code that qualifies as either > parody or satire under any standard. You should try reading Perl. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Dave Angel
On 06/10/2013 01:42 PM, Rui Maciel wrote: Peter Otten wrote: Have you read the code in the interpreter session I posted? If you do not agree that the demonstrated behaviour is puzzling I'll have to drop my claim... I don't see how it should be puzzling. You've deleted the attribute, so it c

Re: Re-using copyrighted code

2013-06-10 Thread Mark Janssen
> Weird Al can be a complex case, because sometimes his songs are true > parodies, and sometimes they're more satires. Parody has a pretty firm > history of being protected under fair use, and Weird Al's MJ-inspired songs > ("Fat" and "Eat It") are clearly parodies. (As is his more recent Lady

Re: Popen and reading stdout in windows

2013-06-10 Thread Dave Angel
On 06/10/2013 02:37 PM, Joseph L. Casale wrote: I have a use where writing an interim file is not convenient and I was hoping to iterate through maybe 100k lines of output by a process as its generated or roughly anyways. Seems to be a common question on ST, and more easily solved in Linux. Anyo

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-10 Thread jmfauth
- A coding scheme works with three sets. A *unique* set of CHARACTERS, a *unique* set of CODE POINTS and a *unique* set of ENCODED CODE POINTS, unicode or not. The relation between the set of characters and the set of the code points is a *human* table, created with a sheet of paper and a pe

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Terry Jan Reedy
On 6/10/2013 12:09 PM, Rui Maciel wrote: We've established that you don't like attribute declarations, at least those you describe as not fulfill a technical purpose. What I don't understand is why you claim that that would "cause nothing but trouble". Three answers: Look how much trouble it

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Terry Jan Reedy
On 6/10/2013 9:18 AM, Rui Maciel wrote: class Model: points = [] lines = [] Unless you actually need keep the points and lines ordered by entry order, or expect to keep sorting them by whatever, sets may be better than lists. Testing that a point or line is in the model wil

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Ian Kelly
On Mon, Jun 10, 2013 at 7:57 AM, Rui Maciel wrote: > # Case A: this works > model.points[0].position = [2,3,4] > line.points > > # Case B: this doesn't work > test.model.points[0] = test.Point(5,4,7) > line.points > > > > Is there a Python way of getting the same effect with Case B? It's inform

Re: Re-using copyrighted code

2013-06-10 Thread Chris Angelico
On Tue, Jun 11, 2013 at 5:40 AM, Mark Janssen wrote: >> Weird Al can be a complex case, because sometimes his songs are true >> parodies, and sometimes they're more satires. Parody has a pretty firm >> history of being protected under fair use, and Weird Al's MJ-inspired songs >> ("Fat" and "E

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Rui Maciel
Terry Jan Reedy wrote: > On 6/10/2013 9:18 AM, Rui Maciel wrote: > >> class Model: >> points = [] >> lines = [] > > Unless you actually need keep the points and lines ordered by entry > order, or expect to keep sorting them by whatever, sets may be better > than lists. Testing

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Rui Maciel
Terry Jan Reedy wrote: > Three answers: > Look how much trouble it has already caused ;-) > Since you are a self-declared newbie, believe us! > Since, be definition, useless code can do no good, it can only cause > trouble. Think about it. I don't doubt that there might good reasons for that, but

Re: Changing filenames from Greeklish => Greek (subprocess complain)

2013-06-10 Thread Ned Batchelder
On Monday, June 10, 2013 3:48:08 PM UTC-4, jmfauth wrote: > - > > > > A coding scheme works with three sets. A *unique* set > of CHARACTERS, a *unique* set of CODE POINTS and a *unique* > set of ENCODED CODE POINTS, unicode or not. > > The relation between the set of characters and the set

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Rui Maciel
Dave Angel wrote: > So why do you also have an instance attribute of the same name? Thanks to this thread, and after a bit of reading, I've finally managed to discover that in Python there are class attributes and instance attributes, the former working similarly to C++'s static member variable

Split a list into two parts based on a filter?

2013-06-10 Thread Roy Smith
I have a list, songs, which I want to divide into two groups. Essentially, I want: new_songs = [s for s in songs if s.is_new()] old_songs = [s for s in songs if not s.is_new()] but I don't want to make two passes over the list. I could do: new_songs = [] old_songs = [] for s in songs: if s.

Re: Re-using copyrighted code

2013-06-10 Thread llanitedave
On Monday, June 10, 2013 12:40:57 PM UTC-7, zipher wrote: > > Weird Al can be a complex case, because sometimes his songs are true > > parodies, and sometimes they're more satires. Parody has a pretty firm > > history of being protected under fair use, and Weird Al's MJ-inspired songs > > ("Fat

Re: py_compile vs. built-in compile, with __future__

2013-06-10 Thread Terry Jan Reedy
On 6/10/2013 11:33 AM, dhyams wrote: The built-in compile() function has a "flags" parameter that one can use to influence the "__future__" mechanism. However, py_compile.compile, which I'm using to byte-compile code, doesn't have an equivalent means to do this. That flag was added to compile b

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Terry Jan Reedy
On 6/10/2013 4:13 PM, Rui Maciel wrote: Terry Jan Reedy wrote: Three answers: Look how much trouble it has already caused ;-) Since you are a self-declared newbie, believe us! Since, be definition, useless code can do no good, it can only cause trouble. Think about it. I don't doubt that ther

Re: Encoding questions (continuation)

2013-06-10 Thread Lele Gaifax
Steven D'Aprano writes: >> I did but docs confuse me even more. Can you pleas ebut it simple. > > Nikos, if you can't be bothered to correct your spelling mistakes, why > should we be bothered to answer your questions? Maybe he just want to prove we are smart enough... http://www.foxnews.com/s

Re: py_compile vs. built-in compile, with __future__

2013-06-10 Thread dhyams
On Monday, June 10, 2013 4:59:35 PM UTC-4, Terry Jan Reedy wrote: > On 6/10/2013 11:33 AM, dhyams wrote: > > > The built-in compile() function has a "flags" parameter that one can > > > use to influence the "__future__" mechanism. However, > > > py_compile.compile, which I'm using to byte-compil

Re: py_compile vs. built-in compile, with __future__

2013-06-10 Thread Chris Angelico
On Tue, Jun 11, 2013 at 8:27 AM, dhyams wrote: > I guess I'll have to agree to disagree here...the situation I'm in is that I > want a user to be able to write a mathematical plugin with as little effort > as possible. So I want the "from __future__ import division" to be baked > into the plug

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Grant Edwards
On 2013-06-10, Terry Jan Reedy wrote: > Another principle similar to 'Don't add extraneous code' is 'Don't > rebind builtins'. OK, we've all done it by accident (especially when starting out), but are there people that rebind builtins intentionally? -- Grant Edwards grant.b.edwa

Re: Split a list into two parts based on a filter?

2013-06-10 Thread Roel Schroeven
Roy Smith schreef: I have a list, songs, which I want to divide into two groups. Essentially, I want: new_songs = [s for s in songs if s.is_new()] old_songs = [s for s in songs if not s.is_new()] but I don't want to make two passes over the list. I could do: new_songs = [] old_songs = [] for

Re: Split a list into two parts based on a filter?

2013-06-10 Thread Chris Angelico
On Tue, Jun 11, 2013 at 6:34 AM, Roy Smith wrote: > new_songs = [s for s in songs if s.is_new()] > old_songs = [s for s in songs if not s.is_new()] Hmm. Would this serve? old_songs = songs[:] new_songs = [songs.remove(s) or s for s in songs if s.is_new()] Python doesn't, AFAIK, have a "destruct

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Chris Angelico
On Tue, Jun 11, 2013 at 8:39 AM, Grant Edwards wrote: > On 2013-06-10, Terry Jan Reedy wrote: > >> Another principle similar to 'Don't add extraneous code' is 'Don't >> rebind builtins'. > > OK, we've all done it by accident (especially when starting out), but > are there people that rebind built

Re: Split a list into two parts based on a filter?

2013-06-10 Thread Chris Rebert
On Mon, Jun 10, 2013 at 1:34 PM, Roy Smith wrote: > I have a list, songs, which I want to divide into two groups. > Essentially, I want: > > new_songs = [s for s in songs if s.is_new()] > old_songs = [s for s in songs if not s.is_new()] > > but I don't want to make two passes over the list. I cou

Re: Split a list into two parts based on a filter?

2013-06-10 Thread Tim Chase
On 2013-06-11 08:50, Chris Angelico wrote: > The iterator version strikes my fancy. Maybe this isn't of use to > you, but I'm going to try my hand at making one anyway. > > >>> def iterpartition(pred,it): > """Partition an iterable based on a predicate. > > Returns two iterables, for

Re: Split a list into two parts based on a filter?

2013-06-10 Thread Chris Angelico
On Tue, Jun 11, 2013 at 9:10 AM, Tim Chase wrote: > On 2013-06-11 08:50, Chris Angelico wrote: >> The iterator version strikes my fancy. Maybe this isn't of use to >> you, but I'm going to try my hand at making one anyway. >> >> >>> def iterpartition(pred,it): >> """Partition an iterable bas

Re: Split a list into two parts based on a filter?

2013-06-10 Thread Fábio Santos
On 10 Jun 2013 23:54, "Roel Schroeven" wrote: > > You could do something like: > > new_songs, old_songs = [], [] > [(new_songs if s.is_new() else old_songs).append(s) for s in songs] > > But I'm not sure that that's any better than the long version. This is so beautiful! -- http://mail.python.or

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Tim Chase
On 2013-06-11 08:54, Chris Angelico wrote: > >> Another principle similar to 'Don't add extraneous code' is > >> 'Don't rebind builtins'. > > > > OK, we've all done it by accident (especially when starting out), > > but are there people that rebind builtins intentionally? > > There are times when

Re: Newbie: question regarding references and class relationships

2013-06-10 Thread Dave Angel
On 06/10/2013 06:54 PM, Chris Angelico wrote: On Tue, Jun 11, 2013 at 8:39 AM, Grant Edwards wrote: On 2013-06-10, Terry Jan Reedy wrote: Another principle similar to 'Don't add extraneous code' is 'Don't rebind builtins'. OK, we've all done it by accident (especially when starting out), b

Re: py_compile vs. built-in compile, with __future__

2013-06-10 Thread dhyams
On Monday, June 10, 2013 6:36:04 PM UTC-4, Chris Angelico wrote: > On Tue, Jun 11, 2013 at 8:27 AM, dhyams wrote: > > > I guess I'll have to agree to disagree here...the situation I'm in is that > > I want a user to be able to write a mathematical plugin with as little > > effort as possible.

Re: Split a list into two parts based on a filter?

2013-06-10 Thread Peter Otten
Chris Angelico wrote: > On Tue, Jun 11, 2013 at 6:34 AM, Roy Smith wrote: >> new_songs = [s for s in songs if s.is_new()] >> old_songs = [s for s in songs if not s.is_new()] > > Hmm. Would this serve? > > old_songs = songs[:] > new_songs = [songs.remove(s) or s for s in songs if s.is_new()] >

"Don't rebind built-in names*" - it confuses readers

2013-06-10 Thread Terry Jan Reedy
Many long-time posters have advised "Don't rebind built-in names*. * Unless you really mean to mask it, or more likely wrap it, such as wrapping print to modify some aspect of its operation than one cannot do with its keyword parameters. The point for this post is that such wrapping modify or

Re: "Don't rebind built-in names*" - it confuses readers

2013-06-10 Thread Mark Janssen
>> list = [] >> Reading further, one sees that the function works with two lists, a list of >> file names, unfortunately called 'list', > > That is very good advice in general: never choose a variable name > that is a keyword. Btw, shouldn't it be illegal anyway? Most compilers don't le

Re: "Don't rebind built-in names*" - it confuses readers

2013-06-10 Thread Tim Chase
On 2013-06-10 17:20, Mark Janssen wrote: > >> list = [] > >> Reading further, one sees that the function works with two > >> lists, a list of file names, unfortunately called 'list', > > > > That is very good advice in general: never choose a variable name > > that is a keyword. > > Btw,

Re: "Don't rebind built-in names*" - it confuses readers

2013-06-10 Thread Mark Janssen
> There's a subtle difference between a keyword and a built-in. Good > Python style generally avoids masking built-ins but allows it: Right, thank you for reminding me. My C-mind put them in the same category. -- MarkJ Tacoma, Washington -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >