Hi,
I have uploaded greenlet 0.4.1 to PyPI:
https://pypi.python.org/pypi/greenlet
What is it?
---
The greenlet module provides coroutines for python. coroutines allow
suspending and resuming execution at certain locations.
concurrence[1], eventlet[2] and gevent[3] use the greenlet
Am 10.06.2013 07:31, schrieb Steven D'Aprano:
But bringing it back to the original topic, I believe that the philosophy
of FOSS is that we should try our best to honour the intentions of the
writer, not to find some legal loophole that permits us to copy his or
her work against their
On Sunday, June 9, 2013 9:24:56 PM UTC+3, Ian wrote:
On 09/06/2013 18:09, guytam...@gmail.com wrote:
Hi all,
new to group and pretty new to python.
I'm working on a new project and i want to receive a request from a user
and to redirect him to a third party site, but on the
Τη Κυριακή, 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 upon
On Mon, Jun 10, 2013 at 4:42 PM, Malte Forkel malte.for...@berlin.de 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
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 has yet to be
On 9 jun, 23:35, Roy Smith r...@panix.com wrote:
In article
20165c85-4cc3-4b79-943b-82443e4a9...@w7g2000vbw.googlegroups.com,
Jean Dubois jeandubois...@gmail.com wrote:
But, really,
once you've done all that (and it's worth doing as an exercise), rewrite
your code to use urllib2 or
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
On 10 Jun 2013 07:58, Guy Tamir guytam...@gmail.com 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
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 stored,
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
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 item in
Trying this:
months = { 'Ιανουάριος':1, 'Φεβρουάριος':2, 'Μάρτιος':3, 'Απρίλιος':4,
'Μάϊος':5, 'Ιούνιος':6, \
'Ιούλιος':7, 'Αύγουστος':8, 'Σεπτέμβριος':9, 'Οκτώβριος':10,
'Νοέμβριος':11, 'Δεκέμβριος':12 }
for key in sorted( months.values() ):
print('''
option
Τη Δευτέρα, 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
On 10 Jun 2013 09:34, Νικόλαος Κούρας nikos.gr...@gmail.com wrote:
Trying this:
months = { 'Ιανουάριος':1, 'Φεβρουάριος':2, 'Μάρτιος':3, 'Απρίλιος':4,
'Μάϊος':5, 'Ιούνιος':6, \
'Ιούλιος':7, 'Αύγουστος':8, 'Σεπτέμβριος':9, 'Οκτώβριος':10,
'Νοέμβριος':11, 'Δεκέμβριος':12 }
for key
After many tried this did the job:
for key in sorted(months.items(),key=lambda num : num[1]):
print('''
option value=%s %s /option
''' % (key[1], key[0]) )
but its really frustrating not being able to:
for key in sorted( months.values() ):
print('''
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?
How do i
On 10 Jun 2013 10:53, Νικόλαος Κούρας nikos.gr...@gmail.com wrote:
After many tried this did the job:
for key in sorted(months.items(),key=lambda num : num[1]):
print('''
option value=%s %s /option
''' % (key[1], key[0]) )
but its really frustrating not
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 values,
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 hexadecimal
Τη Δευτέρα, 10 Ιουνίου 2013 12:40:01 μ.μ. UTC+3, ο χρήστης Ulrich
Eckhardt έγραψε:
for key in sorted( months.keys() ):
print('''
option value=%s %s /option
''' % (months[key], key) )
this in fact works, it sorts the dict by its keys() was mistaken before
but
Τη Δευτέρα, 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 it as a string
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 first character?
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}
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 in the python
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('''
option value=%s %s /option
''' % (months[key], key) )
this in fact works, it sorts
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('''
option value=%s %s /option
''' % (key[1], key[0]) )
This code is still sending a misleading message. What you
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
Τη Δευτέρα, 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() ):
print('''
In article kp4jf4$5fu$1...@dont-email.me,
Rui Maciel rui.mac...@gmail.com 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:
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
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:
code
model = Model()
Τη Δευτέρα, 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'
s[0]
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() ):
print('''
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
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
operating on the
Τη Δευτέρα, 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)
945
The number
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('''
option value=%s %s /option
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 hard to keep track whether
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
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(
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 wanting
for key, value in sorted(months.items(), key=lambda x:x[1]):
print('\toption value%s%s/option'\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
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 if from
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. My original point
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:
quote
class Point:
Don't add
position = []
to your code. That's not a declaration, but a class
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 case being
On 10 Jun 2013 15:04, Νικόλαος Κούρας nikos.gr...@gmail.com 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
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
--
On Mon, Jun 10, 2013 at 10:37 AM, Yunfei Dai yunfei.dai.si...@gmail.com 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
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
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:
quote
class Point:
Don't add
position = []
to your code. That's not a
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 can
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
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
On 06/10/2013 01:01 PM, Zachary Ware wrote:
On Mon, Jun 10, 2013 at 10:37 AM, Yunfei Dai yunfei.dai.si...@gmail.com 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.
On 2013-06-10, Joseph L. Casale jcas...@activenetwerx.com 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
On 10 June 2013 17:29, llanitedave llanited...@veawb.coop 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
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 Gaga
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.
-
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
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
On Mon, Jun 10, 2013 at 7:57 AM, Rui Maciel rui.mac...@gmail.com 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
/code
Is there a Python way of getting the same effect with Case
On Tue, Jun 11, 2013 at 5:40 AM, Mark Janssen dreamingforw...@gmail.com 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
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 that a
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 it
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 of the
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
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
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 and Eat
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
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
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info 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
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-compile code,
On Tue, Jun 11, 2013 at 8:27 AM, dhyams dhy...@gmail.com 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
On 2013-06-10, Terry Jan Reedy tjre...@udel.edu 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
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 r...@panix.com 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,
On Tue, Jun 11, 2013 at 8:39 AM, Grant Edwards invalid@invalid.invalid wrote:
On 2013-06-10, Terry Jan Reedy tjre...@udel.edu 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
On Mon, Jun 10, 2013 at 1:34 PM, Roy Smith r...@panix.com 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
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 those with
On Tue, Jun 11, 2013 at 9:10 AM, Tim Chase
python.l...@tim.thechases.com 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
On 10 Jun 2013 23:54, Roel Schroeven r...@roelschroeven.net 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!
--
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 you don't
On 06/10/2013 06:54 PM, Chris Angelico wrote:
On Tue, Jun 11, 2013 at 8:39 AM, Grant Edwards invalid@invalid.invalid wrote:
On 2013-06-10, Terry Jan Reedy tjre...@udel.edu wrote:
Another principle similar to 'Don't add extraneous code' is 'Don't
rebind builtins'.
OK, we've all done it by
On Monday, June 10, 2013 6:36:04 PM UTC-4, Chris Angelico wrote:
On Tue, Jun 11, 2013 at 8:27 AM, dhyams 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 r...@panix.com 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
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
1 - 100 of 191 matches
Mail list logo