multiprocessing article on PYMOTW - subclassing with 'def run' and 'logging'
https://pymotw.com/2/multiprocessing/basics.html https://pymotw.com/2/threading/ I didn't follow this 1. >The logger can also be configured through the logging configuration file >API, using the name multiprocessing. and 2. >it is also possible to use a custom subclass. > import multiprocessing > class Worker(multiprocessing.Process): >def run(self): >print 'In %s' % self.name >return therefore, how is 'def run' going to start a process? 'run' may be autocalled same as in 'threading' but in threading, the function is the Thread.. so you can do your work in def run: and expect it to be suitably threaded whereas here.. does he somehow magically convert a function to a process? -- https://mail.python.org/mailman/listinfo/python-list
Storing data in queue
Hello guys I am struggling here and need help. How can I store sqlite3 database or a table in a queue. #help -- https://mail.python.org/mailman/listinfo/python-list
Re: What do you use for slides?
Dan Stromberg ezt írta (időpont: 2019. nov. 15., P, 22:36): > I mostly use Libreoffice Impress, but I've also tried Google Slides. > > I don't think Impress does syntax highlighting out of the box, but there's > a plugin that claims to. > > Also, Google Slides purportedly supports highlighting just by > cut-and-pasting from a GUI editor/IDE with syntax highlighting. > > HTH. > > On Fri, Nov 15, 2019 at 9:38 AM Abdur-Rahmaan Janhangeer < > [email protected]> wrote: > > > Greetings all, > > > > For slides i use https://yhatt.github.io/marp/, but sometimes i want a > > more > > stylish tool. > > > > What do you use for slides? (besides powerpoint + syntax highlighting > > included) > > > > Thanks! > > > > Abdur-Rahmaan Janhangeer > > http://www.pythonmembers.club | https://github.com/Abdur-rahmaanJ > > Mauritius > > -- > > https://mail.python.org/mailman/listinfo/python-list > > > -- > https://mail.python.org/mailman/listinfo/python-list Hi I use Google drive's slides, plus https://revealjs.com/ br, George -- https://mail.python.org/mailman/listinfo/python-list
Re: Storing data in queue
On 16Nov2019 06:20, [email protected] wrote: Hello guys I am struggling here and need help. How can I store sqlite3 database or a table in a queue. #help You need to provide more information here. Are you talking about a python stdlib Queue object, for queuing in-memory objects for processing (eg to process them, maybe to apply their state to a database)? Are you trying to use a database table as a queue? Please describe the larger problem you're solving, and ideally a piece of code you've written which isn't solving your problem (unless you have no idea where to start, in which case: describe the problem in more detail). Remember that this is a text only list, so no attachments. Code should be pasted inline in the message. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list
Re: multiprocessing article on PYMOTW - subclassing with 'def run' and 'logging'
answered here https://www.reddit.com/r/Python/comments/dxhgec/ how_does_multiprocessing_convert_a_methodrun_in/ basically starts two PVMs - the whole fork, check 'pid' trick.. one process continues as the main thread and the other calls 'run' -- https://mail.python.org/mailman/listinfo/python-list
Re: nonlocal fails ?
On Fri, Nov 15, 2019, at 13:41, Dennis Lee Bieber wrote: > C# documents those as something visible to the user at the language > level... > https://www.infoworld.com/article/3043992/a-deep-dive-value-and-reference-types-in-net.html > """ > Types in Microsoft .Net can be either value type or reference type. > """ I was strictly talking about how reference types work (which are just like python or Java objects), and how that is completely distinct from the "ref" of call-by-reference arguments which are also supported, and that both features coexist just fine in the same language. The existence of value types wasn't really relevant to my point. I'm not sure if you were left with the impression that you can't have a "ref" argument that points to a variable of reference type (and which does *not* point directly to the object), but that is false. > Similar to Java. Well, Java doesn't have user-defined value types, but again, value types are beside the point. -- https://mail.python.org/mailman/listinfo/python-list
how to remove duplicates dict from the list of dictionary based on one of the elements is duplicate in list of dict
Hi,
How to remove duplicates dict from the list of dictionary based on one of
the duplicate elements in the dictionary,
l = [{"component":"software", "version":"1.2" },
{"component":"hardware", "version":"2.2",},
{"component":"driver", "version":"3.2",},
{"component":"firmware", "version":"4.2",},
{"component":"software", "version":"1.9",},
{"component":"hardware", "version":"2.7",}
]
need to remove the dict if having same components [in the above example
components "software" and "hardware" is duplicated twice
expected output:
[{"component":"software", "version":"1.2" },
{"component":"hardware", "version":"2.2",},
{"component":"driver", "version":"3.2",},
{"component":"firmware", "version":"4.2",}
]
--
https://mail.python.org/mailman/listinfo/python-list
Re: how to remove duplicates dict from the list of dictionary based on one of the elements is duplicate in list of dict
On 17Nov2019 12:26, Iranna Mathapati wrote:
How to remove duplicates dict from the list of dictionary based on one
of
the duplicate elements in the dictionary,
l = [{"component":"software", "version":"1.2" },
{"component":"hardware", "version":"2.2",},
{"component":"driver", "version":"3.2",},
{"component":"firmware", "version":"4.2",},
{"component":"software", "version":"1.9",},
{"component":"hardware", "version":"2.7",}
]
need to remove the dict if having same components [in the above example
components "software" and "hardware" is duplicated twice
expected output:
[{"component":"software", "version":"1.2" },
{"component":"hardware", "version":"2.2",},
{"component":"driver", "version":"3.2",},
{"component":"firmware", "version":"4.2",}
]
I would be inclined to keep a mapping (eg another dict) keyed on the
value of "component". When you process these lists, put the
component/version dicts into the appropriate entry in the new dict. If
an entry is already there, act appropriately (eg keep the existing
entry, keep the new entry, compare the entries in some way and keep the
"better" one, etc). Then at the end, walk the new dict and make a fresh
list.
Not providing example code because this feels a little homeworky, so we
expect you to attempt the code first.
Cheers,
Cameron Simpson
--
https://mail.python.org/mailman/listinfo/python-list
