Τη Κυριακή, 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
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
>>> 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
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
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
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
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
Τη Δευτέρα, 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
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
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
Τη Δευτέρα, 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
Trying this:
months = { 'Ιανουάριος':1, 'Φεβρουάριος':2, 'Μάρτιος':3, 'Απρίλιος':4,
'Μάϊος':5, 'Ιούνιος':6, \
'Ιούλιος':7, 'Αύγουστος':8, 'Σεπτέμβριος':9, 'Οκτώβριος':10,
'Νοέμβριος':11, 'Δεκέμβριος':12 }
for key in sorted( months.values() ):
print('''
%s
Τη Δευτέρα, 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
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
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
> 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
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
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.
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() ):
=
Τη Δευτέρα, 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
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
>Τη Δευτέρα, 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
Τη Δευτέρα, 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
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
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
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
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?
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()
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
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
Τη Δευτέρα, 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
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
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
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
Τη Δευτέρα, 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'
>
> > >
>
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
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
Τη Δευτέρα, 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
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.
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
Τη Δευτέρα, 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
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)
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
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,
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
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
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
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
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
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
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.
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
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
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
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
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
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
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
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
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
> 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
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
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
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
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
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
> 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
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
-
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
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
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
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
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
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
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
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
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
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.
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
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()]
>
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
>> 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
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,
> 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 - 100 of 117 matches
Mail list logo