在 2022年3月30日星期三 UTC+1 16:38:26, 写道:
> > On 30 Mar 2022, at 16:11, Edward Spencer wrote:
> >
> > 在 2021年9月3日星期五 UTC+1 18:50:51, 写道:
> >>>> On 2 Sep 2021, at 23:38, Dieter Maurer wrote:
> >>>
> >>> Edward Spencer wrote at 2021-9-2
在 2021年9月3日星期五 UTC+1 18:50:51, 写道:
> > On 2 Sep 2021, at 23:38, Dieter Maurer wrote:
> >
> > Edward Spencer wrote at 2021-9-2 10:02 -0700:
> >> Sometimes I like to pass the logging level up to the command line params
> >> so my user can specific what level
t
be accessed because they change (and in fact, between python 2 and 3, they did).
Any thoughts?
Thanks,
Ed Spencer
--
https://mail.python.org/mailman/listinfo/python-list
Hi
Sorry if I haven't stated my requirements clearly.
I just wanted a way to import at least two python files in parallel and I
wanted to know how this can be done or a reason why its bad as stated in
another post.
Thanks
Spencer
--
https://mail.python.org/mailman/listinfo/python-list
Why is importing modules in parallel bad?
Thanks
Spencer
--
https://mail.python.org/mailman/listinfo/python-list
On Tuesday, 5 November 2019 19:44:46 UTC+1, Rhodri James wrote:
> On 05/11/2019 18:33, Spencer Du wrote:
> > I want to execute at least two python files at once when imported but
> > I dont know how to do this. Currently I can only import each file one
> > after another bu
On Tuesday, 5 November 2019 19:41:59 UTC+1, Bob Gailer wrote:
> On Nov 5, 2019 1:35 PM, "Spencer Du" wrote:
> >
> > Hi
> >
> > I want to execute at least two python files at once when imported but I
> dont know how to do this. Currently I can only import
On Tuesday, 5 November 2019 21:05:02 UTC+1, Terry Reedy wrote:
> On 11/5/2019 1:33 PM, Spencer Du wrote:
>
> > I want to execute at least two python files at once when imported but I
> > dont know how to do this. Currently I can only import each file one after
> > an
On Tuesday, 5 November 2019 19:37:32 UTC+1, Karsten Hilbert wrote:
> > I want to execute at least two python files at once when imported but I
> > dont know how to do this.
> > Currently I can only import each file one after another but what i want is
> > each file to be imported
> > at the same
On Wednesday, 6 November 2019 09:05:42 UTC+1, Christian Gollwitzer wrote:
> Am 06.11.19 um 03:59 schrieb Dennis Lee Bieber:
> > On Tue, 5 Nov 2019 10:33:20 -0800 (PST), Spencer Du
> > declaimed the following:
> >
> >> Hi
> >>
> >> I want t
sed")
await asyncio.sleep(2)
print("Initialising")
await asyncio.sleep(2)
print("Initialised")
await asyncio.sleep(2)
print("Configuring")
await asyncio.sleep(2)
print("Configured")
await asyncio.sleep(2)
await message.sender.tell(DataMessage(data="Hello World Im a stage!" +
"\n", sender=self))
async def main():
# Let's create an instance of a Greeter actor and start it.
async with Stages() as stages:
# Then we'll just send it an empty message and wait for a response
reply : DataMessage = await ask(stages, Message())
print(reply.data)
asyncio.get_event_loop().run_until_complete(main())
Thanks
Spencer
--
https://mail.python.org/mailman/listinfo/python-list
27;, 'intensity'))
# if self.textbox.text() == "":
# self.mySlider.setValue(0)
# else:
# self.mySlider.setValue(config.get('445nm', 'intensity'))
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
config.py
[445nm]
intensity = 4
Thanks
Spencer
--
https://mail.python.org/mailman/listinfo/python-list
label_3.setText(_translate("Laser", "515nm"))
self.label_4.setText(_translate("Laser", "561nm"))
self.label_5.setText(_translate("Laser", "594nm"))
self.label_6.setText(_translate("Laser", "638nm"))
self.label_7.setText(_translate("Laser", "LED"))
self.pushButton_8.setText(_translate("Laser", "ON"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Laser = QtWidgets.QMainWindow()
ui = Ui_Laser()
ui.setupUi(Laser)
Laser.show()
sys.exit(app.exec_())
laserEmbedded.py
import random
import asyncio
from actorio import Actor, Message, DataMessage, ask, EndMainLoop, Reference
class Laser(Actor):
async def handle_message(self, message: Message):
print("Laser")
await asyncio.sleep(2)
print("Unitialised")
await asyncio.sleep(2)
print("Initialising")
await asyncio.sleep(2)
print("Initialised")
await asyncio.sleep(2)
print("Configuring")
await asyncio.sleep(2)
print("Configured")
await asyncio.sleep(2)
await message.sender.tell(DataMessage(data="Hello World Im a laser!"
+"\n", sender=self))
async def main():
# Let's create an instance of a Greeter actor and start it.
async with Laser() as laser:
# Then we'll just send it an empty message and wait for a response
reply : DataMessage = await ask(laser, Message())
print(reply.data)
asyncio.get_event_loop().run_until_complete(main())
Regards
Spencer
--
https://mail.python.org/mailman/listinfo/python-list
label_3.setText(_translate("Laser", "515nm"))
self.label_4.setText(_translate("Laser", "561nm"))
self.label_5.setText(_translate("Laser", "594nm"))
self.label_6.setText(_translate("Laser", "638nm"))
self.label_7.setText(_translate("Laser", "LED"))
self.pushButton_8.setText(_translate("Laser", "ON"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Laser = QtWidgets.QMainWindow()
ui = Ui_Laser()
ui.setupUi(Laser)
Laser.show()
sys.exit(app.exec_())
laserEmbedded.py
import random
import asyncio
from actorio import Actor, Message, DataMessage, ask, EndMainLoop, Reference
class Laser(Actor):
async def handle_message(self, message: Message):
print("Laser")
await asyncio.sleep(2)
print("Unitialised")
await asyncio.sleep(2)
print("Initialising")
await asyncio.sleep(2)
print("Initialised")
await asyncio.sleep(2)
print("Configuring")
await asyncio.sleep(2)
print("Configured")
await asyncio.sleep(2)
await message.sender.tell(DataMessage(data="Hello World Im a laser!"
+"\n", sender=self))
async def main():
# Let's create an instance of a Greeter actor and start it.
async with Laser() as laser:
# Then we'll just send it an empty message and wait for a response
reply : DataMessage = await ask(laser, Message())
print(reply.data)
asyncio.get_event_loop().run_until_complete(main())
Regards
Spencer
--
https://mail.python.org/mailman/listinfo/python-list
label_3.setText(_translate("Laser", "515nm"))
self.label_4.setText(_translate("Laser", "561nm"))
self.label_5.setText(_translate("Laser", "594nm"))
self.label_6.setText(_translate("Laser", "638nm"))
self.label_7.setText(_translate("Laser", "LED"))
self.pushButton_8.setText(_translate("Laser", "ON"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Laser = QtWidgets.QMainWindow()
ui = Ui_Laser()
ui.setupUi(Laser)
Laser.show()
sys.exit(app.exec_())
laserEmbedded.py
import random
import asyncio
from actorio import Actor, Message, DataMessage, ask, EndMainLoop, Reference
class Laser(Actor):
async def handle_message(self, message: Message):
print("Laser")
await asyncio.sleep(2)
print("Unitialised")
await asyncio.sleep(2)
print("Initialising")
await asyncio.sleep(2)
print("Initialised")
await asyncio.sleep(2)
print("Configuring")
await asyncio.sleep(2)
print("Configured")
await asyncio.sleep(2)
await message.sender.tell(DataMessage(data="Hello World Im a laser!"
+"\n", sender=self))
async def main():
# Let's create an instance of a Greeter actor and start it.
async with Laser() as laser:
# Then we'll just send it an empty message and wait for a response
reply : DataMessage = await ask(laser, Message())
print(reply.data)
asyncio.get_event_loop().run_until_complete(main())
Regards
Spencer
--
https://mail.python.org/mailman/listinfo/python-list
tton_7.setText(_translate("Laser", "ON"))
self.label.setText(_translate("Laser", "445nm"))
self.label_2.setText(_translate("Laser", "488nm"))
self.label_3.setText(_translate("Laser", "515nm"))
Hi
How do I publish a message of the qspinbox value when the qspinbox sets the
slider with corresponding value.
Thanks
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'laser.ui'
#
# Created by: PyQt5 UI code generator 5.13.0
#
# WARNING! All changes made in this fi
nceptually and practically the same kind of thing.
Spencer Graves
Cheers, Gene Heskett
--
https://mail.python.org/mailman/listinfo/python-list
nt, userdata, msg):
if msg.payload.decode() == "Hello world!":
print("Yes!")
Thanks
Spencer
--
https://mail.python.org/mailman/listinfo/python-list
On Friday, 6 September 2019 20:15:40 UTC+2, MRAB wrote:
> On 2019-09-06 18:11, Spencer Du wrote:
> > Hi
> >
> > I want to print yes in gui.py but it does not get printed because of the
> > json. How do I fix this. Execute embedded.py and then gui.py to test.
>
On Friday, 6 September 2019 20:15:40 UTC+2, MRAB wrote:
> On 2019-09-06 18:11, Spencer Du wrote:
> > Hi
> >
> > I want to print yes in gui.py but it does not get printed because of the
> > json. How do I fix this. Execute embedded.py and then gui.py to test.
>
On Friday, 6 September 2019 20:15:40 UTC+2, MRAB wrote:
> On 2019-09-06 18:11, Spencer Du wrote:
> > Hi
> >
> > I want to print yes in gui.py but it does not get printed because of the
> > json. How do I fix this. Execute embedded.py and then gui.py to test.
>
ibed to topic")
def on_message(client, userdata, msg):
print("message recieved= " + msg.payload.decode())
# print("File which you want to import(with .py extension)")
print("message topic=", msg.topic)
print("message qos="
Hi
I want to remove a string from a txt file and then print out what I have
removed. How do I do this.
The txt file is in this format and should be kept in this format.
txt.txt:
laser,cameras,
Thanks
--
https://mail.python.org/mailman/listinfo/python-list
ded.py to execute after GUI.py has executed first.
Thanks
Spencer
GUI.py
import logging
from datetime import timedelta
import time
from thespian.actors import *
from transitions import Machine
import paho.mqtt.client as mqtt
import importlib
import os
import os.path
import sys
from
Hi
I want to execute
"from devicesEmbedded import *": in GUI.py after all code in GUI.py is run.
Also how do I make the devicesEmbedded.py reload and run when a txt file is
created in the name of "list_of_devices.txt" in the GUI.py python program.
GUI.py
import logging
from datetime import
On Monday, 2 September 2019 15:29:07 UTC+2, Joel Goldstick wrote:
> On Mon, Sep 2, 2019 at 9:21 AM Spencer Du wrote:
> >
> > On Monday, 2 September 2019 15:03:52 UTC+2, Joel Goldstick wrote:
> > > On Mon, Sep 2, 2019 at 8:46 AM Spencer Du wrote:
> > > >
&g
On Monday, 2 September 2019 15:03:52 UTC+2, Joel Goldstick wrote:
> On Mon, Sep 2, 2019 at 8:46 AM Spencer Du wrote:
> >
> > On Monday, 2 September 2019 13:36:06 UTC+2, Pankaj Jangid wrote:
> > > Spencer Du writes:
> > >
> > > > How do i import
On Monday, 2 September 2019 13:36:06 UTC+2, Pankaj Jangid wrote:
> Spencer Du writes:
>
> > How do i import files inside a txt file if they exist in the current
> > directory?
> >
> > Here is the current code but I dont know how to do it correctly.
> >
On Monday, 2 September 2019 13:36:06 UTC+2, Pankaj Jangid wrote:
> Spencer Du writes:
>
> > How do i import files inside a txt file if they exist in the current
> > directory?
> >
> > Here is the current code but I dont know how to do it correctly.
> >
,test2
Each name refers to a python file.
Thanks
Spencer
--
https://mail.python.org/mailman/listinfo/python-list
Hi
I have code for GUI and MQTT. In GUI.py I have "def loadGUI" which loads up a
GUI file if the file exists in current directory. I want to add the file name
to a list when a file is imported and for each subsequent file that is imported
I want the file name to be imported to the same list an
Hi
I have code for GUI and MQTT. In GUI.py I have "def loadGUI" which loads up a
GUI file if the file exists in current directory. I want to add the file name
to a list when a file is imported and for each subsequent file that is imported
I want the file name to be imported to the same list an
ght_sheet_microscope/UI")
def on_message(self, mqttc, userdata, message):
msg = str(message.payload.decode("utf-8"))
print("File which you want to import(with .py extension)")
print("message topic=", message.topic)
print("message qos=", message.qos)
print("message retain flag=", message.retain)
def run(self):
self.connect("broker.hivemq.com", 1883, 60)
Thanks
Spencer
--
https://mail.python.org/mailman/listinfo/python-list
On Thursday, 8 August 2019 22:48:11 UTC+2, Spencer Du wrote:
> Ok so here is some code below. How do I write an if code block to execute
> some commands when I subscribe to the topic:
> microscope/light_sheet_microscope/UI and which has a message which is a
> device type publis
age to topic","microscope/light_sheet_microscope/UI")
client.publish("microscope/light_sheet_microscope/UI",device)
time.sleep(2) # wait
print("subscribing ")
client.subscribe("microscope/light_sheet_microscope/UI")
client.loop_stop() #stop the loop
Thanks
Spencer
--
https://mail.python.org/mailman/listinfo/python-list
.com" is a URL being
advertised for sale for $150,000. "ping something.com" returns, "cannot
resolve something.com: Unknown host".
Clearly the original poster is playing games with us.
Spencer
Cheers, Gene Heskett
--
https://mail.python.org/mailman/listinfo/python-list
i + 1
This sounds like a homework problem for a class. I don't know
how this list treats such questions, but I suspect answering such
questions may be discouraged.
Hint: Read the documentation on "while" and then trace the
iterations.
Spencer
--
ht
been used extensively. You'd have to work really hard to do
better, in my judgment.
Spencer Graves
DISCLAIMER: I'm primarily an R guy and only use Python when I can't
find a sensible way to do what I want in R.
Duncan
--
https://mail.python.org/mailman/listinfo/python-list
do this also, but I've not tried or verified them.
Spencer Graves
On 2018-11-11 08:11, Andrew Z wrote:
If you do scripts - emacs/vi is the way to go.
If you need something more (like creating libraries, classes) go with
pycharm. It is a professionally made IDE.
Over past 2 years
R
snippet, which does what I want (namely recording 5 seconds of whatever
is connected to "audio in" or something similar on your computer and
writing it to "KKFI2018-10-12t13_16-5sec.wav".
Thanks,
Spencer Graves
--
https://mail.python.org/mailman/listinfo/python-list
fit lots of people.
If you have suggestions for how the article might be improved,
you can post them to the "Talk" page associated with that article or
send them to me. If you are "autoconfirmed" with the Wikimedia system,
you can make the changes your
ot; for this, and what I should do after that?
I have decades of coding experience, but only a small portion of
that was with Python, and that was roughly 7 years ago.
Thanks,
Spencer Graves
[1] https://docs.python.org/3/glossary.html#term-package
[2] https://packaging.pyth
tarted with them after two days of effort.
2. Find a reasonable "Introduction to Python" on the web. Others
on this list should be able to suggest several. I just found
"https://docs.python.org/2/tutorial/introduction.html". A web search
for "an introduction to
ments tab
create a new R/Python3.5 environment", then install RStudio into that
new environment.[1]
So I killed the RStudio install and looked at the "Environments
tab". I'm new to Anaconda Navigator, and I didn't know what I was
looking at so decided to ask here.
udio in" on my Windows 7 machine.
Thanks again.
Spencer Graves
On 2018-09-21 23:33, Terry Reedy wrote:
On 9/21/2018 8:57 PM, MRAB wrote:
On 2018-09-22 01:02, Michael Torrie wrote:
On 09/21/2018 07:22 AM, Spencer Graves wrote:
PYTHON - M PIP INSTALL PYAUDIO
&qu
/ remove programs."
I repeated "Windows App Certification Kit", except that this time
when the "Modify setup" window appeared, I clicked "repair". It came to
that same point and gave the same error.
Suggestion?
Thanks,
Spencer
--
https://mail.python.org/mailman/listinfo/python-list
(I'm sorry for my delayed response -- I've been travelling and not had
reliable Internet access.)
On 2011-12-25, Ian Kelly wrote:
> On Thu, Dec 22, 2011 at 1:21 AM, Spencer Pearson
> wrote:
>> I see a problem with this, though. The intersection of two lines is
>>
asonable. I'll definitely reconsider
making the draw() method a requirement for all GeometricObjects.
>> I've never modified an existing class before, and I fear the
>> unfamiliar. If that's what you meant... it's really an acceptable
>> thing to do?
>
> Yes,
(I'm sorry for my delayed response -- I've been travelling and not had
reliable Internet access.)
>> Spencer, i would re-think this entire project from the
>> beginning. You are trying to make an object out of everything. You
>> don't need to make an object of EV
On Dec 23, 9:13 am, Terry Reedy wrote:
> On 12/22/2011 3:21 AM, Spencer Pearson wrote:
>
> > I'm writing a geometry package, with Points and Lines and Circles and
> > so on, and eventually I want to be able to draw these things on the
> > screen. I have two options
ator for adding entries to
draw_functions, but this is basically how it'd work.
The second way feels kludgey to me, but I'm leaning towards it because
it seems like so much less work and I'm out of ideas. Can anyone help,
explaining either a different way to do it or why one of these isn't
as bad as I think?
Thanks for your time!
-Spencer
--
http://mail.python.org/mailman/listinfo/python-list
I was recently trying to implement a dict-like object which would do
some fancy stuff when it was modified, and found that overriding the
__setitem__ method of an instance did not act the way I expected. The
help documentation (from help(dict.__setitem__)) claims that
"d.__setitem__(k,v)" is equiva
All right, thank you for helping! I'd had a little voice in the back
of my mind nagging me that it might not be logical to include a bunch
of classes and function definitions in my startup file, but I never
got around to splitting it up. The module/script distinction makes
sense, and it seems more
Hi! I'm writing a package with several files in it, and I've found
that "isinstance" doesn't work the way I expect under certain
circumstances.
Short example: here are two files.
# fileone.py
import filetwo
class AClass( object ):
pass
if __name__ == '__main__':
a = AClass()
filetwo.is_acl
Is there a way to developing a script on linux and give it
to someone on microsoft, so that they could run it on microsoft
without installing python?
Wayne
--
http://mail.python.org/mailman/listinfo/python-list
Hi!
This might be more of a personal-preference question than anything,
but here goes: when is it appropriate for a function to take a list or
tuple as input, and when should it allow a varying number of
arguments? It seems as though the two are always interchangeable. For
a simple example...
def
I am getting doubles of every email on this list. Is there a list manager I
can inform?
Please help this is getting very annoying and makes it very hard to follow
along.
Spencer
--
http://mail.python.org/mailman/listinfo/python-list
. I
also want to make a synchronizing program. Lastly, I love poker and I would
love even more to make a cool app for poker maybe an iPhone app or something
I can post to the iGoogle page.
So with that in mind where would you start?
Thanks,
Spencer
--
http://mail.python.org/mailman/listinfo/python
Ross wrote:
If I have a list of tuples a = [(1,2), (3,4), (5,6)], and I want to
return a new list of each individual element in these tuples, I can do
it with a nested for loop but when I try to do it using the list
comprehension b = [j for j in i for i in a], my output is b =
[5,5,5,6,6,6] inste
Saketh wrote:
Thank you, Peter and Michael, for your solutions! I think that
Michael's is what I was edging towards, but Peter's has demonstrated
to me how efficient Python's set functions are. I have a lot more to
learn about optimizing algorithms in Python... :)
--
http://mail.python.org/mail
Robert Kern wrote:
On 2009-04-20 23:04, per wrote:
to be more formal by very different, i would be happy if they were
maximally distant in ordinary euclidean space... so if you just plot
the 3-tuples on x, y, z i want them to all be very different from each
other. i realize this is obviously b
Saketh wrote:
Hi everyone:
I'm using "translation" in the sense of string.maketrans here.
I am trying to efficiently compare if two string translations
"conflict" -- that is, either they differently translate the same
letter, or they translate two different letters to the same one.
...
Anoth
Alexzive wrote:
Hello there,
I'd like to get the same result of set() but getting an indexable
object.
How to get this in an efficient way?
Example using set
A = [1, 2, 2 ,2 , 3 ,4]
B= set(A)
B = ([1, 2, 3, 4])
B[2]
TypeError: unindexable object
Many thanks, alex
--
http://mail.python.org/m
thomas.han...@gmail.com wrote:
...
So any ideas on how to get a function called on an object just after
__init__ is done executing?
--
http://mail.python.org/mailman/listinfo/python-list
Yes, you *can* use metaclasses - you need to override the type.__call__ method,
which is what normally ca
After I "compile" my program with py2exe 0.6.9 with Python 2.6, I'm
still getting the "Application Did Not Initialize Properly" error
dialog whenever I run my code. What am I doing wrong?
Note that py2exe 0.6.9 with Python 2.5 works just fine.
Help!
Chris.
On Sat, 15 Nov 2008 23:21:15 -0800,
t3chn0n3rd wrote:
> Do you think it is relatively easy to write sort algorithms such as
> the common Bubble sort in Python as compared to other high level
> programming langauges
yes
--
http://mail.python.org/mailman/listinfo/python-list
ki lo wrote:
> I have type variable which may have been set to 'D' or 'E'
>
> Now, which one of following statements are more efficient
>
> if type =='D' or type == 'E':
>
> or
>
> if re.search("D|E", type):
>
> Please let me know because the function is going to called 10s of
> millions of t
Wildemar Wildenburger wrote:
> Arnaud Delobelle wrote:
>> Personally, between
>>
>> * foo if foo else bar
>> * foo or bar
>>
>> I prefer the second. Maybe it could be spelt
>>
>> * foo else bar ?
>>
> How about
>
> val = foo rather than bar
>
> If that is not clear and obvios, I don't know what i
cf29 wrote:
> Greetings,
>
> I designed in JavaScript a small program on my website called 5
> queens.
..
Has anyone tried to do a such script? If anyone is
> interested to help I can show what I've done so far.
Tim Peters has a solution to 8 queens in test_generators in the standard
library
Terry Reedy wrote:
> "Maric Michaud" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> |I faced a strange behavior with generator expression, which seems like a
> bug, for both
> | python 2.4 and 2.5 :
>
> Including the latest release (2.5.2)?
>
> | >>> class A :
> | ... a = 1
MonkeeSage wrote:
> A quick question about how python parses a file into compiled
> bytecode. Does it parse the whole file into AST first and then compile
> the AST, or does it build and compile the AST on the fly as it reads
> expressions? (If the former case, why can't functions be called before
Kay Schluehr wrote:
>
> This unexpected attack in his rear frightened him so much, that he
> leaped forward with all his might: the horse's carcase dropped on the
> ground, but in his place the wolf was in the harness, and I on my part
> whipping him continually: we both arrived in full career saf
Michael Goerz wrote:
> Hi,
>
> I am writing unicode stings into a special text file that requires to
> have non-ascii characters as as octal-escaped UTF-8 codes.
>
> For example, the letter "Í" (latin capital I with acute, code point 205)
> would come out as "\303\215".
>
> I will also have to r
Dennis Lee Bieber wrote:
> On Fri, 30 Nov 2007 11:36:44 -0800, Michael Spencer
>>
>> Can anyone recommend a solution that also synchronizes post read status? If
>> Google Reader or something like it handled NNTP, I imagine I'd use it to
>> achieve
>>
Ben Finney wrote:
>
> I'm not interested in learning some centralised web-application
> interface, and far prefer the discussion forum to be available by a
> standard *protocol*, that I can use my choice of *local client*
> application with.
>
I agree: I use Thunderbird, and it works well. But
Tor Erik Sønvisen wrote:
> Hi,
>
> I've tried locating some code that can recreate an object from it's
> string representation...
> The object in question is really a dictionary containing other
> dictionaries, lists, unicode strings, floats, ints, None, and
> booleans.
>
> I don't want to use ev
Karlo Lozovina wrote:
>
> Any idea how to do that with metaclasses and arbitrary long list of
> attributes? I just started working with them, and it's driving me nuts :).
>
> Thanks for the help,
> best regards.
>
Try implementing a property factory function before worrying about the
metaclas
+1 Subject line of the week (SLOTW)
rjcarr wrote:
> So my question is ... why are they [os.path and logging.handlers] different?
[A] wrote:
> Because you misspelled it. First, do a dir() on logging:
[B] wrote:
> No, he didn't... OP: logging is a package and logging.handlers is one module
> in t
Python Maniac wrote:
> I am new to Python however I would like some feedback from those who
> know more about Python than I do at this time.
>
> def scrambleLine(line):
> s = ''
> for c in line:
> s += chr(ord(c) | 0x80)
> return s
>
> def descrambleLine(line):
> s = ''
>
Mark Morss wrote:
> I would like to construct a class that includes both the integers and
> None. I desire that if x and y are elements of this class, and both
> are integers, then arithmetic operations between them, such as x+y,
> return the same result as integer addition. However if either x o
Boudreau, Emile wrote:
> Hey all,
> So I'm trying to filter a list with the built-in function
> filter(). My list looks something like this:
> ['logs', 'rqp-8.2.104.0.dep', 'rqp-8.2.93.0.dep',
> 'rqp-win32-app-8.2.96.0-inst.tar.gz', 'rqp-win32-app-8.2.96.0-inst.tar.gz']
>
> Calling filte
"7stud" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> Can someone show me how to manually implement staticmethod()? Here is
> my latest attempt:
>
Raymond Hettinger can:
http://users.rcn.com/python/download/Descriptor.htm#static-methods-and-class-methods
alain wrote:
> I have a problem I wonder if it has been solved before.
> I have a dictionnary and I want the values in the dictionnary to be
> annotated with the rank that would be obtained by sorting the values
>
> def annotate_with_rank(my_dict):
>
> return my_annotated_dict
>
n00m wrote:
> http://www.spoj.pl/problems/SUMFOUR/
>
> 3
> 0 0 0 0
> 0 0 0 0
> -1 -1 1 1
> Answer for this input data is 33.
>
> My solution for the problem is
> ==
>
> import time
> t = time.clock()
>
> q,w,e,r,sch,h = [],[],[
Gabriel Genellina wrote:
>
> (I cannot find peephole.c on the source distribution for Python 2.5, but
> you menctioned it on a previous message, and the comment above refers to
> the peephole optimizer... where is it?)
>
The peephole optimizer is in compile.c - the entry point is optimize_c
Sergio Correia wrote:
> spam = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]
>
> Into something like
> eggs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
>
> There are *no* special cases (no empty sub-lists).
eggs = [i for j in spam for i in j]
Michael
--
http://mail.python.org/mailman/listinfo/
Franz Steinhaeusler wrote:
> Use Spaces, size: 4
> detect mixed line ending
> detect tabs mixed with space
> trim trailing whitespaces.
look at: tools/scripts/reindent.py
> convert structs like: if (a > b): to if a > b:
> fill in spaces, but not in functions between operators:
>
> a+=1 =>
J. Clifford Dyer wrote:
> I think that's the first time I've actually seen someone use a Monty
> Python theme for a python example, and I must say, I like it. However,
> "We are all out of Wensleydale."
>
> Cheers,
> Cliff
Oh, then you clearly don't waste nearly enough time on this newsgroup ;
BartlebyScrivener wrote:
> Python pseudo code limericks anywhere?
I wrote the following in response to Steve Holden's limerick challenge a
couple of years ago:
# run me or voice the alphanumeric tokens
from itertools import repeat
for feet in [3,3,2,2,3]:
print " ".join("DA-DA-DUM"
John Henry wrote:
> Carl Banks wrote:
>
>> The function can be extended to allow arbitrary arguments. Here's a
>> non-minmal recursive version.
>>
>> def cartesian_product(*args):
>> if len(args) > 1:
>> for item in args[0]:
>> for rest in cartesian_product(*args[1:]):
>>
Nick Maclaren wrote:
>
> Well, I am already doing that, and regretting the fact that Python
> doesn't seem to allow a class instantiation to return a new class :-)
>
>>> class Fake(object):
... def __new__(cls):
... return 42
...
>>> Fake()
42
>>>
"instantiation" (i.e.
Gregg Lind wrote:
> I wish something like this was part of the standard python installation,
> and didn't require one to use Numpy or Numarray. This sort of list
> subsetting is useful in many, many contexts.
>
Many of numpy's multi-dimensional slicing and indexing operations are
implemented
Kenneth McDonald wrote:
> I'm trying to write a 'flatten' generator which, when give a
> generator/iterator that can yield iterators, generators, and other data
> types, will 'flatten' everything so that it in turns yields stuff by
> simply yielding the instances of other types, and recursively
Martin v. Löwis wrote:
> Georg Brandl schrieb:
>> Perhaps you can bring up a discussion on python-dev about your improvements
>> and how they could be integrated into the standard library...
>
> Let me second this. The compiler package is largely unmaintained and
> was known to be broken (and perh
Paul Boddie wrote:
> Martin v. Löwis wrote:
...The compiler package is largely unmaintained and
>> was known to be broken (and perhaps still is).
>
> I don't agree entirely with the "broken" assessment. Although I'm not
> chasing the latest language constructs, the AST construction part of
> the p
Georg Brandl wrote:
> Michael Spencer wrote:
>> Announcing: compiler2
>> -
>>
>> For all you bytecode enthusiasts: 'compiler2' is an alternative to the
>> standard
>> library 'compiler' package, with several adva
Announcing: compiler2
-
For all you bytecode enthusiasts: 'compiler2' is an alternative to the
standard
library 'compiler' package, with several advantages.
Improved pure-python compiler
- Produces identical bytecode* to the built-in compile function for all /Lib
and L
George Sakkis wrote:
> Michael Spencer wrote:
>> George Sakkis wrote:
>>> Michael Spencer wrote:
>>>
>>>> def chunker(s, chunk_size=3, sentry=".", keep_first = False, keep_last =
>>>> False):
>>>> buffer=[]
>
George Sakkis wrote:
> Michael Spencer wrote:
>
>> Here's a small update to the generator that allows optional handling of the
>> head
>> and the tail:
>>
>> def chunker(s, chunk_size=3, sentry=".", keep_first = False, keep_last =
>>
1 - 100 of 428 matches
Mail list logo